mirror of
https://github.com/umami-software/umami.git
synced 2026-02-14 01:25:37 +01:00
Teams context settings.
This commit is contained in:
parent
4429198397
commit
8f853ddb97
77 changed files with 317 additions and 272 deletions
|
|
@ -3,13 +3,13 @@ import { useLogin } from 'components/hooks';
|
|||
import WebsitesDataTable from './WebsitesDataTable';
|
||||
import WebsitesHeader from './WebsitesHeader';
|
||||
|
||||
export default function Websites() {
|
||||
export default function Websites({ teamId }: { teamId: string }) {
|
||||
const { user } = useLogin();
|
||||
|
||||
return (
|
||||
<>
|
||||
<WebsitesHeader showActions={user.role !== 'view-only'} />
|
||||
<WebsitesDataTable userId={user.id} />
|
||||
<WebsitesDataTable teamId={teamId} userId={user.id} allowEdit={true} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { ReactNode } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { Button, Text, Icon, Icons, GridTable, GridColumn, useBreakpoint } from 'react-basics';
|
||||
import { useMessages, useLogin, useNavigation } from 'components/hooks';
|
||||
import { useMessages, useLogin, useTeamContext } from 'components/hooks';
|
||||
|
||||
export interface WebsitesTableProps {
|
||||
data: any[];
|
||||
|
|
@ -23,7 +23,7 @@ export function WebsitesTable({
|
|||
const { formatMessage, labels } = useMessages();
|
||||
const { user } = useLogin();
|
||||
const breakpoint = useBreakpoint();
|
||||
const { renderTeamUrl } = useNavigation();
|
||||
const { renderTeamUrl } = useTeamContext();
|
||||
|
||||
return (
|
||||
<GridTable data={data} cardMode={['xs', 'sm', 'md'].includes(breakpoint)}>
|
||||
|
|
@ -32,12 +32,12 @@ export function WebsitesTable({
|
|||
{showActions && (
|
||||
<GridColumn name="action" label=" " alignment="end">
|
||||
{row => {
|
||||
const { id, userId } = row;
|
||||
const { id } = row;
|
||||
|
||||
return (
|
||||
<>
|
||||
{allowEdit && !teamId && user.id === userId && (
|
||||
<Link href={`/settings/websites/${id}`}>
|
||||
{allowEdit && (teamId || user.isAdmin) && (
|
||||
<Link href={renderTeamUrl(`/settings/websites/${id}`)}>
|
||||
<Button>
|
||||
<Icon>
|
||||
<Icons.Edit />
|
||||
|
|
@ -47,7 +47,7 @@ export function WebsitesTable({
|
|||
</Link>
|
||||
)}
|
||||
{allowView && (
|
||||
<Link href={renderTeamUrl(`/websites/${id}`)}>
|
||||
<Link href={renderTeamUrl(renderTeamUrl(`/websites/${id}`))}>
|
||||
<Button>
|
||||
<Icon>
|
||||
<Icons.ArrowRight />
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
import WebsiteSettings from '../WebsiteSettings';
|
||||
|
||||
export default async function WebsiteSettingsPage({ params: { websiteId } }) {
|
||||
if (process.env.cloudMode || !websiteId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <WebsiteSettings websiteId={websiteId} />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { Metadata } from 'next';
|
||||
import Websites from './Websites';
|
||||
|
||||
export default function () {
|
||||
return <Websites />;
|
||||
export default function ({ params: { teamId } }: { params: { teamId: string } }) {
|
||||
return <Websites teamId={teamId} />;
|
||||
}
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Websites Settings | umami',
|
||||
title: 'Websites Settings | Umami',
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue