Skip to content

Commit

Permalink
Feedback 2
Browse files Browse the repository at this point in the history
  • Loading branch information
faucomte97 committed Nov 25, 2024
1 parent 53010c7 commit 7139b52
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 56 deletions.
108 changes: 53 additions & 55 deletions src/pages/studentJoinClass/RequestPending.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,63 +19,61 @@ const RequestPending: FC<RequestPendingProps> = ({ user }) => {

return handleResultState(

Check warning on line 20 in src/pages/studentJoinClass/RequestPending.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/studentJoinClass/RequestPending.tsx#L20

Added line #L20 was not covered by tests
useRetrieveSchoolQuery(user.requesting_to_join_class!.school),
school => {
return (
<>
<Typography variant="h5">Request pending</Typography>
<Typography>
Your request to join class {user.requesting_to_join_class!.id} in
the school or club {school.name} is still pending.
</Typography>
<Typography>
The teacher for that class must review and approve the request to
complete the process.
</Typography>
<Typography>
If successful, the teacher will then contact you with your new login
details.
</Typography>
<Typography>
<strong>Warning:</strong> once the teacher accepts you to their
class, that teacher and the school or club will manage your account.
</Typography>
<Typography>
You may cancel your request now, before the teacher makes their
decision.
</Typography>
<Stack direction="row" spacing={2}>
<LinkButton variant="outlined" to={paths.indy.dashboard._}>
Back
</LinkButton>
<Button
onClick={() => {
void updateUser({
id: user.id,
requesting_to_join_class: null,
})
.unwrap()
.then(() => {
navigate(".", {
state: {
notifications: [
{
props: {
children:
"Your request to join a school has been revoked successfully.",
},
school => (
<>

Check warning on line 23 in src/pages/studentJoinClass/RequestPending.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/studentJoinClass/RequestPending.tsx#L22-L23

Added lines #L22 - L23 were not covered by tests
<Typography variant="h5">Request pending</Typography>
<Typography>
Your request to join class {user.requesting_to_join_class!.id} in the
school or club {school.name} is still pending.
</Typography>
<Typography>
The teacher for that class must review and approve the request to
complete the process.
</Typography>
<Typography>
If successful, the teacher will then contact you with your new login
details.
</Typography>
<Typography>
<strong>Warning:</strong> once the teacher accepts you to their class,
that teacher and the school or club will manage your account.
</Typography>
<Typography>
You may cancel your request now, before the teacher makes their
decision.
</Typography>
<Stack direction="row" spacing={2}>
<LinkButton variant="outlined" to={paths.indy.dashboard._}>
Back
</LinkButton>
<Button
onClick={() => {
void updateUser({

Check warning on line 51 in src/pages/studentJoinClass/RequestPending.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/studentJoinClass/RequestPending.tsx#L50-L51

Added lines #L50 - L51 were not covered by tests
id: user.id,
requesting_to_join_class: null,
})
.unwrap()
.then(() => {
navigate(".", {

Check warning on line 57 in src/pages/studentJoinClass/RequestPending.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/studentJoinClass/RequestPending.tsx#L56-L57

Added lines #L56 - L57 were not covered by tests
state: {
notifications: [
{
props: {
children:
"Your request to join a school has been revoked successfully.",
},
],
},
})
},
],
},
})
}}
>
Cancel request
</Button>
</Stack>
</>
)
},
})
}}
>
Cancel request
</Button>
</Stack>
</>
),
)
}

Expand Down
7 changes: 6 additions & 1 deletion src/pages/studentJoinClass/StudentJoinClass.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ const _StudentJoinClass: FC<SessionMetadata> = ({ user_id }) => {
If successful, the teacher will contact you with your new login
details.
</Typography>
<RequestToJoinClassForm indyUser={user} />
<RequestToJoinClassForm
indyUser={{
id: user.id,
requesting_to_join_class: user.requesting_to_join_class!.id,
}}
/>
</>
)}
</page.Section>
Expand Down

0 comments on commit 7139b52

Please sign in to comment.