From a0bc3200ed70dc711f6f2db58d65c2ff9d34f31b Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Tue, 13 Dec 2022 14:32:16 +0400 Subject: [PATCH] Add functionality to mark as done on right click --- components/roadmap/content-drawer.tsx | 13 +++++++++---- pages/[roadmap]/interactive.tsx | 23 +++++++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/components/roadmap/content-drawer.tsx b/components/roadmap/content-drawer.tsx index f8483c19e..77ddeb74d 100644 --- a/components/roadmap/content-drawer.tsx +++ b/components/roadmap/content-drawer.tsx @@ -11,6 +11,14 @@ type ContentDrawerProps = { onClose?: () => void; }; +export function markTopicDone(groupId: string) { + localStorage.setItem(groupId, 'done'); + + queryGroupElementsById(groupId).forEach((item) => + item?.classList?.add('done') + ); +} + export function ContentDrawer(props: ContentDrawerProps) { const { roadmap, groupId, onClose = () => null } = props; if (!groupId) { @@ -52,10 +60,7 @@ export function ContentDrawer(props: ContentDrawerProps) { {!isDone && (