Teams context settings.

This commit is contained in:
Mike Cao 2024-02-02 17:49:17 -08:00
parent 4429198397
commit 8f853ddb97
77 changed files with 317 additions and 272 deletions

View file

@ -0,0 +1,26 @@
'use client';
import TeamEditForm from 'app/(main)/settings/teams/[teamId]/TeamEditForm';
import { useLogin, useMessages, useTeam } from 'components/hooks';
import { Loading } from 'react-basics';
import PageHeader from 'components/layout/PageHeader';
import { ROLES } from 'lib/constants';
export default function Team({ teamId }: { teamId: string }) {
const { user } = useLogin();
const { formatMessage, labels } = useMessages();
const { data: team, isLoading } = useTeam(teamId);
const allowEdit = !!team?.teamUser?.find(
({ userId, role }) => role === ROLES.teamOwner && userId === user.id,
);
if (isLoading) {
return <Loading />;
}
return (
<>
<PageHeader title={formatMessage(labels.team)} />
<TeamEditForm teamId={teamId} data={team} allowEdit={allowEdit} />
</>
);
}

View file

@ -0,0 +1,5 @@
import Team from './Team';
export default function ({ params: { teamId } }) {
return <Team teamId={teamId} />;
}