Skip to content

armgit / umami

Public Imported from GitHub
0

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.

Added config to open websites in new tab.

Mike Caod471d052178a
diff --git a/components/pages/settings/websites/WebsiteSettings.js b/components/pages/settings/websites/WebsiteSettings.js
index dd8b1abe6..5a55a36d1 100644
--- a/components/pages/settings/websites/WebsiteSettings.js
+++ b/components/pages/settings/websites/WebsiteSettings.js
@@ -10,23 +10,21 @@ import TrackingCode from 'components/pages/settings/websites/TrackingCode';
import ShareUrl from 'components/pages/settings/websites/ShareUrl';
import useApi from 'hooks/useApi';
import useMessages from 'hooks/useMessages';
+import useConfig from 'hooks/useConfig';
export default function WebsiteSettings({ websiteId }) {
const router = useRouter();
const { formatMessage, labels, messages } = useMessages();
- const [values, setValues] = useState(null);
- const [tab, setTab] = useState('details');
+ const { openExternal } = useConfig();
const { get, useQuery } = useApi();
const { toast, showToast } = useToast();
const { data, isLoading } = useQuery(
['website', websiteId],
- () => {
- if (websiteId) {
- return get(`/websites/${websiteId}`);
- }
- },
- { cacheTime: 0 },
+ () => get(`/websites/${websiteId}`),
+ { enabled: !!websiteId, cacheTime: 0 },
);
+ const [values, setValues] = useState(null);
+ const [tab, setTab] = useState('details');
const handleSave = data => {
showToast({ message: formatMessage(messages.saved), variant: 'success' });
@@ -58,7 +56,7 @@ export default function WebsiteSettings({ websiteId }) {
</Breadcrumbs>
}
>
- <Link href={`/analytics/websites/${websiteId}`} target="_blank">
+ <Link href={`/websites/${websiteId}`} target={openExternal ? '_blank' : null}>
<Button variant="primary">
<Icon>
<Icons.External />
diff --git a/components/pages/settings/websites/WebsitesTable.js b/components/pages/settings/websites/WebsitesTable.js
index 6f7290a1e..27cc239ed 100644
--- a/components/pages/settings/websites/WebsitesTable.js
+++ b/components/pages/settings/websites/WebsitesTable.js
@@ -13,9 +13,11 @@ import {
Flexbox,
} from 'react-basics';
import useMessages from 'hooks/useMessages';
+import useConfig from 'hooks/useConfig';
export default function WebsitesTable({ data = [] }) {
const { formatMessage, labels } = useMessages();
+ const { openExternal } = useConfig();
const columns = [
{ name: 'name', label: formatMessage(labels.name), style: { flex: 2 } },
@@ -48,7 +50,7 @@ export default function WebsitesTable({ data = [] }) {
<Text>{formatMessage(labels.edit)}</Text>
</Button>
</Link>
- <Link href={`/websites/${id}`}>
+ <Link href={`/websites/${id}`} target={openExternal ? '_blank' : null}>
<Button>
<Icon>
<Icons.External />