diff --git a/src/app/hooks/useStudyGroups.tsx b/src/app/hooks/useStudyGroups.tsx index 73ea2dbf..0624a46d 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'; @@ -89,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'; } @@ -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 {} @@ -294,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(), meta: { groupId }, }); } catch {} @@ -322,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(), meta: { groupId }, }); } catch {} @@ -354,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(), meta: { groupId, messageId: msg.id }, }); } catch {} @@ -446,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(), meta: { groupId, resourceId: res.id }, }); } catch {} @@ -480,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(), meta: { groupId, challengeId: ch.id }, }); } catch {} @@ -524,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(), meta: { challengeId, groupId }, }); } catch {}