From 1cb2d567539b9d1e46176b0396d64202f8f63b99 Mon Sep 17 00:00:00 2001 From: Sarah Rietkerk Date: Thu, 5 Sep 2024 16:56:23 -0700 Subject: [PATCH 01/12] soft deleting criteria entries to readd them if a user undoes the deletion --- .../src/components/CriteriaResultEntry.tsx | 20 +++++++++++-- .../src/components/EvalResultDisplay.tsx | 1 + teachertool/src/components/Toasts.tsx | 2 +- .../src/components/styling/Toasts.module.scss | 4 +++ teachertool/src/constants.ts | 2 ++ .../transforms/readdCriteriaToChecklist.ts | 30 +++++++++++++++++++ .../transforms/removeCriteriaFromChecklist.ts | 6 +++- teachertool/src/types/criteria.ts | 1 + teachertool/src/utils/index.ts | 3 +- 9 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 teachertool/src/transforms/readdCriteriaToChecklist.ts diff --git a/teachertool/src/components/CriteriaResultEntry.tsx b/teachertool/src/components/CriteriaResultEntry.tsx index 8aef5ccb998a..fc47f126f312 100644 --- a/teachertool/src/components/CriteriaResultEntry.tsx +++ b/teachertool/src/components/CriteriaResultEntry.tsx @@ -18,6 +18,7 @@ import { Button } from "react-common/components/controls/Button"; import { setEvalResult } from "../transforms/setEvalResult"; import { showToast } from "../transforms/showToast"; import { makeToast } from "../utils"; +import { readdCriteriaToChecklist } from "../transforms/readdCriteriaToChecklist"; interface CriteriaResultNotesProps { criteriaId: string; @@ -76,6 +77,20 @@ const CriteriaResultError: React.FC = ({ criteriaInsta ); }; +export const UndoDeleteCriteriaButton: React.FC<{ criteriaId: string }> = ({ criteriaId }) => { + const handleUndoClicked = () => { + readdCriteriaToChecklist(criteriaId); + } + + return ( +