diff --git a/apps/hackathon/src/app/teams/[teamId]/page.tsx b/apps/hackathon/src/app/teams/[teamId]/page.tsx index dec3e46..572f495 100644 --- a/apps/hackathon/src/app/teams/[teamId]/page.tsx +++ b/apps/hackathon/src/app/teams/[teamId]/page.tsx @@ -8,6 +8,7 @@ import { useTeamJoinRequests, useRespondToJoinRequest, useLeaveTeam, + useDeleteTeam, ETeamMemberRole, useAuthStore, } from '@imphnen-frontend-service/service'; @@ -54,6 +55,8 @@ const TeamDashboardPage: FC = (): ReactElement => { const [showInviteModal, setShowInviteModal] = useState(false); const [showJoinRequestsModal, setShowJoinRequestsModal] = useState(false); const [showLeaveModal, setShowLeaveModal] = useState(false); + const [showDeleteModal, setShowDeleteModal] = useState(false); + const [deleteConfirmText, setDeleteConfirmText] = useState(''); const [inviteEmail, setInviteEmail] = useState(''); const [imagesLoaded, setImagesLoaded] = useState(false); const [imageLoadCount, setImageLoadCount] = useState(0); @@ -104,6 +107,7 @@ const TeamDashboardPage: FC = (): ReactElement => { const { mutateAsync: respondToJoinRequest, isPending: isResponding } = useRespondToJoinRequest(teamId || ''); const { mutateAsync: leaveTeam, isPending: isLeaving } = useLeaveTeam(); + const { mutateAsync: deleteTeam, isPending: isDeleting } = useDeleteTeam(); const joinRequests = joinRequestsData?.data || []; const pendingJoinRequests = joinRequests.filter( @@ -157,6 +161,19 @@ const TeamDashboardPage: FC = (): ReactElement => { } }; + const handleDeleteTeam = async () => { + if (!teamId) return; + + try { + await deleteTeam(teamId); + toast.success('Team deleted successfully'); + navigate('/dashboard'); + } catch (error: any) { + console.error('Failed to delete team:', error); + toast.error(error?.message || 'Failed to delete team'); + } + }; + if (isLoadingTeam || isLoadingMembers) { return (
+ This action is permanent and cannot be undone. +
++ Warning: All team data, chat messages, and submissions will be permanently deleted. +
+