-
Notifications
You must be signed in to change notification settings - Fork 14
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
Showing
18 changed files
with
513 additions
and
91 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
149 changes: 104 additions & 45 deletions
149
apps/frontend-manage/src/components/sessions/cockpit/CancelSessionModal.tsx
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
104 changes: 104 additions & 0 deletions
104
apps/frontend-manage/src/components/sessions/cockpit/SessionAbortionConfirmations.tsx
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,104 @@ | ||
import DeletionItem from '@components/common/DeletionItem' | ||
import { RunningLiveQuizSummary } from '@klicker-uzh/graphql/dist/ops' | ||
import { UserNotification } from '@uzh-bf/design-system' | ||
import { useTranslations } from 'next-intl' | ||
import { Dispatch, SetStateAction } from 'react' | ||
import { SessionAbortionConfirmationType } from './CancelSessionModal' | ||
|
||
interface SessionAbortionConfirmationsProps { | ||
summary: RunningLiveQuizSummary | ||
confirmations: SessionAbortionConfirmationType | ||
setConfirmations: Dispatch<SetStateAction<SessionAbortionConfirmationType>> | ||
} | ||
|
||
function SessionAbortionConfirmations({ | ||
summary, | ||
confirmations, | ||
setConfirmations, | ||
}: SessionAbortionConfirmationsProps) { | ||
const t = useTranslations() | ||
|
||
return ( | ||
<div className="flex flex-col gap-2"> | ||
<UserNotification | ||
type="warning" | ||
message={t('manage.cockpit.cancelLiveQuizMessage')} | ||
className={{ root: 'mb-1 text-base' }} | ||
/> | ||
<DeletionItem | ||
label={ | ||
summary.numOfResponses === 0 | ||
? t('manage.cockpit.noResponsesToDelete') | ||
: t('manage.cockpit.deleteResponses', { | ||
number: summary.numOfResponses, | ||
}) | ||
} | ||
onClick={() => { | ||
setConfirmations((prev) => ({ | ||
...prev, | ||
deleteResponses: true, | ||
})) | ||
}} | ||
confirmed={confirmations.deleteResponses} | ||
notApplicable={summary.numOfResponses === 0} | ||
data={{ cy: 'lq-deletion-responses-confirm' }} | ||
/> | ||
<DeletionItem | ||
label={ | ||
summary.numOfFeedbacks === 0 | ||
? t('manage.cockpit.noFeedbacksToDelete') | ||
: t('manage.cockpit.deleteFeedbacks', { | ||
number: summary.numOfFeedbacks, | ||
}) | ||
} | ||
onClick={() => { | ||
setConfirmations((prev) => ({ | ||
...prev, | ||
deleteFeedbacks: true, | ||
})) | ||
}} | ||
confirmed={confirmations.deleteFeedbacks} | ||
notApplicable={summary.numOfFeedbacks === 0} | ||
data={{ cy: 'lq-deletion-feedbacks-confirm' }} | ||
/> | ||
<DeletionItem | ||
label={ | ||
summary.numOfConfusionFeedbacks === 0 | ||
? t('manage.cockpit.noConfusionFeedbacksToDelete') | ||
: t('manage.cockpit.deleteConfusionFeedbacks', { | ||
number: summary.numOfConfusionFeedbacks, | ||
}) | ||
} | ||
onClick={() => { | ||
setConfirmations((prev) => ({ | ||
...prev, | ||
deleteConfusionFeedbacks: true, | ||
})) | ||
}} | ||
confirmed={confirmations.deleteConfusionFeedbacks} | ||
notApplicable={summary.numOfConfusionFeedbacks === 0} | ||
data={{ cy: 'lq-deletion-confusion-feedbacks-confirm' }} | ||
/> | ||
<DeletionItem | ||
label={ | ||
summary.numOfLeaderboardEntries === 0 | ||
? t('manage.cockpit.noLeaderboardEntriesToDelete') | ||
: t('manage.cockpit.deleteLeaderboardEntries', { | ||
number: summary.numOfLeaderboardEntries, | ||
}) | ||
} | ||
onClick={() => { | ||
setConfirmations((prev) => ({ | ||
...prev, | ||
deleteLeaderboardEntries: true, | ||
})) | ||
}} | ||
confirmed={confirmations.deleteLeaderboardEntries} | ||
notApplicable={summary.numOfLeaderboardEntries === 0} | ||
data={{ cy: 'lq-deletion-leaderboard-entries-confirm' }} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
export default SessionAbortionConfirmations |
Oops, something went wrong.