mirror of
https://github.com/umami-software/umami.git
synced 2026-02-22 21:45:36 +01:00
Added website and team providers.
This commit is contained in:
parent
dbb3801e66
commit
cc273092d5
25 changed files with 123 additions and 98 deletions
|
|
@ -0,0 +1,45 @@
|
|||
'use client';
|
||||
import { useState, Key, useContext } from 'react';
|
||||
import { Item, Tabs, Button, Text, Icon } from 'react-basics';
|
||||
import Link from 'next/link';
|
||||
import Icons from 'components/icons';
|
||||
import PageHeader from 'components/layout/PageHeader';
|
||||
import WebsiteEditForm from './WebsiteEditForm';
|
||||
import WebsiteData from './WebsiteData';
|
||||
import TrackingCode from './TrackingCode';
|
||||
import ShareUrl from './ShareUrl';
|
||||
import { useMessages } from 'components/hooks';
|
||||
import { WebsiteContext } from 'app/(main)/websites/[websiteId]/WebsiteProvider';
|
||||
|
||||
export function WebsiteSettings({ websiteId, openExternal = false }) {
|
||||
const website = useContext(WebsiteContext);
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const [tab, setTab] = useState<Key>('details');
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader title={website?.name} icon={<Icons.Globe />}>
|
||||
<Link href={`/websites/${websiteId}`} target={openExternal ? '_blank' : null}>
|
||||
<Button variant="primary">
|
||||
<Icon>
|
||||
<Icons.ArrowRight />
|
||||
</Icon>
|
||||
<Text>{formatMessage(labels.view)}</Text>
|
||||
</Button>
|
||||
</Link>
|
||||
</PageHeader>
|
||||
<Tabs selectedKey={tab} onSelect={setTab} style={{ marginBottom: 30 }}>
|
||||
<Item key="details">{formatMessage(labels.details)}</Item>
|
||||
<Item key="tracking">{formatMessage(labels.trackingCode)}</Item>
|
||||
<Item key="share">{formatMessage(labels.shareUrl)}</Item>
|
||||
<Item key="data">{formatMessage(labels.data)}</Item>
|
||||
</Tabs>
|
||||
{tab === 'details' && <WebsiteEditForm websiteId={websiteId} />}
|
||||
{tab === 'tracking' && <TrackingCode websiteId={websiteId} />}
|
||||
{tab === 'share' && <ShareUrl websiteId={websiteId} />}
|
||||
{tab === 'data' && <WebsiteData websiteId={websiteId} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default WebsiteSettings;
|
||||
Loading…
Add table
Add a link
Reference in a new issue