-
Notifications
You must be signed in to change notification settings - Fork 6
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
Move submissions from /apply to user profile #638
Changes from all commits
bbb55b5
f0ad4cb
b11ee47
8525b8c
5863870
626cf15
9365a35
00110d9
5efd906
4affb1f
2f0c577
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would appreciate if you can still use the existing SettingsProps type, e.g. edit it to include submissions and type the props for the Settings page again. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm getting a lot of mismatch type errors when I do that– I believe because of getInitialProps. We can resolve during the meeting Friday |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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}; | ||
|
@@ -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. | ||
|
@@ -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', | ||
|
@@ -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'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @rm03 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the |
||
ctx, | ||
)) as BulkResp | ||
return { | ||
...data, | ||
fair: ctx.query.fair != null ? parseInt(ctx.query.fair as string) : null, | ||
} | ||
} | ||
|
||
export default renderPage(Settings) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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== | ||
|
||
Comment on lines
+5550
to
+5554
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason this is added? Looks like it's just a cc @julianweng |
||
"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" | ||
|
@@ -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" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@owlester12 we're using
ruff
as a Python linter (i.e. for the backend), and it should not be needed inpackage.json
. Can you remove this please?cc @rm03