mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Updated website edit.
This commit is contained in:
parent
fdfa8b08f9
commit
eabfec9075
8 changed files with 47 additions and 58 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
'use client';
|
'use client';
|
||||||
import { Column } from '@umami/react-zen';
|
|
||||||
import { WebsiteProvider } from '@/app/(main)/websites/WebsiteProvider';
|
import { WebsiteProvider } from '@/app/(main)/websites/WebsiteProvider';
|
||||||
import { WebsiteSettings } from '@/app/(main)/websites/[websiteId]/settings/WebsiteSettings';
|
import { WebsiteSettings } from '@/app/(main)/websites/[websiteId]/settings/WebsiteSettings';
|
||||||
import { WebsiteSettingsHeader } from '@/app/(main)/websites/[websiteId]/settings/WebsiteSettingsHeader';
|
import { WebsiteSettingsHeader } from '@/app/(main)/websites/[websiteId]/settings/WebsiteSettingsHeader';
|
||||||
|
|
@ -7,10 +6,8 @@ import { WebsiteSettingsHeader } from '@/app/(main)/websites/[websiteId]/setting
|
||||||
export function WebsiteSettingsPage({ websiteId }: { websiteId: string }) {
|
export function WebsiteSettingsPage({ websiteId }: { websiteId: string }) {
|
||||||
return (
|
return (
|
||||||
<WebsiteProvider websiteId={websiteId}>
|
<WebsiteProvider websiteId={websiteId}>
|
||||||
<Column gap="6" margin="2">
|
<WebsiteSettingsHeader />
|
||||||
<WebsiteSettingsHeader />
|
<WebsiteSettings websiteId={websiteId} />
|
||||||
<WebsiteSettings websiteId={websiteId} />
|
|
||||||
</Column>
|
|
||||||
</WebsiteProvider>
|
</WebsiteProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,13 @@
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
import { Row, Text, Icon, DataTable, DataColumn, MenuItem } from '@umami/react-zen';
|
import { Icon, DataTable, DataColumn } from '@umami/react-zen';
|
||||||
|
import { LinkButton } from '@/components/common/LinkButton';
|
||||||
import { useMessages, useNavigation } from '@/components/hooks';
|
import { useMessages, useNavigation } from '@/components/hooks';
|
||||||
import { MenuButton } from '@/components/input/MenuButton';
|
import { SquarePen } from '@/components/icons';
|
||||||
import { Eye, SquarePen } from '@/components/icons';
|
|
||||||
import { Empty } from '@/components/common/Empty';
|
import { Empty } from '@/components/common/Empty';
|
||||||
|
|
||||||
export function WebsitesTable({
|
export function WebsitesTable({
|
||||||
data = [],
|
data = [],
|
||||||
showActions,
|
showActions,
|
||||||
allowEdit,
|
|
||||||
allowView,
|
|
||||||
renderLink,
|
renderLink,
|
||||||
}: {
|
}: {
|
||||||
data: Record<string, any>[];
|
data: Record<string, any>[];
|
||||||
|
|
@ -37,28 +35,11 @@ export function WebsitesTable({
|
||||||
const websiteId = row.id;
|
const websiteId = row.id;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MenuButton>
|
<LinkButton href={renderUrl(`/websites/${websiteId}/settings`)} variant="quiet">
|
||||||
{allowView && (
|
<Icon>
|
||||||
<MenuItem href={renderUrl(`/websites/${websiteId}`)}>
|
<SquarePen />
|
||||||
<Row alignItems="center" gap>
|
</Icon>
|
||||||
<Icon data-test="link-button-view">
|
</LinkButton>
|
||||||
<Eye />
|
|
||||||
</Icon>
|
|
||||||
<Text>{formatMessage(labels.view)}</Text>
|
|
||||||
</Row>
|
|
||||||
</MenuItem>
|
|
||||||
)}
|
|
||||||
{allowEdit && (
|
|
||||||
<MenuItem href={renderUrl(`/websites/${websiteId}/settings`)}>
|
|
||||||
<Row alignItems="center" gap>
|
|
||||||
<Icon data-test="link-button-edit">
|
|
||||||
<SquarePen />
|
|
||||||
</Icon>
|
|
||||||
<Text>{formatMessage(labels.edit)}</Text>
|
|
||||||
</Row>
|
|
||||||
</MenuItem>
|
|
||||||
)}
|
|
||||||
</MenuButton>
|
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
</DataColumn>
|
</DataColumn>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
'use client';
|
'use client';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Button, Column, Box, Text, Icon, DialogTrigger, Modal, Dialog } from '@umami/react-zen';
|
import { Button, Column, Box, DialogTrigger, Popover, Dialog, IconLabel } from '@umami/react-zen';
|
||||||
import { useDateRange, useMessages } from '@/components/hooks';
|
import { useDateRange, useMessages } from '@/components/hooks';
|
||||||
import { ListCheck } from '@/components/icons';
|
import { ListCheck } from '@/components/icons';
|
||||||
import { Panel } from '@/components/common/Panel';
|
import { Panel } from '@/components/common/Panel';
|
||||||
import { Breakdown } from './Breakdown';
|
import { Breakdown } from './Breakdown';
|
||||||
import { WebsiteControls } from '@/app/(main)/websites/[websiteId]/WebsiteControls';
|
import { WebsiteControls } from '@/app/(main)/websites/[websiteId]/WebsiteControls';
|
||||||
import { FieldSelectForm } from '@/app/(main)/websites/[websiteId]/(reports)/breakdown/FieldSelectForm';
|
import { FieldSelectForm } from '@/app/(main)/websites/[websiteId]/(reports)/breakdown/FieldSelectForm';
|
||||||
import { SectionHeader } from '@/components/common/SectionHeader';
|
|
||||||
|
|
||||||
export function BreakdownPage({ websiteId }: { websiteId: string }) {
|
export function BreakdownPage({ websiteId }: { websiteId: string }) {
|
||||||
const {
|
const {
|
||||||
|
|
@ -18,9 +17,7 @@ export function BreakdownPage({ websiteId }: { websiteId: string }) {
|
||||||
return (
|
return (
|
||||||
<Column gap>
|
<Column gap>
|
||||||
<WebsiteControls websiteId={websiteId} />
|
<WebsiteControls websiteId={websiteId} />
|
||||||
<SectionHeader>
|
<FieldsButton value={fields} onChange={setFields} />
|
||||||
<FieldsButton value={fields} onChange={setFields} />
|
|
||||||
</SectionHeader>
|
|
||||||
<Panel height="900px" overflow="auto" allowFullscreen>
|
<Panel height="900px" overflow="auto" allowFullscreen>
|
||||||
<Breakdown
|
<Breakdown
|
||||||
websiteId={websiteId}
|
websiteId={websiteId}
|
||||||
|
|
@ -39,19 +36,16 @@ const FieldsButton = ({ value, onChange }) => {
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<DialogTrigger>
|
<DialogTrigger>
|
||||||
<Button variant="primary">
|
<Button>
|
||||||
<Icon>
|
<IconLabel icon={<ListCheck />}>{formatMessage(labels.fields)}</IconLabel>
|
||||||
<ListCheck />
|
|
||||||
</Icon>
|
|
||||||
<Text>Fields</Text>
|
|
||||||
</Button>
|
</Button>
|
||||||
<Modal>
|
<Popover>
|
||||||
<Dialog title={formatMessage(labels.fields)} style={{ width: 400 }}>
|
<Dialog title={formatMessage(labels.fields)} style={{ width: 400 }}>
|
||||||
{({ close }) => (
|
{({ close }) => (
|
||||||
<FieldSelectForm selectedFields={value} onChange={onChange} onClose={close} />
|
<FieldSelectForm selectedFields={value} onChange={onChange} onClose={close} />
|
||||||
)}
|
)}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</Modal>
|
</Popover>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,24 @@
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
import { Column, Grid } from '@umami/react-zen';
|
import { Column, Grid } from '@umami/react-zen';
|
||||||
import { WebsiteProvider } from '@/app/(main)/websites/WebsiteProvider';
|
import { WebsiteProvider } from '@/app/(main)/websites/WebsiteProvider';
|
||||||
|
import { useNavigation } from '@/components/hooks';
|
||||||
import { PageBody } from '@/components/common/PageBody';
|
import { PageBody } from '@/components/common/PageBody';
|
||||||
import { WebsiteHeader } from './WebsiteHeader';
|
import { WebsiteHeader } from './WebsiteHeader';
|
||||||
import { WebsiteNav } from './WebsiteNav';
|
import { WebsiteNav } from './WebsiteNav';
|
||||||
|
|
||||||
export function WebsiteLayout({ websiteId, children }: { websiteId: string; children: ReactNode }) {
|
export function WebsiteLayout({ websiteId, children }: { websiteId: string; children: ReactNode }) {
|
||||||
|
const { pathname } = useNavigation();
|
||||||
|
|
||||||
|
const isSettings = pathname.endsWith('/settings');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WebsiteProvider websiteId={websiteId}>
|
<WebsiteProvider websiteId={websiteId}>
|
||||||
<Grid columns="auto 1fr" width="100%" height="100%">
|
<Grid columns={isSettings ? '1fr' : 'auto 1fr'} width="100%" height="100%">
|
||||||
<Column height="100%" border="right" backgroundColor marginRight="2">
|
{!isSettings && (
|
||||||
<WebsiteNav websiteId={websiteId} />
|
<Column height="100%" border="right" backgroundColor marginRight="2">
|
||||||
</Column>
|
<WebsiteNav websiteId={websiteId} />
|
||||||
|
</Column>
|
||||||
|
)}
|
||||||
<PageBody gap>
|
<PageBody gap>
|
||||||
<WebsiteHeader />
|
<WebsiteHeader />
|
||||||
<Column>{children}</Column>
|
<Column>{children}</Column>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { Text } from '@umami/react-zen';
|
||||||
import { Eye, User, Clock, Sheet, Tag, ChartPie, UserPlus } from '@/components/icons';
|
import { Eye, User, Clock, Sheet, Tag, ChartPie, UserPlus } from '@/components/icons';
|
||||||
import { Lightning, Path, Money, Compare, Target, Funnel, Magnet, Network } from '@/components/svg';
|
import { Lightning, Path, Money, Compare, Target, Funnel, Magnet, Network } from '@/components/svg';
|
||||||
import { useMessages, useNavigation } from '@/components/hooks';
|
import { useMessages, useNavigation } from '@/components/hooks';
|
||||||
import { SideMenu } from '@/components/common/SideMenu';
|
import { SideMenu } from '@/components/common/SideMenu';
|
||||||
import { WebsiteSelect } from '@/components/input/WebsiteSelect';
|
import { WebsiteSelect } from '@/components/input/WebsiteSelect';
|
||||||
import { Text } from '@umami/react-zen';
|
|
||||||
|
|
||||||
export function WebsiteNav({ websiteId }: { websiteId: string }) {
|
export function WebsiteNav({ websiteId }: { websiteId: string }) {
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,22 @@
|
||||||
|
import Link from 'next/link';
|
||||||
import { PageHeader } from '@/components/common/PageHeader';
|
import { PageHeader } from '@/components/common/PageHeader';
|
||||||
import { Globe } from '@/components/icons';
|
import { Globe, ArrowLeft } from '@/components/icons';
|
||||||
import { useWebsite } from '@/components/hooks';
|
import { useMessages, useNavigation, useWebsite } from '@/components/hooks';
|
||||||
|
import { IconLabel, Row } from '@umami/react-zen';
|
||||||
|
|
||||||
export function WebsiteSettingsHeader() {
|
export function WebsiteSettingsHeader() {
|
||||||
const website = useWebsite();
|
const website = useWebsite();
|
||||||
|
const { formatMessage, labels } = useMessages();
|
||||||
|
const { renderUrl } = useNavigation();
|
||||||
|
|
||||||
return <PageHeader title={website?.name} icon={<Globe />} />;
|
return (
|
||||||
|
<>
|
||||||
|
<Row marginTop="6">
|
||||||
|
<Link href={renderUrl(`/websites/${website.id}`)}>
|
||||||
|
<IconLabel icon={<ArrowLeft />} label={formatMessage(labels.website)} />
|
||||||
|
</Link>
|
||||||
|
</Row>
|
||||||
|
<PageHeader title={website?.name} description={website?.domain} icon={<Globe />} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ export function PageHeader({
|
||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
paddingY="6"
|
paddingY="6"
|
||||||
|
marginBottom="6"
|
||||||
border={showBorder ? 'bottom' : undefined}
|
border={showBorder ? 'bottom' : undefined}
|
||||||
width="100%"
|
width="100%"
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
import {
|
import {
|
||||||
Text,
|
|
||||||
Heading,
|
Heading,
|
||||||
NavMenu,
|
NavMenu,
|
||||||
NavMenuItem,
|
NavMenuItem,
|
||||||
Icon,
|
|
||||||
Row,
|
Row,
|
||||||
Column,
|
Column,
|
||||||
NavMenuGroup,
|
NavMenuGroup,
|
||||||
NavMenuProps,
|
NavMenuProps,
|
||||||
|
IconLabel,
|
||||||
} from '@umami/react-zen';
|
} from '@umami/react-zen';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
|
||||||
|
|
@ -47,10 +46,7 @@ export function SideMenu({
|
||||||
return (
|
return (
|
||||||
<Link key={id} href={path}>
|
<Link key={id} href={path}>
|
||||||
<NavMenuItem isSelected={isSelected}>
|
<NavMenuItem isSelected={isSelected}>
|
||||||
<Row alignItems="center" gap>
|
<IconLabel icon={icon}>{label}</IconLabel>
|
||||||
<Icon>{icon}</Icon>
|
|
||||||
<Text>{label}</Text>
|
|
||||||
</Row>
|
|
||||||
</NavMenuItem>
|
</NavMenuItem>
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue