Skip to content

Commit

Permalink
Move submissions from /apply to user profile (#638)
Browse files Browse the repository at this point in the history
* finished changes

* Remove Wharton applications from user profile (and update branch) (#641)

* Update main.ts

* Update frontend dependencies (#616)

Upgrade from Node 14 to Node 20 and bump frontend dependency versions to current.

---------

Co-authored-by: Julian Weng <julian.weng.us@gmail.com>

* Update README.md

* Update README backend instructions and intro blurb

* Fix admin page access on frontend. (#626)

Add frontend check for existing pre-loaded permissions on /admin.

* Removed deprecated QuestionResponse model and duplicate line (#625)

* Remove deprecated QuestionResponse model

* remove duplicate line: 'rank field in Club'

* made migrations after deleting QuestionResponse

* Streamline django storages config (#618)

* Add staticfiles

* Fix AWS bucket routing for boto

* Try setting credentials through env vars

* Try renaming env vars?

* Set AWS region

* add back staticfiles

* Remove region and signature version

* Move credentials to new API

* Use env variables and remove staticfiles

* Add back staticfiles

* Make code look pretty

---------

Co-authored-by: Rohan Moniz <60864468+rm03@users.noreply.github.com>

* Add hour to displayed application deadline (#628)

* Add hour for application due dates

* Make linter happy

* Specify Eastern time zone

* Display username if name is empty (#637)

* finished changes

* Remove Wharton applications from user profile

* Fix weird artifacts from merge

---------

Co-authored-by: Joy Liu <34288846+joyliu-q@users.noreply.github.com>
Co-authored-by: Julian Weng <julian.weng.us@gmail.com>
Co-authored-by: Rohan Moniz <60864468+rm03@users.noreply.github.com>
Co-authored-by: Thomas Ngulube <47449914+Porcupine1@users.noreply.github.com>
Co-authored-by: Owen Lester <owlester@sas.upenn.edu>

* Bump debounce timeout to 400ms (#640)

* Bump debounce timeout to 400ms

* Make linter happy

* small changes

* added type

* merging

* deleted file

---------

Co-authored-by: Avi Upadhyayula <69180850+aviupadhyayula@users.noreply.github.com>
Co-authored-by: Joy Liu <34288846+joyliu-q@users.noreply.github.com>
Co-authored-by: Julian Weng <julian.weng.us@gmail.com>
Co-authored-by: Rohan Moniz <60864468+rm03@users.noreply.github.com>
Co-authored-by: Thomas Ngulube <47449914+Porcupine1@users.noreply.github.com>
  • Loading branch information
6 people authored Apr 21, 2024
1 parent dcd7b46 commit 29d9a12
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"react-toastify": "^10.0.4",
"react-tooltip": "^5.26.3",
"react-vis": "^1.12.1",
"ruff": "^1.5.4",
"showdown": "^2.1.0",
"styled-components": "^6.1.8",
"use-places-autocomplete": "^4.0.1",
Expand Down
30 changes: 27 additions & 3 deletions frontend/pages/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ 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 { ApplicationSubmission, UserInfo } from 'types'
import { OBJECT_NAME_TITLE, SHOW_MEMBERSHIP_REQUEST } from 'utils/branding'

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};
Expand All @@ -30,11 +33,12 @@ const Notification = styled.span`
`

type SettingsProps = {
userInfo: UserInfo
userInfo?: UserInfo
authenticated: boolean | null
submissions: ApplicationSubmission[]
}

const Settings = ({ userInfo, authenticated }: SettingsProps) => {
const Settings = ({ userInfo, authenticated, submissions }: SettingsProps) => {
/**
* Display the message to the user in the form of a toast.
* @param The message to show to the user.
Expand Down Expand Up @@ -67,6 +71,11 @@ const Settings = ({ userInfo, authenticated }: SettingsProps) => {
icon: 'bookmark',
content: <FavoritesTab key="subscription" keyword="subscription" />,
},
{
name: 'submissions',
label: 'Submissions',
content: () => <SubmissionsPage initialSubmissions={submissions} />,
},
{
name: 'Requests',
icon: 'user-check',
Expand Down Expand Up @@ -97,4 +106,19 @@ const Settings = ({ userInfo, authenticated }: SettingsProps) => {
)
}

type BulkResp = {
submissions: Array<ApplicationSubmission>
}

Settings.getInitialProps = async (ctx: NextPageContext) => {
const data: BulkResp = (await doBulkLookup(
['submissions', '/submissions/?format=json'],
ctx,
)) as BulkResp
return {
...data,
fair: ctx.query.fair != null ? parseInt(ctx.query.fair as string) : null,
}
}

export default renderPage(Settings)
12 changes: 12 additions & 0 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5547,6 +5547,11 @@ electron-to-chromium@^1.4.668:
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.676.tgz#95179dd62f43926c636ca06c555a1da8754073ff"
integrity sha512-uHt4FB8SeYdhcOsj2ix/C39S7sPSNFJpzShjxGOm1KdF4MHyGqGi389+T5cErsodsijojXilYaHIKKqJfqh7uQ==

emitify@^3.0.1:
version "3.1.0"
resolved "https://registry.yarnpkg.com/emitify/-/emitify-3.1.0.tgz#fa5a08011b0f1f64e440aa2e7c2713c55f8a5568"
integrity sha512-pucUCyaeC8TJoRXniRiNb81Odoqlf2lMaFARA8tci2PaORFIeXBoIQHEzuA3dxPsU1l7AVb7xmFra4iJwVU8wg==

"emoji-regex@>=6.0.0 <=6.1.1":
version "6.1.1"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.1.1.tgz#c6cd0ec1b0642e2a3c67a1137efc5e796da4f88e"
Expand Down Expand Up @@ -9376,6 +9381,13 @@ rimraf@^3.0.0, rimraf@^3.0.2:
dependencies:
glob "^7.1.3"

ruff@^1.5.4:
version "1.5.4"
resolved "https://registry.yarnpkg.com/ruff/-/ruff-1.5.4.tgz#c19346bffbd263f67a301b51ba92601254091797"
integrity sha512-42kBjp78DFDAgZw8ywPpB3bo0oZrSifukCRMB49dnFeGPbg1s4jdtXZug06mkxue1JrD3dP/ng2mxPYg7gx3Jw==
dependencies:
emitify "^3.0.1"

run-parallel@^1.1.9:
version "1.2.0"
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee"
Expand Down

0 comments on commit 29d9a12

Please sign in to comment.