From cb0f52fcd0b191f6a8c59c6c9dd1769d87dc8c39 Mon Sep 17 00:00:00 2001
From: William Kim
Date: Sun, 10 Dec 2023 18:20:06 -0800
Subject: [PATCH 01/55] adding some basic elements to portal
---
src/newStyles/components.less | 1 -
.../CompetitionPortalPage/index.less | 31 ++++++
.../CompetitionPortalPage/index.tsx | 97 +++++++++++++++++--
3 files changed, 122 insertions(+), 7 deletions(-)
diff --git a/src/newStyles/components.less b/src/newStyles/components.less
index 7a44630..2ddc081 100644
--- a/src/newStyles/components.less
+++ b/src/newStyles/components.less
@@ -53,7 +53,6 @@
// A wrapper for most sections with content
.generic-section {
padding: 3rem @padding-base2;
- margin: 0 auto; /* This will center the container horizontally */
box-sizing: border-box; /* Include padding and borders within the width */
}
diff --git a/src/pages/Competitions/CompetitionPortalPage/index.less b/src/pages/Competitions/CompetitionPortalPage/index.less
index a292be7..2dfdfa9 100644
--- a/src/pages/Competitions/CompetitionPortalPage/index.less
+++ b/src/pages/Competitions/CompetitionPortalPage/index.less
@@ -2,15 +2,46 @@
@import '../../../newStyles/components.less';
@import '../../../newStyles/index.less';
+
.CompetitionPortalPage {
.noContainer();
+
+ // prevents layout shifts caused by scrollbar
+ overflow-y: hidden;
+ background: @white;
+
+
#portalHeader{
.generic-section();
.constrained-bounds();
margin-top: 4rem;
}
+ #portalStatsContent {
+
+
+ p#noTeamMessage {
+ margin-top: 2rem;
+ text-align: left;
+ background: @gray;
+ border-radius: @radius-base4;
+ padding: @padding-base3;
+ max-width: @sm;
+
+ }
+
+ }
+
+ #portalTabContent {
+ .generic-section();
+ .constrained-bounds();
+
+ .ant-tabs-ink-bar {
+ display: none;
+ }
+ }
+
}
\ No newline at end of file
diff --git a/src/pages/Competitions/CompetitionPortalPage/index.tsx b/src/pages/Competitions/CompetitionPortalPage/index.tsx
index da78e21..2578036 100644
--- a/src/pages/Competitions/CompetitionPortalPage/index.tsx
+++ b/src/pages/Competitions/CompetitionPortalPage/index.tsx
@@ -1,22 +1,87 @@
import React, { useContext, useEffect } from "react";
-import { message } from "antd";
+import { List, Tabs, message } from "antd";
import { Layout, Space, Button } from 'antd';
import UserContext from "../../../UserContext";
import { useHistory } from 'react-router-dom';
+import {
+ getTeamInfo,
+ createTeam,
+ getCompetitionUser,
+ } from '../../../actions/teams/utils';
+
import './index.less';
+import path from 'path';
+
import DefaultLayout from "../../../components/layouts/default";
const { Content } = Layout;
+
+const FindTeamsTab = (): React.ReactNode => {
+ return (
+
+ Find Teams
+
+
+ );
+ };
+
+
+const LeaderBoardTab = (): React.ReactNode => {
+ return (
+
+ Leaderboard
+
+
+ );
+ };
+
+
+ const MyTeamTab = (): React.ReactNode => {
+ return (
+
+ My Team
+
+ );
+ };
+
+
+
function CompetitionPortalPage () {
const history = useHistory();
const { user } = useContext(UserContext);
+ const tabItems= [
+ {
+ label: Leaderboard
,
+ key: '1',
+ children: LeaderBoardTab(),
+ },
+ {
+ label: Find Teams
,
+ key: '2',
+ children: FindTeamsTab(),
+ },
+ {
+ label: My Team
,
+ key: '3',
+ children: MyTeamTab(),
+ }
+ ];
+
useEffect(() => {
if (!user.loggedIn) {
message.info('You need to login to upload predictions and participate');
- // history.replace(path.join(window.location.pathname, '../../../login'));
+ history.replace(path.join(window.location.pathname, '../../../login'));
+ }
+ }, []);
+
+
+ useEffect(() => {
+ if (!user.loggedIn) {
+ message.info('You need to login to upload predictions and participate');
+ history.replace(path.join(window.location.pathname, '../../../login'));
}
}, []);
@@ -25,10 +90,30 @@ function CompetitionPortalPage () {
+
+
+
+
+
+
+
+ {/* If the user is not part of a team yet, then */}
+
From 7f14cd6b909a0420366ca310116454d5486dc17e Mon Sep 17 00:00:00 2001
From: William Kim
Date: Sun, 10 Dec 2023 22:24:50 -0800
Subject: [PATCH 02/55] experimented with fetching competition data
---
.../CompetitionPortalPage/index.less | 12 +++
.../CompetitionPortalPage/index.tsx | 87 +++++++++++++++----
2 files changed, 81 insertions(+), 18 deletions(-)
diff --git a/src/pages/Competitions/CompetitionPortalPage/index.less b/src/pages/Competitions/CompetitionPortalPage/index.less
index 2dfdfa9..0126da7 100644
--- a/src/pages/Competitions/CompetitionPortalPage/index.less
+++ b/src/pages/Competitions/CompetitionPortalPage/index.less
@@ -43,5 +43,17 @@
}
+ .teamPreviewCard {
+ width: 100%;
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ align-items: center;
+ background: @gray;
+ padding: @padding-base3 @padding-base2;
+ border-radius: @radius-base4;
+ }
+
+
}
\ No newline at end of file
diff --git a/src/pages/Competitions/CompetitionPortalPage/index.tsx b/src/pages/Competitions/CompetitionPortalPage/index.tsx
index 2578036..762a50c 100644
--- a/src/pages/Competitions/CompetitionPortalPage/index.tsx
+++ b/src/pages/Competitions/CompetitionPortalPage/index.tsx
@@ -1,5 +1,5 @@
-import React, { useContext, useEffect } from "react";
-import { List, Tabs, message } from "antd";
+import React, { useContext, useEffect, useState } from "react";
+import { Avatar, List, Tabs, message } from "antd";
import { Layout, Space, Button } from 'antd';
import UserContext from "../../../UserContext";
import { useHistory } from 'react-router-dom';
@@ -7,21 +7,49 @@ import {
getTeamInfo,
createTeam,
getCompetitionUser,
+ getTeams,
} from '../../../actions/teams/utils';
import './index.less';
import path from 'path';
import DefaultLayout from "../../../components/layouts/default";
+import { PaginationPosition, PaginationAlign } from "antd/es/pagination/Pagination";
+import { all } from "axios";
const { Content } = Layout;
+const teamCard = (team: any): React.ReactNode => {
+ return (
+
+
{team.teamName}
+
{team.teamMembers.length} members
+ {/* {team.teamMembers.map((member: string, index: number) => (
+
{member}
+ ))} */}
+
+ );
+};
-const FindTeamsTab = (): React.ReactNode => {
+
+const FindTeamsTab = (data: Array
,
+ key: '1',
+ children: LeaderBoardTab(),
+ },
+ {
+ label: Find Teams
,
+ key: '2',
+ children: FindTeamsTab(allTeams),
+ },
+ {
+ label: My Team
,
+ key: '3',
+ children: MyTeamTab(),
+ }
+ ]
+ }
>
From 876587c58db7bec7a261af68611f78efe174f618 Mon Sep 17 00:00:00 2001
From: William Kim
Date: Sun, 10 Dec 2023 22:33:01 -0800
Subject: [PATCH 03/55] tweaked some styles
---
.../Competitions/CompetitionPortalPage/index.less | 3 ++-
.../Competitions/CompetitionPortalPage/index.tsx | 13 ++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/pages/Competitions/CompetitionPortalPage/index.less b/src/pages/Competitions/CompetitionPortalPage/index.less
index 0126da7..ee0df2c 100644
--- a/src/pages/Competitions/CompetitionPortalPage/index.less
+++ b/src/pages/Competitions/CompetitionPortalPage/index.less
@@ -24,10 +24,11 @@
p#noTeamMessage {
margin-top: 2rem;
text-align: left;
- background: @gray;
+ background: @black;
border-radius: @radius-base4;
padding: @padding-base3;
max-width: @sm;
+ color: @white;
}
diff --git a/src/pages/Competitions/CompetitionPortalPage/index.tsx b/src/pages/Competitions/CompetitionPortalPage/index.tsx
index 762a50c..391c603 100644
--- a/src/pages/Competitions/CompetitionPortalPage/index.tsx
+++ b/src/pages/Competitions/CompetitionPortalPage/index.tsx
@@ -23,19 +23,26 @@ const { Content } = Layout;
const teamCard = (team: any): React.ReactNode => {
return (
-
{team.teamName}
+
{team.teamName}
{team.teamMembers.length} members
{/* {team.teamMembers.map((member: string, index: number) => (
{member}
))} */}
+
+
+ {/** Clicking the button should open a modal to display team details and the option to join if user isn't part of team yet */}
+
);
};
const FindTeamsTab = (data: Array