mirror of
https://github.com/umami-software/umami.git
synced 2026-02-22 21:45:36 +01:00
Added settings layout.
This commit is contained in:
parent
d818bf5aaf
commit
6802093d69
22 changed files with 102 additions and 76 deletions
|
|
@ -1,26 +1,23 @@
|
|||
'use client';
|
||||
import TeamEditForm from 'app/(main)/settings/teams/[teamId]/TeamEditForm';
|
||||
import { useLogin, useMessages, useTeam } from 'components/hooks';
|
||||
import { Loading } from 'react-basics';
|
||||
import { useContext } from 'react';
|
||||
import { useLogin, useMessages } from 'components/hooks';
|
||||
import PageHeader from 'components/layout/PageHeader';
|
||||
import { ROLES } from 'lib/constants';
|
||||
import TeamEditForm from 'app/(main)/settings/teams/[teamId]/TeamEditForm';
|
||||
import { TeamContext } from 'app/(main)/teams/[teamId]/TeamProvider';
|
||||
|
||||
export default function Team({ teamId }: { teamId: string }) {
|
||||
const team = useContext(TeamContext);
|
||||
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} />
|
||||
<TeamEditForm teamId={teamId} allowEdit={allowEdit} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue