Skip to content
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

Display apply button to unauthenticated users #719

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading