From 3024dac129582df83565a116b4058ad282562923 Mon Sep 17 00:00:00 2001 From: Josef Macera <69404945+lmaosoggypancakes@users.noreply.github.com> Date: Sat, 16 Mar 2024 17:34:13 -0400 Subject: [PATCH] feat: teams table on admin dashboard (#222) Co-authored-by: Jaisal Patel <70134418+GhostOf0days@users.noreply.github.com> Co-authored-by: GhostOf0days --- .eslintrc.js | 4 +- .github/workflows/main.yml | 38 +- .prettierrc | 52 +- next.config.js | 22 +- pages/_app.tsx | 82 +- pages/_document.tsx | 187 +-- pages/admin.tsx | 46 +- pages/apply.tsx | 44 +- pages/auth/reset/[token].tsx | 32 +- pages/auth/verify/[token].tsx | 195 +-- pages/confirmation.tsx | 78 +- pages/forgot-password.tsx | 30 +- pages/index.tsx | 40 +- pages/login.tsx | 42 +- pages/logout.tsx | 26 +- pages/messages.tsx | 72 +- pages/register.tsx | 40 +- pages/teams.tsx | 397 +++--- pages/teams/create.tsx | 310 ++--- pages/teams/details/[teamId].tsx | 828 +++++++------ src/_enums/AnalyticsEvent.ts | 12 +- src/_enums/DispatchActionType.ts | 110 +- src/_enums/Profile.ts | 80 +- src/_enums/RequestStatus.ts | 8 +- src/_enums/Status.ts | 26 +- src/_types/APIRequest.ts | 6 +- src/_types/AnalyticsData.ts | 68 +- src/_types/ApplicationForm.ts | 94 +- src/_types/CheckIn.ts | 8 +- src/_types/DispatchAction.ts | 32 +- src/_types/Participant.ts | 14 +- src/_types/RootState.ts | 108 +- src/_types/SSRData.ts | 28 +- src/_types/Team.ts | 28 +- src/actions/analytics.ts | 22 +- src/actions/application.ts | 176 +-- src/actions/auth.ts | 136 +- src/actions/checkin.ts | 22 +- src/actions/index.ts | 42 +- src/actions/recruiters.ts | 42 +- src/actions/requests.ts | 102 +- src/actions/settings.ts | 78 +- src/actions/sponsors.ts | 44 +- src/actions/teams.ts | 140 +-- src/actions/user.ts | 223 ++-- .../admin/AdminDialog/index.module.scss | 10 +- src/components/admin/AdminDialog/index.tsx | 129 +- .../admin/Analytics/Demographics.tsx | 403 +++--- src/components/admin/Analytics/Stats.tsx | 326 ++--- .../admin/Analytics/index.module.scss | 94 +- src/components/admin/Analytics/index.tsx | 121 +- .../admin/CheckInTable/index.module.scss | 54 +- src/components/admin/CheckInTable/index.tsx | 319 ++--- .../admin/EditTeam/index.module.scss | 31 + src/components/admin/EditTeam/index.tsx | 73 ++ .../admin/ParticipantTable/index.module.scss | 122 +- .../admin/ParticipantTable/index.tsx | 1090 +++++++++-------- .../admin/ProfileBox/index.module.scss | 40 +- src/components/admin/ProfileBox/index.tsx | 594 ++++----- .../RecruiterCreationForm/index.module.scss | 58 +- .../admin/RecruiterCreationForm/index.tsx | 354 +++--- .../SponsorCreationForm/index.module.scss | 58 +- .../admin/SponsorCreationForm/index.tsx | 174 +-- src/components/admin/Teams/index.module.scss | 124 ++ src/components/admin/Teams/index.tsx | 337 +++++ .../AuthenticationDialog/index.module.scss | 116 +- .../auth/AuthenticationDialog/index.tsx | 332 ++--- .../PasswordResetDialog/index.module.scss | 62 +- .../auth/PasswordResetDialog/index.tsx | 174 +-- .../auth/RequestResetDialog/index.module.scss | 68 +- .../auth/RequestResetDialog/index.tsx | 182 +-- .../ConfirmationDialog/index.module.scss | 96 +- .../confirmation/ConfirmationDialog/index.tsx | 272 ++-- src/components/dashboard/DashboardDialog.tsx | 774 ++++++------ src/components/design/BackButton.tsx | 46 +- .../design/BurgerMenu/index.module.scss | 6 +- src/components/design/BurgerMenu/index.tsx | 94 +- .../design/ContentHeader/index.module.scss | 50 +- src/components/design/ContentHeader/index.tsx | 40 +- .../design/FloatingDiv/index.module.scss | 66 +- src/components/design/FloatingDiv/index.tsx | 16 +- src/components/design/HeaderUnderline.tsx | 30 +- src/components/design/Logo/index.tsx | 384 +++--- src/components/design/Notification.tsx | 62 +- .../design/RectangleButton/index.module.scss | 16 +- .../design/RectangleButton/index.tsx | 68 +- .../design/ScottyLabsHeader/index.module.scss | 24 +- .../design/ScottyLabsHeader/index.tsx | 78 +- .../design/ScottyLabsIcon/index.module.scss | 8 +- .../design/ScottyLabsIcon/index.tsx | 28 +- src/components/design/ScottyLabsTitle.tsx | 50 +- src/components/design/TartanHacksIcon.tsx | 86 +- src/components/design/Text/index.module.scss | 26 +- src/components/design/Text/index.tsx | 38 +- .../design/WaveBackground/index.module.scss | 60 +- .../design/WaveBackground/index.tsx | 134 +- .../design/WaveFooter/index.module.scss | 38 +- src/components/design/WaveFooter/index.tsx | 82 +- .../design/WaveHeader/index.module.scss | 182 +-- src/components/design/WaveHeader/index.tsx | 180 +-- .../form/ApplicationForm/BasicSection.tsx | 437 +++---- .../form/ApplicationForm/EssaySection.tsx | 141 +-- .../ApplicationForm/ExperienceSection.tsx | 142 +-- .../form/ApplicationForm/LogisticsSection.tsx | 359 +++--- .../form/ApplicationForm/PortfolioSection.tsx | 358 +++--- .../form/ApplicationForm/SchoolSection.tsx | 321 ++--- .../WorkAuthorizationSection.tsx | 258 ++-- .../form/ApplicationForm/index.module.scss | 118 +- src/components/form/ApplicationForm/index.tsx | 416 +++---- src/components/menu/Menu/MenuItem.tsx | 74 +- src/components/menu/Menu/MenuLine.tsx | 36 +- src/components/menu/Menu/index.module.scss | 156 +-- src/components/menu/Menu/index.tsx | 162 +-- .../teams/TeamTableEntry.module.scss | 82 +- src/components/teams/TeamTableEntry.tsx | 132 +- .../teams/messages/Message.module.scss | 134 +- src/components/teams/messages/Message.tsx | 269 ++-- .../teams/messages/MessagesDialog.module.scss | 34 +- .../teams/messages/MessagesDialog.tsx | 210 ++-- src/components/waitlist/index.tsx | 84 +- src/layouts/AdminLayout.tsx | 102 +- src/layouts/AuthenticatedLayout.tsx | 122 +- src/layouts/DialogLayout.tsx | 22 +- src/layouts/index.module.scss | 16 +- src/layouts/index.tsx | 6 +- src/store/index.ts | 26 +- src/store/middleware/api.ts | 150 +-- src/store/reducers/accounts.ts | 95 +- src/store/reducers/analytics.ts | 60 +- src/store/reducers/application.ts | 427 +++---- src/store/reducers/index.ts | 36 +- src/store/reducers/recruiters.ts | 60 +- src/store/reducers/requests.ts | 90 +- src/store/reducers/settings.ts | 122 +- src/store/reducers/sponsors.ts | 60 +- src/store/reducers/teams.ts | 96 +- src/store/reducers/user.ts | 66 +- src/themes/theme.ts | 34 +- src/util/auth.tsx | 24 +- src/util/createEmotionCache.ts | 22 +- src/util/fetcher.tsx | 24 +- src/util/getSchools.ts | 42 +- src/util/isValidPhoneNumber.ts | 12 +- src/util/lists.tsx | 114 +- styles/Apply.module.scss | 20 +- styles/Auth.module.scss | 62 +- styles/Confirmation.module.scss | 14 +- styles/CreateTeam.module.scss | 78 +- styles/DashboardDialog.module.scss | 126 +- styles/Home.module.scss | 10 +- styles/Verify.module.scss | 82 +- styles/ViewTeam.module.scss | 218 ++-- styles/ViewTeams.module.scss | 100 +- styles/globals.scss | 40 +- styles/mixins.scss | 80 +- styles/variables.scss | 44 +- 156 files changed, 10146 insertions(+), 9172 deletions(-) create mode 100644 src/components/admin/EditTeam/index.module.scss create mode 100644 src/components/admin/EditTeam/index.tsx create mode 100644 src/components/admin/Teams/index.module.scss create mode 100644 src/components/admin/Teams/index.tsx diff --git a/.eslintrc.js b/.eslintrc.js index f13e39a..c0410e5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,9 +21,9 @@ module.exports = { }, rules: { "@typescript-eslint/camelcase": ["off", { properties: "never" }], - "@typescript-eslint/quotes": ["error", "double"], + "@typescript-eslint/quotes": "off", camelcase: "off", - "comma-dangle": ["error", "never"], + "comma-dangle": "off", "no-extra-semi": 2, "no-irregular-whitespace": 2, "no-lonely-if": 2, diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7a7b621..50a41d1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,28 +4,28 @@ name: CI # Controls when the action will run. on: - # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: [main] - pull_request: - branches: [main] + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [main] + pull_request: + branches: [main] - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 - - name: Build project - run: | - npm install - npm run build + - name: Build project + run: | + npm install + npm run build diff --git a/.prettierrc b/.prettierrc index b5f10b7..bb7c2e9 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,27 +1,27 @@ { - "bracketSpacing": true, - "printWidth": 80, - "proseWrap": "preserve", - "semi": true, - "singleQuote": true, - "trailingComma": "all", - "tabWidth": 4, - "useTabs": true, - "arrowParens": "always", - "endOfLine": "lf", - "overrides": [ - { - "files": "*.json", - "options": { - "singleQuote": false - } - }, - { - "files": ".*rc", - "options": { - "singleQuote": false, - "parser": "json" - } - } - ] -} \ No newline at end of file + "bracketSpacing": true, + "printWidth": 80, + "proseWrap": "preserve", + "semi": true, + "singleQuote": true, + "trailingComma": "all", + "tabWidth": 4, + "useTabs": true, + "arrowParens": "always", + "endOfLine": "lf", + "overrides": [ + { + "files": "*.json", + "options": { + "singleQuote": false + } + }, + { + "files": ".*rc", + "options": { + "singleQuote": false, + "parser": "json" + } + } + ] +} diff --git a/next.config.js b/next.config.js index 6fa5aa5..5e3d601 100644 --- a/next.config.js +++ b/next.config.js @@ -1,13 +1,13 @@ const backends = { - local: "http://localhost:4000", - development: "https://dev.backend.tartanhacks.com", - staging: "https://stg.backend.tartanhacks.com", - production: "https://backend.tartanhacks.com" -} + local: 'http://localhost:4000', + development: 'https://dev.backend.tartanhacks.com', + staging: 'https://stg.backend.tartanhacks.com', + production: 'https://backend.tartanhacks.com', +}; module.exports = { - poweredByHeader: false, - reactStrictMode: false, - env: { - BACKEND_URL: backends[process.env.APP_ENV || "development"] - } -} + poweredByHeader: false, + reactStrictMode: false, + env: { + BACKEND_URL: backends[process.env.APP_ENV || 'development'], + }, +}; diff --git a/pages/_app.tsx b/pages/_app.tsx index fc9bd36..6badc4e 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,33 +1,33 @@ -import { StyledEngineProvider, ThemeProvider } from "@mui/material" -import type { AppProps } from "next/app" -import Head from "next/head" -import { ReactElement } from "react" -import { Provider } from "react-redux" -import Script from "next/script" -import store from "src/store" -import { theme } from "src/themes/theme" -import "styles/globals.scss" +import { StyledEngineProvider, ThemeProvider } from '@mui/material'; +import type { AppProps } from 'next/app'; +import Head from 'next/head'; +import { ReactElement } from 'react'; +import { Provider } from 'react-redux'; +import Script from 'next/script'; +import store from 'src/store'; +import { theme } from 'src/themes/theme'; +import 'styles/globals.scss'; const App = ({ Component, pageProps }: AppProps): ReactElement => { - return ( - <> - - TartanHacks - {/* Disable cache control */} - - - - - - - + - - - - - - - - - - ) -} + + + + + + + + + + + ); +}; -export default App +export default App; diff --git a/pages/_document.tsx b/pages/_document.tsx index 0ce7485..02b342a 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -1,36 +1,49 @@ -import Document, { Head, Html, Main, NextScript } from "next/document" -import React, { ReactElement } from "react" -import { theme } from "src/themes/theme" -import createEmotionServer from "@emotion/server/create-instance" -import createEmotionCache from "src/util/createEmotionCache" -import Script from "next/script" +import Document, { Head, Html, Main, NextScript } from 'next/document'; +import React, { ReactElement } from 'react'; +import { theme } from 'src/themes/theme'; +import createEmotionServer from '@emotion/server/create-instance'; +import createEmotionCache from 'src/util/createEmotionCache'; +import Script from 'next/script'; class MyDocument extends Document { - render(): ReactElement { - return ( - - - - - - - - - - - - -
- - - - - ) - } + + + + ); + } } // eslint-disable-next-line MyDocument.getInitialProps = async (ctx): Promise => { - // Resolution order - // - // On the server: - // 1. app.getInitialProps - // 2. page.getInitialProps - // 3. document.getInitialProps - // 4. app.render - // 5. page.render - // 6. document.render - // - // On the server with error: - // 1. document.getInitialProps - // 2. app.render - // 3. page.render - // 4. document.render - // - // On the client - // 1. app.getInitialProps - // 2. page.getInitialProps - // 3. app.render - // 4. page.render + // Resolution order + // + // On the server: + // 1. app.getInitialProps + // 2. page.getInitialProps + // 3. document.getInitialProps + // 4. app.render + // 5. page.render + // 6. document.render + // + // On the server with error: + // 1. document.getInitialProps + // 2. app.render + // 3. page.render + // 4. document.render + // + // On the client + // 1. app.getInitialProps + // 2. page.getInitialProps + // 3. app.render + // 4. page.render - const originalRenderPage = ctx.renderPage + const originalRenderPage = ctx.renderPage; - // You can consider sharing the same Emotion cache between all the SSR requests to speed up performance. - // However, be aware that it can have global side effects. - const cache = createEmotionCache() - const { extractCriticalToChunks } = createEmotionServer(cache) + // You can consider sharing the same Emotion cache between all the SSR requests to speed up performance. + // However, be aware that it can have global side effects. + const cache = createEmotionCache(); + const { extractCriticalToChunks } = createEmotionServer(cache); - ctx.renderPage = () => - originalRenderPage({ - enhanceApp: (App: any) => - function EnhanceApp(props) { - return - } - }) + ctx.renderPage = () => + originalRenderPage({ + enhanceApp: (App: any) => + function EnhanceApp(props) { + return ; + }, + }); - const initialProps = await Document.getInitialProps(ctx) - // This is important. It prevents Emotion to render invalid HTML. - // See https://github.com/mui/material-ui/issues/26561#issuecomment-855286153 - const emotionStyles = extractCriticalToChunks(initialProps.html) - const emotionStyleTags = emotionStyles.styles.map((style) => ( -