mirror of
https://github.com/umami-software/umami.git
synced 2026-02-14 17:45:38 +01:00
More refactoring, cleaned up icons, nav buttons, add messages.
This commit is contained in:
parent
4b1013c8c6
commit
5f15ad0807
68 changed files with 391 additions and 790 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { useEffect, useState } from 'react';
|
||||
import { Breadcrumbs, Item, Tabs, useToast, Button, Text, Icon, Icons } from 'react-basics';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { useRouter } from 'next/router';
|
||||
import Link from 'next/link';
|
||||
import Page from 'components/layout/Page';
|
||||
import PageHeader from 'components/layout/PageHeader';
|
||||
|
|
@ -11,9 +12,8 @@ import ShareUrl from 'components/pages/settings/websites/ShareUrl';
|
|||
import useApi from 'hooks/useApi';
|
||||
import { labels, messages } from 'components/messages';
|
||||
|
||||
const { External } = Icons;
|
||||
|
||||
export default function WebsiteSettings({ websiteId }) {
|
||||
const router = useRouter();
|
||||
const { formatMessage } = useIntl();
|
||||
const [values, setValues] = useState(null);
|
||||
const [tab, setTab] = useState('details');
|
||||
|
|
@ -34,6 +34,12 @@ export default function WebsiteSettings({ websiteId }) {
|
|||
setValues(state => ({ ...state, ...data }));
|
||||
};
|
||||
|
||||
const handleReset = async value => {
|
||||
if (value === 'delete') {
|
||||
await router.push('/websites');
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
setValues(data);
|
||||
|
|
@ -54,7 +60,7 @@ export default function WebsiteSettings({ websiteId }) {
|
|||
<a>
|
||||
<Button variant="primary">
|
||||
<Icon>
|
||||
<External />
|
||||
<Icons.External />
|
||||
</Icon>
|
||||
<Text>{formatMessage(labels.view)}</Text>
|
||||
</Button>
|
||||
|
|
@ -72,7 +78,7 @@ export default function WebsiteSettings({ websiteId }) {
|
|||
)}
|
||||
{tab === 'tracking' && <TrackingCode websiteId={websiteId} data={values} />}
|
||||
{tab === 'share' && <ShareUrl websiteId={websiteId} data={values} onSave={handleSave} />}
|
||||
{tab === 'data' && <WebsiteReset websiteId={websiteId} onSave={handleSave} />}
|
||||
{tab === 'data' && <WebsiteReset websiteId={websiteId} onSave={handleReset} />}
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue