import { FC, ReactElement } from 'react'; import { Link } from 'react-router'; import { useMyTeams, useMyInvitations, useRespondToInvitation, useAuthStore, } from '@imphnen-frontend-service/service'; import { toast } from 'sonner'; import { Button } from '@imphnen-frontend-service/ui/atoms'; const DashboardPage: FC = (): ReactElement => { const { session } = useAuthStore(); const { data: teamsData } = useMyTeams(); const { data: invitationsData } = useMyInvitations(); const { mutateAsync: respondToInvitation } = useRespondToInvitation(); const user = session?.user; const myTeams = teamsData?.data || []; const invitations = invitationsData?.data || []; const handleAcceptInvitation = async (invitationId: string) => { try { await respondToInvitation({ invitationId, action: 'accept' }); toast.success('Invitation accepted! You are now a team member.'); } catch (error) { console.error('Failed to accept invitation:', error); toast.error('Failed to accept invitation'); } }; const handleRejectInvitation = async (invitationId: string) => { try { await respondToInvitation({ invitationId, action: 'reject' }); toast.success('Invitation declined'); } catch (error) { console.error('Failed to reject invitation:', error); toast.error('Failed to decline invitation'); } }; return (
Location: {user.location}
)}{invitation.team.name}
Invited by {invitation.inviter.fullname}
City: {team.city}
{team.description}
Use the sidebar to browse teams or create your own
{user.location}
) : ( Complete your profile )}{user.bio}