diff --git a/app/(landing)/hackathons/[slug]/teams/[teamId]/page.tsx b/app/(landing)/hackathons/[slug]/teams/[teamId]/page.tsx
index d5ee5b4f..3c48a0b0 100644
--- a/app/(landing)/hackathons/[slug]/teams/[teamId]/page.tsx
+++ b/app/(landing)/hackathons/[slug]/teams/[teamId]/page.tsx
@@ -5,6 +5,7 @@ import Link from 'next/link';
import { useHackathon, useTeam } from '@/hooks/hackathon/use-hackathon-queries';
import { Button } from '@/components/ui/button';
import BasicAvatar from '@/components/avatars/BasicAvatar';
+import { readTeamContact } from '@/lib/api/hackathons/teams';
import {
ArrowLeft,
Calendar,
@@ -227,22 +228,24 @@ export default function TeamDetailsPage({
)}
- {team.contactInfo && (
-
-
- Contact
-
-
-
- {team.contactInfo}
-
- {team.contactMethod && (
+ {(() => {
+ const contact = readTeamContact(team.contactInfo);
+ if (!contact) return null;
+ return (
+
+
+ Contact
+
+
+
+ {contact.value}
+
- Via {team.contactMethod}
+ Via {contact.method}
- )}
-
- )}
+
+ );
+ })()}
diff --git a/components/hackathons/team-formation/ContactTeamModal.tsx b/components/hackathons/team-formation/ContactTeamModal.tsx
index 13d3f197..a85a63aa 100644
--- a/components/hackathons/team-formation/ContactTeamModal.tsx
+++ b/components/hackathons/team-formation/ContactTeamModal.tsx
@@ -18,7 +18,10 @@ import {
ExternalLink,
Check,
} from 'lucide-react';
-import { TeamRecruitmentPost } from '@/lib/api/hackathons/teams';
+import {
+ readTeamContact,
+ TeamRecruitmentPost,
+} from '@/lib/api/hackathons/teams';
import { useState } from 'react';
import { toast } from 'sonner';
@@ -39,10 +42,16 @@ export function ContactTeamModal({
if (!team) return null;
- const { teamName, contactMethod, contactInfo, id } = team;
+ const { teamName, contactInfo, id } = team;
+ const contact = readTeamContact(contactInfo);
+
+ // If the team has no contact info at all, render nothing: the parent
+ // should have already gated this modal, but defend against bad data.
+ if (!contact) return null;
+ const { method: contactMethod, value: contactValue } = contact;
const handleCopy = () => {
- navigator.clipboard.writeText(contactInfo);
+ navigator.clipboard.writeText(contactValue);
setCopied(true);
toast.success('Contact info copied to clipboard');
setTimeout(() => setCopied(false), 2000);
@@ -56,8 +65,6 @@ export function ContactTeamModal({
case 'telegram':
case 'discord':
return ;
- case 'github':
- return ;
default:
return ;
}
@@ -71,15 +78,13 @@ export function ContactTeamModal({
return 'Telegram Username/Link';
case 'discord':
return 'Discord Username';
- case 'github':
- return 'GitHub Profile';
default:
return 'Contact Info';
}
};
const isLink =
- contactInfo.startsWith('http') || contactInfo.startsWith('https');
+ contactValue.startsWith('http') || contactValue.startsWith('https');
return (