Skip to content

Commit 8032d50

Browse files
committed
Added event prop
1 parent 4d24d9d commit 8032d50

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

frontend/src/components/pages/events/EventDetail/SignUp/Actions.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@ import { useMutation } from "@apollo/client";
22
import { Alert, Unstable_Grid2 as Grid, Snackbar, TextField, Tooltip, Typography } from "@mui/material";
33
import { useState } from "react";
44

5-
import { LoginRequired, PermissionRequired } from "@/components/Auth";
6-
import { EventDetailFieldsFragment, EventSignOffDocument, EventSignUpDocument } from "@/generated/graphql";
7-
import dayjs from "@/lib/date";
8-
95
import { CountdownStatusText } from "./Countdown";
106
import { useCountdown } from "./hooks/useCountdown";
117
import { SignUpButton } from "./SignUpButton";
128

9+
import { LoginRequired, PermissionRequired } from "@/components/Auth";
10+
import { EventDetailFieldsFragment, EventSignOffDocument, EventSignUpDocument } from "@/generated/graphql";
11+
import dayjs from "@/lib/date";
12+
1313
type Event = {
1414
id: string;
1515
hasExtraInformation?: boolean | null;
1616
signupOpenDate: string;
1717
deadline: string;
1818
bindingSignup?: boolean | null;
19+
isAttendable: boolean;
1920
} & Pick<EventDetailFieldsFragment, "userAttendance">;
2021

2122
type Props = {
@@ -115,6 +116,7 @@ export const Actions: React.FC<Props> = ({ event }) => {
115116
onSignUp={handleSignUp}
116117
onSignOff={handleSignOff}
117118
isSignedUp={isSignedUp}
119+
event={event}
118120
/>
119121
</span>
120122
</Tooltip>

frontend/src/components/pages/events/EventDetail/SignUp/SignUpButton.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@ import { LoadingButton } from "@mui/lab";
22
import { Button, Dialog, DialogActions, DialogContent, Typography } from "@mui/material";
33
import { useState } from "react";
44

5+
type Event = {
6+
signupOpenDate: string;
7+
isFull?: boolean | null;
8+
allowedGradeYears?: Array<number> | null;
9+
isAttendable: boolean;
10+
};
11+
512
type Props = {
613
isSignedUp?: boolean | null;
714
disabled?: boolean;
815
onSignUp: () => void;
916
onSignOff: () => void;
17+
event: Event;
1018
};
1119

12-
export const SignUpButton: React.FC<Props> = ({ isSignedUp, onSignUp, onSignOff, disabled }) => {
20+
export const SignUpButton: React.FC<Props> = ({ isSignedUp, onSignUp, onSignOff, disabled, event }) => {
1321
const [confirmSignOff, setConfirmSignOff] = useState(false);
1422
const [loading, setLoading] = useState(false);
1523

@@ -25,7 +33,6 @@ export const SignUpButton: React.FC<Props> = ({ isSignedUp, onSignUp, onSignOff,
2533
setTimeout(() => setLoading(false), 1000);
2634
onSignOff();
2735
}
28-
2936
return (
3037
<>
3138
<Dialog open={confirmSignOff}>

frontend/src/pages/events/[id]/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const EventInfo: NextPageWithLayout<InferGetServerSidePropsType<typeof getServer
2121
<meta name="description" content={event.shortDescription ?? event.description} />
2222
{event.organization.logoUrl && <meta name="og:image" content={event.organization.logoUrl} />}
2323
</Head>
24+
2425
<EventDetail event={data?.event ?? event} />
2526
</>
2627
);

0 commit comments

Comments
 (0)