mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 17:15:37 +01:00
Refactored queries.
This commit is contained in:
parent
18e36aa7b3
commit
b16f5cc067
67 changed files with 523 additions and 576 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { Button, Icon, Icons, Modal, ModalTrigger, Text, useToasts } from 'react-basics';
|
||||
import WebsiteAddForm from './WebsiteAddForm';
|
||||
import { useMessages } from 'components/hooks';
|
||||
import { setValue } from 'store/cache';
|
||||
import { touch } from 'store/cache';
|
||||
|
||||
export function WebsiteAddButton({ teamId, onSave }: { teamId: string; onSave?: () => void }) {
|
||||
const { formatMessage, labels, messages } = useMessages();
|
||||
|
|
@ -9,7 +9,7 @@ export function WebsiteAddButton({ teamId, onSave }: { teamId: string; onSave?:
|
|||
|
||||
const handleSave = async () => {
|
||||
showToast({ message: formatMessage(messages.saved), variant: 'success' });
|
||||
setValue('websites', Date.now());
|
||||
touch('websites');
|
||||
onSave?.();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import WebsitesHeader from './WebsitesHeader';
|
|||
|
||||
export default function Websites() {
|
||||
const { user } = useLogin();
|
||||
|
||||
return (
|
||||
<>
|
||||
<WebsitesHeader showActions={user.role !== 'view-only'} />
|
||||
|
|
|
|||
|
|
@ -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 } from 'components/hooks';
|
||||
import { useMessages, useLogin, useNavigation } from 'components/hooks';
|
||||
|
||||
export interface WebsitesTableProps {
|
||||
data: any[];
|
||||
|
|
@ -23,6 +23,7 @@ export function WebsitesTable({
|
|||
const { formatMessage, labels } = useMessages();
|
||||
const { user } = useLogin();
|
||||
const breakpoint = useBreakpoint();
|
||||
const { renderTeamUrl } = useNavigation();
|
||||
|
||||
return (
|
||||
<GridTable data={data} cardMode={['xs', 'sm', 'md'].includes(breakpoint)}>
|
||||
|
|
@ -46,7 +47,7 @@ export function WebsitesTable({
|
|||
</Link>
|
||||
)}
|
||||
{allowView && (
|
||||
<Link href={teamId ? `/teams/${teamId}/websites/${id}` : `/websites/${id}`}>
|
||||
<Link href={renderTeamUrl(`/websites/${id}`)}>
|
||||
<Button>
|
||||
<Icon>
|
||||
<Icons.External />
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import WebsiteSettings from '../WebsiteSettings';
|
||||
|
||||
export default async function WebsiteSettingsPage({ params: { id } }) {
|
||||
if (process.env.cloudMode) {
|
||||
export default async function WebsiteSettingsPage({ params: { websiteId } }) {
|
||||
if (process.env.cloudMode || !websiteId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <WebsiteSettings websiteId={id} />;
|
||||
return <WebsiteSettings websiteId={websiteId} />;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue