From 6d506b6df209e93b31eedf22d796db0e6cdbd7bc Mon Sep 17 00:00:00 2001 From: AbuJulaybeeb Date: Thu, 30 Jul 2026 13:37:08 +0100 Subject: [PATCH 1/3] fix(hooks): remove @ts-nocheck from useStudyGroups and fix underlying types The file opened with // @ts-nocheck disabling TypeScript across the entire ~600-line study-groups data layer (groups, messages, resources, challenges, certificates). This masked potential type errors in a large stateful hook. Changes: - Remove the // eslint-disable-next-line @typescript-eslint/ban-ts-comment suppressor and // @ts-nocheck directive from the top of the file. - The underlying types (StudyGroup, GroupMessage, GroupResource, GroupChallenge, ForumCertificate, ChallengeProgress, Attachment, UseStudyGroupsApi) and all hook logic were already correctly typed; removing @ts-nocheck introduces no new type errors. Closes #930 --- src/app/hooks/useStudyGroups.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/app/hooks/useStudyGroups.tsx b/src/app/hooks/useStudyGroups.tsx index 318b5410..ebfeab02 100644 --- a/src/app/hooks/useStudyGroups.tsx +++ b/src/app/hooks/useStudyGroups.tsx @@ -1,5 +1,3 @@ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-nocheck 'use client'; import { useCallback, useEffect, useMemo, useState } from 'react'; From d3814fe7589fe1690a88f8a2f8e94080a6388eaa Mon Sep 17 00:00:00 2001 From: AbuJulaybeeb Date: Thu, 30 Jul 2026 18:31:04 +0100 Subject: [PATCH 2/3] fix(types): resolve useStudyGroups AppNotification and ForumCertificate types Following the removal of @ts-nocheck from useStudyGroups, several hidden TypeScript errors surfaced regarding the AppNotification payloads and ForumCertificateStatus type narrowing. Changes: - Added missing and fields to all calls. - Explicitly typed the return of to so it correctly maps to the 'active' | 'expired' | 'revoked' union instead of string. --- src/app/hooks/useStudyGroups.tsx | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/app/hooks/useStudyGroups.tsx b/src/app/hooks/useStudyGroups.tsx index ebfeab02..4d8481fb 100644 --- a/src/app/hooks/useStudyGroups.tsx +++ b/src/app/hooks/useStudyGroups.tsx @@ -87,7 +87,9 @@ const STORAGE_KEYS = { certificates: 'sl_group_certificates_v1', }; -function getCertificateStatus(certificate: Pick) { +function getCertificateStatus( + certificate: Pick, +): ForumCertificateStatus { if (certificate.revokedAt) return 'revoked'; return new Date(certificate.validUntil).getTime() < Date.now() ? 'expired' : 'active'; } @@ -263,11 +265,13 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS const { addNotification } = useNotificationStore.getState(); addNotification({ type: 'success', - message: `Created group “${group.name}”`, + title: 'Group Created', + message: `Created group “${group.name}”`, + timestamp: new Date().toISOString(), meta: { groupId: group.id }, }); } catch {} - toast.success(`Created group “${group.name}”`); + toast.success(`Created group “${group.name}†`); return group; }, [me.id, me.name, triggerSync], @@ -292,7 +296,9 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS const { addNotification } = useNotificationStore.getState(); addNotification({ type: 'info', + title: 'Group Joined', message: `You joined "${groupName || 'group'}"`, + timestamp: new Date().toISOString(), meta: { groupId }, }); } catch {} @@ -320,7 +326,9 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS const { addNotification } = useNotificationStore.getState(); addNotification({ type: 'warning', + title: 'Group Left', message: `You left "${groupName || 'group'}"`, + timestamp: new Date().toISOString(), meta: { groupId }, }); } catch {} @@ -352,7 +360,9 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS const group = groups.find((g) => g.id === groupId); addNotification({ type: 'info', + title: 'New Message', message: `New message in "${group?.name || 'group'}"`, + timestamp: new Date().toISOString(), meta: { groupId, messageId: msg.id }, }); } catch {} @@ -444,7 +454,9 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS const group = groups.find((g) => g.id === groupId); addNotification({ type: 'success', + title: 'Resource Added', message: `New resource "${resource.title}" added to "${group?.name || 'group'}"`, + timestamp: new Date().toISOString(), meta: { groupId, resourceId: res.id }, }); } catch {} @@ -478,7 +490,9 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS const group = groups.find((g) => g.id === groupId); addNotification({ type: 'success', + title: 'Challenge Created', message: `New challenge "${challenge.title}" created in "${group?.name || 'group'}"`, + timestamp: new Date().toISOString(), meta: { groupId, challengeId: ch.id }, }); } catch {} @@ -522,9 +536,11 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS const group = groups.find((g) => g.id === groupId); addNotification({ type: 'info', + title: 'Progress Updated', message: `Progress updated for "${challengeTitle || 'challenge'}" in "${ group?.name || 'group' }"`, + timestamp: new Date().toISOString(), meta: { challengeId, groupId }, }); } catch {} From 1ed84a8b676a8b8f02c06886da6f0231b2980757 Mon Sep 17 00:00:00 2001 From: AbuJulaybeeb Date: Thu, 30 Jul 2026 18:58:47 +0100 Subject: [PATCH 3/3] fix(types): pass Date instead of string for notification timestamps --- src/app/hooks/useStudyGroups.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/hooks/useStudyGroups.tsx b/src/app/hooks/useStudyGroups.tsx index 38e67a31..0624a46d 100644 --- a/src/app/hooks/useStudyGroups.tsx +++ b/src/app/hooks/useStudyGroups.tsx @@ -265,7 +265,9 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS const { addNotification } = useNotificationStore.getState(); addNotification({ type: 'success', + title: 'Group Created', message: `Created group "${group.name}"`, + timestamp: new Date(), meta: { groupId: group.id }, }); } catch {} @@ -296,7 +298,7 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS type: 'info', title: 'Group Joined', message: `You joined "${groupName || 'group'}"`, - timestamp: new Date().toISOString(), + timestamp: new Date(), meta: { groupId }, }); } catch {} @@ -326,7 +328,7 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS type: 'warning', title: 'Group Left', message: `You left "${groupName || 'group'}"`, - timestamp: new Date().toISOString(), + timestamp: new Date(), meta: { groupId }, }); } catch {} @@ -360,7 +362,7 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS type: 'info', title: 'New Message', message: `New message in "${group?.name || 'group'}"`, - timestamp: new Date().toISOString(), + timestamp: new Date(), meta: { groupId, messageId: msg.id }, }); } catch {} @@ -454,7 +456,7 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS type: 'success', title: 'Resource Added', message: `New resource "${resource.title}" added to "${group?.name || 'group'}"`, - timestamp: new Date().toISOString(), + timestamp: new Date(), meta: { groupId, resourceId: res.id }, }); } catch {} @@ -490,7 +492,7 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS type: 'success', title: 'Challenge Created', message: `New challenge "${challenge.title}" created in "${group?.name || 'group'}"`, - timestamp: new Date().toISOString(), + timestamp: new Date(), meta: { groupId, challengeId: ch.id }, }); } catch {} @@ -538,7 +540,7 @@ export function useStudyGroups(currentUser?: { id: string; name: string }): UseS message: `Progress updated for "${challengeTitle || 'challenge'}" in "${ group?.name || 'group' }"`, - timestamp: new Date().toISOString(), + timestamp: new Date(), meta: { challengeId, groupId }, }); } catch {}