Skip to content

Commit

Permalink
make apply button visible to unauthed users and enforce auth for appl…
Browse files Browse the repository at this point in the history
…ications (#719)
  • Loading branch information
rm03 authored Sep 8, 2024
1 parent b32d3d7 commit a50dbb0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
9 changes: 2 additions & 7 deletions frontend/components/ClubPage/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ import { mediaMaxWidth, mediaMinWidth, SM } from '~/constants'

import { BORDER, MEDIUM_GRAY, WHITE } from '../../constants/colors'
import { CLUB_APPLY_ROUTE, CLUB_EDIT_ROUTE } from '../../constants/routes'
import {
Club,
ClubApplicationRequired,
QuestionAnswer,
UserInfo,
} from '../../types'
import { Club, ClubApplicationRequired, QuestionAnswer } from '../../types'
import { apiCheckPermission, apiSetLikeStatus, doApiRequest } from '../../utils'
import {
FIELD_PARTICIPATION_LABEL,
Expand Down Expand Up @@ -85,7 +80,7 @@ const ActionButton = styled.a`

type ActionsProps = {
club: Club
userInfo: UserInfo
authenticated: boolean
style?: CSSProperties
className?: string
updateRequests: (code: string) => Promise<void>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from 'types'
import { doApiRequest } from 'utils'

import AuthPrompt from '~/components/common/AuthPrompt'
import { SelectField, TextField } from '~/components/FormComponents'

type ApplicationPageProps = {
Expand Down Expand Up @@ -107,11 +108,16 @@ export function formatQuestionType(
}

const ApplicationPage = ({
userInfo,
club,
application,
questions,
initialValues,
}: ApplicationPageProps): ReactElement => {
}): ReactElement => {
if (!userInfo) {
return <AuthPrompt />
}

// Second condition will be replaced with perms check or question nullity check once backend is updated
// eslint-disable-next-line no-constant-condition
if (new Date() < new Date(application.application_start_time) && false) {
Expand Down
25 changes: 10 additions & 15 deletions frontend/pages/club/[club]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,11 @@ const ClubPage = ({
pending approval from the {APPROVAL_AUTHORITY}.
</div>
)}

{userInfo != null && (
<MobileActions
club={club}
userInfo={userInfo}
updateRequests={updateRequests}
/>
)}
<MobileActions
club={club}
authenticated={userInfo !== undefined}
updateRequests={updateRequests}
/>
<StyledCard $bordered>
<Description club={club} />
</StyledCard>
Expand Down Expand Up @@ -278,13 +275,11 @@ const ClubPage = ({
)}
</div>
<div className="column is-one-third">
{userInfo && (
<DesktopActions
club={club}
userInfo={userInfo}
updateRequests={updateRequests}
/>
)}
<DesktopActions
club={club}
authenticated={userInfo !== undefined}
updateRequests={updateRequests}
/>
<QAButton onClick={scrollToQuestions}>
{questions.length > 0
? `Click here to see the ${questions.length} question${
Expand Down

0 comments on commit a50dbb0

Please sign in to comment.