mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 00:55:37 +01:00
Teams context settings.
This commit is contained in:
parent
4429198397
commit
8f853ddb97
77 changed files with 317 additions and 272 deletions
|
|
@ -1,5 +0,0 @@
|
|||
import { createContext } from 'react';
|
||||
|
||||
export const TeamsContext = createContext(null);
|
||||
|
||||
export default TeamsContext;
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
'use client';
|
||||
import TeamsContext from '../TeamsContext';
|
||||
import { Loading } from 'react-basics';
|
||||
import { useTeam } from 'components/hooks';
|
||||
import { useParams } from 'next/navigation';
|
||||
|
||||
export default function Team({ children }) {
|
||||
const { id: teamId } = useParams();
|
||||
const { data: team, isLoading, error } = useTeam(teamId as string);
|
||||
|
||||
if (error) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return <Loading position="page" />;
|
||||
}
|
||||
|
||||
return <TeamsContext.Provider value={team}>{children}</TeamsContext.Provider>;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import Team from './Team';
|
||||
|
||||
export default function ({ children }) {
|
||||
return <Team>{children}</Team>;
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
'use client';
|
||||
import Link from 'next/link';
|
||||
import { Button, Flexbox, Icon, Icons, Text } from 'react-basics';
|
||||
import { useMessages, useNavigation } from 'components/hooks';
|
||||
import ReportsDataTable from 'app/(main)/reports/ReportsDataTable';
|
||||
|
||||
export function TeamReports({ websiteId }) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { renderTeamUrl } = useNavigation();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flexbox alignItems="center" justifyContent="end">
|
||||
<Link href={renderTeamUrl(`/reports/create`)}>
|
||||
<Button variant="primary">
|
||||
<Icon>
|
||||
<Icons.Plus />
|
||||
</Icon>
|
||||
<Text>{formatMessage(labels.createReport)}</Text>
|
||||
</Button>
|
||||
</Link>
|
||||
</Flexbox>
|
||||
<ReportsDataTable websiteId={websiteId} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default TeamReports;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import Page from 'app/(main)/reports/[reportId]/page';
|
||||
|
||||
export default Page;
|
||||
|
|
@ -1,10 +1,3 @@
|
|||
import { Metadata } from 'next';
|
||||
import ReportTemplates from 'app/(main)/reports/create/ReportTemplates';
|
||||
import Page from 'app/(main)/reports/create/page';
|
||||
|
||||
export default function () {
|
||||
return <ReportTemplates />;
|
||||
}
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Create Report | umami',
|
||||
};
|
||||
export default Page;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
import Page from 'app/(main)/reports/event-data/page';
|
||||
|
||||
export default Page;
|
||||
3
src/app/(main)/teams/[teamId]/reports/funnel/page.tsx
Normal file
3
src/app/(main)/teams/[teamId]/reports/funnel/page.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import Page from 'app/(main)/reports/funnel/page';
|
||||
|
||||
export default Page;
|
||||
3
src/app/(main)/teams/[teamId]/reports/insights/page.tsx
Normal file
3
src/app/(main)/teams/[teamId]/reports/insights/page.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import Page from 'app/(main)/reports/insights/page';
|
||||
|
||||
export default Page;
|
||||
|
|
@ -1,15 +1,3 @@
|
|||
import { Metadata } from 'next';
|
||||
import ReportsHeader from 'app/(main)/reports/ReportsHeader';
|
||||
import ReportsDataTable from 'app/(main)/reports/ReportsDataTable';
|
||||
import Page from 'app/(main)/reports/page';
|
||||
|
||||
export default function ({ params: { teamId } }) {
|
||||
return (
|
||||
<>
|
||||
<ReportsHeader />
|
||||
<ReportsDataTable teamId={teamId} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
export const metadata: Metadata = {
|
||||
title: 'Reports | umami',
|
||||
};
|
||||
export default Page;
|
||||
|
|
|
|||
3
src/app/(main)/teams/[teamId]/reports/retention/page.tsx
Normal file
3
src/app/(main)/teams/[teamId]/reports/retention/page.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import Page from 'app/(main)/reports/retention/page';
|
||||
|
||||
export default Page;
|
||||
3
src/app/(main)/teams/[teamId]/settings/layout.tsx
Normal file
3
src/app/(main)/teams/[teamId]/settings/layout.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import Layout from 'app/(main)/settings/layout';
|
||||
|
||||
export default Layout;
|
||||
15
src/app/(main)/teams/[teamId]/settings/members/Members.tsx
Normal file
15
src/app/(main)/teams/[teamId]/settings/members/Members.tsx
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
'use client';
|
||||
import TeamMembers from 'app/(main)/settings/teams/[teamId]/TeamMembers';
|
||||
import PageHeader from 'components/layout/PageHeader';
|
||||
import { useMessages } from 'components/hooks';
|
||||
|
||||
export default function ({ teamId }: { teamId: string }) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader title={formatMessage(labels.members)} />
|
||||
<TeamMembers teamId={teamId} allowEdit={true} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
5
src/app/(main)/teams/[teamId]/settings/members/page.tsx
Normal file
5
src/app/(main)/teams/[teamId]/settings/members/page.tsx
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import Members from './Members';
|
||||
|
||||
export default function ({ params: { teamId } }) {
|
||||
return <Members teamId={teamId} />;
|
||||
}
|
||||
26
src/app/(main)/teams/[teamId]/settings/team/Team.tsx
Normal file
26
src/app/(main)/teams/[teamId]/settings/team/Team.tsx
Normal 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} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
5
src/app/(main)/teams/[teamId]/settings/team/page.tsx
Normal file
5
src/app/(main)/teams/[teamId]/settings/team/page.tsx
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import Team from './Team';
|
||||
|
||||
export default function ({ params: { teamId } }) {
|
||||
return <Team teamId={teamId} />;
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import Page from 'app/(main)/settings/websites/[websiteId]/page';
|
||||
|
||||
export default Page;
|
||||
3
src/app/(main)/teams/[teamId]/settings/websites/page.tsx
Normal file
3
src/app/(main)/teams/[teamId]/settings/websites/page.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import Page from 'app/(main)/settings/websites/page';
|
||||
|
||||
export default Page;
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
import WebsiteDetails from 'app/(main)/websites/[websiteId]/WebsiteDetails';
|
||||
import Page from 'app/(main)/websites/[websiteId]/page';
|
||||
|
||||
export default function TeamWebsitePage({ params: { websiteId } }) {
|
||||
return <WebsiteDetails websiteId={websiteId} />;
|
||||
}
|
||||
export default Page;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,3 @@
|
|||
import WebsitesDataTable from 'app/(main)/settings/websites/WebsitesDataTable';
|
||||
import WebsitesHeader from 'app/(main)/settings/websites/WebsitesHeader';
|
||||
import Page from 'app/(main)/websites/page';
|
||||
|
||||
export default function TeamWebsitesPage({ params: { teamId } }: { params: { teamId: string } }) {
|
||||
return (
|
||||
<>
|
||||
<WebsitesHeader teamId={teamId} />
|
||||
<WebsitesDataTable teamId={teamId} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
export default Page;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue