Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Fixed website refresh after save.
Mike Caof50067e44fe0
diff --git a/src/app/(main)/settings/websites/[websiteId]/ShareUrl.tsx b/src/app/(main)/settings/websites/[websiteId]/ShareUrl.tsxindex e06657d47..640c519b1 100644--- a/src/app/(main)/settings/websites/[websiteId]/ShareUrl.tsx+++ b/src/app/(main)/settings/websites/[websiteId]/ShareUrl.tsx@@ -7,7 +7,6 @@ import {Button,Toggle,LoadingButton,- useToasts,} from 'react-basics';import { useContext, useState } from 'react';import { getRandomChars } from 'next-basics';@@ -18,6 +17,7 @@ const generateId = () => getRandomChars(16);export function ShareUrl({hostUrl,+ onSave,}: {websiteId: string;hostUrl?: string;@@ -27,7 +27,6 @@ export function ShareUrl({const { domain, shareId } = website;const { formatMessage, labels, messages } = useMessages();const [id, setId] = useState(shareId);- const { showToast } = useToasts();const { post, useMutation } = useApi();const { mutate, error, isPending } = useMutation({mutationFn: (data: any) => post(`/websites/${website.id}`, data),@@ -46,7 +45,8 @@ export function ShareUrl({const data = { shareId: checked ? generateId() : null };mutate(data, {onSuccess: async () => {- showToast({ message: formatMessage(messages.saved), variant: 'success' });+ touch(`website:${website.id}`);+ onSave?.();},});setId(data.shareId);@@ -57,8 +57,8 @@ export function ShareUrl({{ shareId: id },{onSuccess: async () => {- showToast({ message: formatMessage(messages.saved), variant: 'success' });- touch(`website:${website?.id}`);+ touch(`website:${website.id}`);+ onSave?.();},},);diff --git a/src/app/(main)/settings/websites/[websiteId]/WebsiteEditForm.tsx b/src/app/(main)/settings/websites/[websiteId]/WebsiteEditForm.tsxindex d7d9cef40..dac7a8d45 100644--- a/src/app/(main)/settings/websites/[websiteId]/WebsiteEditForm.tsx+++ b/src/app/(main)/settings/websites/[websiteId]/WebsiteEditForm.tsx@@ -1,18 +1,10 @@import { useContext, useRef } from 'react';-import {- SubmitButton,- Form,- FormInput,- FormRow,- FormButtons,- TextField,- useToasts,-} from 'react-basics';+import { SubmitButton, Form, FormInput, FormRow, FormButtons, TextField } from 'react-basics';import { useApi, useMessages, useModified } from 'components/hooks';import { DOMAIN_REGEX } from 'lib/constants';import { WebsiteContext } from 'app/(main)/websites/[websiteId]/WebsiteProvider';-export function WebsiteEditForm({ websiteId }: { websiteId: string }) {+export function WebsiteEditForm({ websiteId, onSave }: { websiteId: string; onSave?: () => void }) {const website = useContext(WebsiteContext);const { formatMessage, labels, messages } = useMessages();const { post, useMutation } = useApi();@@ -20,15 +12,14 @@ export function WebsiteEditForm({ websiteId }: { websiteId: string }) {mutationFn: (data: any) => post(`/websites/${websiteId}`, data),});const ref = useRef(null);- const { showToast } = useToasts();const { touch } = useModified();const handleSubmit = async (data: any) => {mutate(data, {onSuccess: async () => {- showToast({ message: formatMessage(messages.saved), variant: 'success' });ref.current.reset(data);- touch(`website:${website?.id}`);+ touch(`website:${website.id}`);+ onSave?.();},});};diff --git a/src/app/(main)/settings/websites/[websiteId]/WebsiteSettings.tsx b/src/app/(main)/settings/websites/[websiteId]/WebsiteSettings.tsxindex af7723aee..86491227b 100644--- a/src/app/(main)/settings/websites/[websiteId]/WebsiteSettings.tsx+++ b/src/app/(main)/settings/websites/[websiteId]/WebsiteSettings.tsx@@ -38,9 +38,9 @@ export function WebsiteSettings({ websiteId, openExternal = false }) {<Item key="share">{formatMessage(labels.shareUrl)}</Item><Item key="data">{formatMessage(labels.data)}</Item></Tabs>- {tab === 'details' && <WebsiteEditForm websiteId={websiteId} />}+ {tab === 'details' && <WebsiteEditForm websiteId={websiteId} onSave={handleSave} />}{tab === 'tracking' && <TrackingCode websiteId={websiteId} />}- {tab === 'share' && <ShareUrl websiteId={websiteId} />}+ {tab === 'share' && <ShareUrl websiteId={websiteId} onSave={handleSave} />}{tab === 'data' && <WebsiteData websiteId={websiteId} onSave={handleSave} />}</>);diff --git a/src/styles/index.css b/src/styles/index.cssindex 4031851aa..d337aeccc 100644--- a/src/styles/index.css+++ b/src/styles/index.css@@ -89,3 +89,18 @@ main::-webkit-scrollbar-track {background-color: var(--base800);background-clip: padding-box;}++:root {+ --dark50: #111111;+ --dark75: #191919;+ --dark100: #222222;+ --dark150: #2a2a2a;+ --dark200: #313131;+ --dark300: #3a3a3a;+ --dark400: #484848;+ --dark500: #606060;+ --dark600: #6e6e6e;+ --dark700: #7b7b7b;+ --dark800: #b4b4b4;+ --dark900: #eeeeee;+}