diff --git a/frontend/components/Applications.tsx b/frontend/components/Applications.tsx index b8d2a79f0..09f20a5c1 100644 --- a/frontend/components/Applications.tsx +++ b/frontend/components/Applications.tsx @@ -94,50 +94,55 @@ const AppsContainer = styled.div` min-height: 60vh; ` -function ApplicationsPage({ whartonapplications }): ReactElement { - if ('detail' in whartonapplications) { - return {whartonapplications.detail} +function ApplicationsPage({ whartonApplications }): ReactElement { + if ('detail' in whartonApplications) { + return {whartonApplications.detail} } return (
- {whartonapplications != null && whartonapplications.length > 0 ? ( - whartonapplications.map((application) => ( - - - - -
- {application.name} - -
-
- {application.club_image_url != null && - application.club_image_url !== '' && ( - - - - )} -
-
- {application.description && - application.description.length && ( - - )} -
- -
- )) + {whartonApplications != null && whartonApplications.length > 0 ? ( +
+ + Note: only current Wharton applications are displayed on this page{' '} + + {whartonApplications.map((application) => ( + + + + +
+ {application.name} + +
+
+ {application.club_image_url != null && + application.club_image_url !== '' && ( + + + + )} +
+
+ {application.description && + application.description.length && ( + + )} +
+ +
+ ))} +
) : ( - No applications are currently available. + No Wharton applications are currently available. )}
@@ -153,8 +158,9 @@ ApplicationsPage.getInitialProps = async (ctx: NextPageContext) => { ['whartonapplications'], ctx, )) as BulkResp + return { - ...data, + whartonApplications: data.whartonapplications, fair: ctx.query.fair != null ? parseInt(ctx.query.fair as string) : null, } } diff --git a/frontend/pages/apply/[[...slug]].tsx b/frontend/pages/apply/[[...slug]].tsx index 85b3f4aa7..1d08e1627 100644 --- a/frontend/pages/apply/[[...slug]].tsx +++ b/frontend/pages/apply/[[...slug]].tsx @@ -9,7 +9,7 @@ import ApplicationsPage from '~/components/Applications' import SubmissionsPage from '~/components/Submissions' import { BrowserTabView } from '~/components/TabView' import { APPLY_ROUTE, BG_GRADIENT, WHITE } from '~/constants' -import { ApplicationSubmission } from '~/types' +import { Application, ApplicationSubmission } from '~/types' function ApplyDashboard({ whartonapplications, @@ -24,7 +24,7 @@ function ApplyDashboard({ name: 'applications', label: 'Applications', content: () => ( - + ), }, { @@ -56,7 +56,7 @@ function ApplyDashboard({ } type BulkResp = { - whartonapplications: any + whartonapplications: Application[] submissions: Array } diff --git a/frontend/pages/settings.tsx b/frontend/pages/settings.tsx index 58c32304c..e0bcd7cdb 100644 --- a/frontend/pages/settings.tsx +++ b/frontend/pages/settings.tsx @@ -5,16 +5,20 @@ import FavoritesTab from 'components/Settings/FavoritesTab' import MembershipRequestsTab from 'components/Settings/MembershipRequestsTab' import ProfileTab from 'components/Settings/ProfileTab' import HashTabView from 'components/TabView' +import { NextPageContext } from 'next' import React, { ReactNode } from 'react' import { toast, TypeOptions } from 'react-toastify' import renderPage from 'renderPage' import styled from 'styled-components' -import { UserInfo } from 'types' +import { Application, ApplicationSubmission, UserInfo } from 'types' import { OBJECT_NAME_TITLE, SHOW_MEMBERSHIP_REQUEST } from 'utils/branding' +import ApplicationsPage from '~/components/Applications' import TicketsTab from '~/components/Settings/TicketsTab' +import SubmissionsPage from '~/components/Submissions' import { BG_GRADIENT, CLUBS_BLUE, WHITE } from '~/constants/colors' import { BORDER_RADIUS } from '~/constants/measurements' +import { doBulkLookup } from '~/utils' const Notification = styled.span` border-radius: ${BORDER_RADIUS}; @@ -31,11 +35,18 @@ const Notification = styled.span` ` type SettingsProps = { - userInfo: UserInfo + userInfo?: UserInfo authenticated: boolean | null + submissions: ApplicationSubmission[] + whartonApplications: any } -const Settings = ({ userInfo, authenticated }: SettingsProps) => { +const Settings = ({ + userInfo, + authenticated, + whartonApplications, + submissions, +}: SettingsProps) => { /** * Display the message to the user in the form of a toast. * @param The message to show to the user. @@ -68,6 +79,16 @@ const Settings = ({ userInfo, authenticated }: SettingsProps) => { icon: 'bookmark', content: , }, + { + name: 'submissions', + label: 'Submissions', + content: , + }, + { + name: 'applications', + label: 'Applications', + content: , + }, { name: 'Requests', icon: 'user-check', @@ -103,4 +124,22 @@ const Settings = ({ userInfo, authenticated }: SettingsProps) => { ) } +type BulkResp = { + whartonapplications: Application[] + submissions: Array +} + +Settings.getInitialProps = async (ctx: NextPageContext) => { + const data: BulkResp = (await doBulkLookup( + ['whartonapplications', 'submissions'], + ctx, + )) as BulkResp + + return { + whartonApplications: data.whartonapplications, + submissions: data.submissions, + fair: ctx.query.fair != null ? parseInt(ctx.query.fair as string) : null, + } +} + export default renderPage(Settings)