Added config to open websites in new tab.

This commit is contained in:
Mike Cao 2023-03-29 23:08:26 -07:00
parent 964ef1c92e
commit d471d05217
2 changed files with 10 additions and 10 deletions

View File

@ -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 />

View File

@ -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 />