Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My teams UI update #127

Open
wants to merge 56 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
cb0f52f
adding some basic elements to portal
Dec 11, 2023
155ddf9
Merge branch 'dev' into comp-portal-setup
Dec 11, 2023
7f14cd6
experimented with fetching competition data
Dec 11, 2023
876587c
tweaked some styles
Dec 11, 2023
9f4b63a
added search bar to find teams tab
Dec 14, 2023
e55579d
tweaked filter functionality
Dec 14, 2023
b08bfcb
added comments
Dec 14, 2023
a4cd26d
added functionality to join and leave teams
Dec 17, 2023
5470a33
user can make a new team
Dec 18, 2023
98a249f
setting up stats preview when user changes teams
Dec 18, 2023
ec9f7e8
fixed team card UI
Dec 18, 2023
386b10e
added team profile picture
Dec 18, 2023
0687bf6
tweaking team card preview
Dec 18, 2023
9978ddf
saving changes
Dec 19, 2023
6b31e8b
refined team preview card UI
Dec 20, 2023
0fe8401
added leaderboard
Dec 21, 2023
dae6ea3
tweaked leaderboard refresh text
Dec 21, 2023
2eb1a57
added stats to portal header
Dec 21, 2023
24ca16c
tweaked portal stats header UI
Dec 21, 2023
f6e4832
team ranks stats load properly now
Dec 22, 2023
315d5a5
tweaking some aync logic and UI
Dec 23, 2023
164ce06
added more stats to header
Dec 23, 2023
c05e432
added icons to stats
Dec 23, 2023
511862c
changed icon colors
Dec 23, 2023
e6138fa
added statistic to score history
Dec 23, 2023
f8586d6
updated score history bar chart
Dec 23, 2023
ee88aa6
Add basic layout for my team tab
jenetic Dec 24, 2023
91f121b
Add antd drag-to-upload component
jenetic Dec 27, 2023
f3d00d8
Add avatars for team members in my team tab using DiceBear
jenetic Dec 27, 2023
cb6fd44
Add invite code modal to 'invite' button on sidebar
jenetic Dec 28, 2023
8f0d642
Turn my team tab into 1 column instead of 2 on small screens
jenetic Dec 28, 2023
8e7152c
Add leave button to my team tab
jenetic Dec 28, 2023
451150f
polished my team ui
Dec 29, 2023
d553b3f
updated tab content margins
Dec 29, 2023
0bb6266
cleaning up css
Dec 29, 2023
63331ea
refactored UI
Dec 30, 2023
01721fd
added matches box
Dec 30, 2023
d1eeb12
fixed chart js bug
Dec 30, 2023
19116c8
refixed chart js bug
Dec 30, 2023
bf792e3
refactored score history percentage
Dec 30, 2023
188fb4e
removed redundant comments
Dec 30, 2023
7bb27c8
restyled team card tab and fontsizes across the page
Dec 30, 2023
a4636ec
changed fontsize for search
Dec 30, 2023
7c43c77
restyled sections in the myteam tab
Jan 5, 2024
91f645f
added folders for submission entry card
Jan 5, 2024
d668acd
added submission card list to my team tab
Jan 10, 2024
53b8ceb
added mroe info to submissin cards
Jan 10, 2024
15b797a
added avatars to submission cards
Jan 10, 2024
d45d007
polished submission preview cards
Jan 11, 2024
c7f5428
changed submission card modal text color
Jan 11, 2024
b1c2210
fixed loading UI for my team tab
Jan 14, 2024
fc59e16
updated page header styling and added new log page
Mar 1, 2024
a36b4cb
i think i resolved a bug where leaving team throws null error for joi…
Mar 1, 2024
7eec1f8
fixed loading for submission previews
Mar 1, 2024
e39a9ba
added documentation
Mar 1, 2024
3839648
removed most of redundant inline css
Mar 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
426 changes: 419 additions & 7 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
"name": "@acmucsd/acm-ai-site",
"version": "2.0.0",
"dependencies": {
"@dicebear/collection": "^7.0.1",
"@dicebear/core": "^7.0.1",
"@types/aos": "^3.0.3",
"@types/chart.js": "^2.9.27",
"aos": "^3.0.0-beta.6",
"axios": "^1.4.0",
"chart.js": "^2.9.4",
"cors": "^2.8.5",
"express": "^4.17.1",
"moment": "^2.30.1",
"path-browserify": "^1.0.1",
"postcss-loader": "^7.3.3",
"prettier": "^2.1.2",
Expand Down Expand Up @@ -70,6 +73,7 @@
"react-intersection-observer": "^9.5.2",
"serve": "^14.2.0",
"style-loader": "^3.3.3",
"typescript": "^4.9.5"
"typescript": "^4.9.5",
"webpack": "^5.89.0"
}
}
14 changes: 14 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ import CompetitionPortalPage from './pages/Competitions/CompetitionPortalPage';

import ProjectPage from './pages/ProjectsPage/index';
import JoinTeamsPage from './pages/Competitions/CompetitionTeamPages/JoinTeamsPage';
import SubmissionLogPage from './pages/Competitions/CompetitionPortalPage/SubmissionLogPage';
import MatchesPage from './pages/Competitions/CompetitionPortalPage/MatchesPage';

let cookie = getCookie(COOKIE_NAME);

Expand Down Expand Up @@ -136,6 +138,18 @@ function App() {
component={CompetitionPortalPage}
/>

<Route
path="/:competitionName/submissionLog/:id"
exact
component={SubmissionLogPage}
/>

<Route
path="/matches/:id"
exact
component={MatchesPage}
/>

<Route
path="/competitions/:id"
exact
Expand Down
7 changes: 7 additions & 0 deletions src/actions/competition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ export type PastCompetition = {
route: string;
};

export interface CompetitionData {
rank: number;
team: string;
score: number;
submitHistory: Array<string>;
}

export const uploadSubmission = async (
file: File | undefined,
tagsSelected: string[],
Expand Down
48 changes: 46 additions & 2 deletions src/actions/teams/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ export const addToTeam = async (
let body = {
username,
teamName,
code,
competitionName,
code
};

return new Promise((resolve, reject) => {
Expand All @@ -155,7 +156,7 @@ export const addToTeam = async (
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
}
}
)
.then((res: AxiosResponse) => {
Expand All @@ -168,3 +169,46 @@ export const addToTeam = async (
});
});
};



export const leaveTeam = async(
competitionName: string,
username: string,
teamName: string
): Promise<AxiosResponse> => {
let token = getToken(COOKIE_NAME);

return new Promise((resolve, reject) => {
axios
.delete(
process.env.REACT_APP_API +
`/v1/competitions/teams/${competitionName}/remove-member`,
{
headers: {
Authorization: `Bearer ${token}`,
},
data: {
username: username,
teamName: teamName,
}


}


)
.then((res: AxiosResponse) => {
resolve(res);
})
.catch((error) => {
message.error(error.response.data);
reject(error);
});
});



};


19 changes: 17 additions & 2 deletions src/components/EventCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* Modular component that displays event data in the form of a card. This is used in the
* home page and events page. Provides ability to expand details via a modal.
*
* @param {ACMEvent} event custom type that contains information about the event
*
*/
import React, { useState } from 'react';
import { Row, Col, Button, Modal } from 'antd';
import { AiFillCalendar, AiOutlineLink } from 'react-icons/ai';
Expand All @@ -6,19 +13,23 @@ import { ACMEvent } from '../../actions/events';
import { HiLocationMarker } from 'react-icons/hi';

const EventCard = ({ event }: { event: ACMEvent }) => {

const [isModalOpen, setIsModalOpen] = useState(false);
// Modal props

const showModal = () => {
setIsModalOpen(true);
console.log(isModalOpen);
};

const handleCancel = () => {
setIsModalOpen(false);
};

const formatCalendarTime = (dateTime: string) => {
return new Date(dateTime).toISOString().replace(/-|:|\.\d+/g, '');
};

// Helper function to format external links for shceduling a new event
const googleCalendarLink = `https://www.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(
event.title
)}&details=${encodeURIComponent(
Expand Down Expand Up @@ -83,10 +94,12 @@ const EventCard = ({ event }: { event: ACMEvent }) => {
onCancel={handleCancel}
title={<h3 style={{ fontWeight: '700' }}>{event.title}</h3>}
footer={

// If this is an old event, do not give user ability to schedule the event
new Date() > new Date(event.end) ? null : (

/* Antd Button has a bug where using href directly will mess up the
* alignment of the button text so we use onClick instead
* alignment of the button text so we use onClick() instead
*/
<Button
size="large"
Expand Down Expand Up @@ -160,6 +173,8 @@ const EventCard = ({ event }: { event: ACMEvent }) => {
</>
);
};


/**
* Formats a date to be readable.
* @param {string} time The time in unformatted form.
Expand Down
24 changes: 7 additions & 17 deletions src/components/EventTimeline/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Component that displays EventCards in an AntDesign Timeline
*
* @param {ACMEvent[]} eventData an array of ACMEvents
*
*/
import React from 'react';
import { Empty, Timeline, Button } from 'antd';
import { Link } from 'react-router-dom';
Expand All @@ -10,6 +16,7 @@ const EventTimeline = ({ eventData }: { eventData: ACMEvent[] }) => {
<div className="EventTimeline">
{eventData.length > 0 ? (
<Timeline>

{/* Show at most 2 events as a preview */}
{eventData.slice(0, 2).map((event) => (
<Timeline.Item
Expand Down Expand Up @@ -68,20 +75,3 @@ export const formatTime = (time: string | number | Date): string => {
};

export default EventTimeline;

// {
// /* <div className="timeline-item">
// <Badge className="timeline-badge" size="default" count={<CalendarOutlined className="timeline-icon" style={{ color: '#2e3036', backgroundColor: '#ececec'}}/>}>
// <div className="timeline-date">
// <h2>{formatMonthDate(event.start).month}</h2>
// <h3>{formatMonthDate(event.start).day}</h3>
// </div>
// </Badge>

// <div className="timeline-content">
// <h2>{event.title}</h2>
// <h3>{event.location}</h3>
// <h3>{formatTime(event.start)} - {formatTime(event.end)}</h3>
// </div>
// </div> */
// }
9 changes: 8 additions & 1 deletion src/components/Header/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

.Header {
position: fixed;
top: 0;
left: 0;
right: 0;
width: 100%;
z-index: 100;
height: 88px;
Expand All @@ -12,6 +15,7 @@
background: @white;

.navBarWrapper {
margin: 0;
height: 80px;
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -129,11 +133,14 @@
width: 100%;
text-decoration: none;
font-size: @font4;
color: @black;
font-weight: @semi-bold;
margin: 0.5rem 0;
:hover {
cursor: pointer;
color: @mainred;
}
a {
color:@black;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ function Header() {
{isMobile ? (
// Mobile menu button
<Button
ghost
className="menuButton"
icon={<HiOutlineMenu size={35} />}
icon={<HiOutlineMenu size={35} style = {{color: "black"}} />}
onClick={() => toggleMenu()}
/>
) : (
Expand Down
5 changes: 5 additions & 0 deletions src/components/MainFooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { AiOutlineLink } from 'react-icons/ai';
import { BiLogoInstagram, BiLogoDiscord } from 'react-icons/bi';
const { Footer } = Layout;

/**
* Component that displays additional info about
* ACM AI. Typically placed at the bottom of all pages
*
*/
const MainFooter = () => {
return (
<Footer className="mainFooter">
Expand Down
19 changes: 16 additions & 3 deletions src/components/ProjectCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import { Card } from '../Card';
import { Tag, Modal, Row, Col } from 'antd';
import './index.less';


/**
* Finds ASCII sum of a tag which is later used to color encode the tag
* @param {string} str represents a semantic tag or label for a project
* @returns int
*/
var ASCIISum = (str: string) => {
let sum = 0;
for (let i = 0; i < str.length; ++i) {
Expand All @@ -14,17 +20,22 @@ var ASCIISum = (str: string) => {
return sum;
};


/**
* Modular component that displays ACM AI project information. This is used in the
* projects page.
*
* @param {Project} project
*/
const ProjectCard = ({ project }: { project: Project }) => {
const [isModalOpen, setIsModalOpen] = useState(false);
const color_tag: string[] = ['red', 'blue', 'gold', 'purple', 'green'];
//['magenta', 'cyan', 'gold', 'blue', 'purple', 'green'];
//['#DCB9B9', '#8FA5BE', '#E1B053', '#6D6864', '#8E799F', '#889F79']

// Modal props
const showModal = () => {
setIsModalOpen(true);
console.log(isModalOpen);
};

const handleCancel = () => {
setIsModalOpen(false);
};
Expand Down Expand Up @@ -83,6 +94,7 @@ const ProjectCard = ({ project }: { project: Project }) => {
<div className="iconsBox"></div>
</Card>

{/* Modal to display full project description and links to project repo */}
<Modal
open={isModalOpen}
onCancel={handleCancel}
Expand Down Expand Up @@ -129,6 +141,7 @@ export const formatTime = (time: string | number | Date): string => {
hour12: true,
});
};

export const isURL = (str: string): boolean => {
const pattern = new RegExp(
'^(https?:\\/\\/)?' + // protocol
Expand Down
Loading