-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b5584e
commit 53010c7
Showing
4 changed files
with
127 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import * as forms from "codeforlife/components/form" | ||
import { type FC } from "react" | ||
import { LinkButton } from "codeforlife/components/router" | ||
import { Stack } from "@mui/material" | ||
import { type User } from "codeforlife/api" | ||
import { useNavigate } from "codeforlife/hooks" | ||
|
||
import { classIdSchema } from "../../app/schemas.ts" | ||
import { paths } from "../../routes" | ||
import { useUpdateUserMutation } from "../../api/user" | ||
|
||
export interface RequestToJoinClassFormProps { | ||
indyUser: Pick<User, "id" | "requesting_to_join_class"> | ||
} | ||
|
||
const RequestToJoinClassForm: FC<RequestToJoinClassFormProps> = ({ | ||
indyUser, | ||
}) => { | ||
const navigate = useNavigate() | ||
|
||
return ( | ||
<forms.Form | ||
initialValues={indyUser} | ||
useMutation={useUpdateUserMutation} | ||
submitOptions={{ | ||
then: () => { | ||
navigate(".", { | ||
state: { | ||
notifications: [ | ||
{ | ||
index: 1, | ||
props: { | ||
children: | ||
"Your request to join a school has been received successfully.", | ||
}, | ||
}, | ||
], | ||
}, | ||
}) | ||
}, | ||
}} | ||
> | ||
<forms.TextField | ||
placeholder="Class access code" | ||
label="Class access code" | ||
name="requesting_to_join_class" | ||
sx={{ width: { xs: "100%", sm: "50%" } }} | ||
schema={classIdSchema} | ||
required | ||
/> | ||
<Stack direction="row" spacing={2} paddingY={3}> | ||
<LinkButton variant="outlined" to={paths.indy.dashboard._}> | ||
Cancel | ||
</LinkButton> | ||
<forms.SubmitButton>Request</forms.SubmitButton> | ||
</Stack> | ||
</forms.Form> | ||
) | ||
} | ||
|
||
export default RequestToJoinClassForm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
src/pages/studentJoinClass/UpdateRequestingToJoinClassForm.tsx
This file was deleted.
Oops, something went wrong.