mirror of
https://github.com/plausible/analytics.git
synced 2024-09-17 12:57:13 +03:00
Make new tab dashboard links work (#4276)
* Make new tab dashboard links work * Urlencode domain * Recognize shared links
This commit is contained in:
parent
70fca3e8d1
commit
fa065c85a3
@ -31,7 +31,8 @@ if (container) {
|
||||
background: container.dataset.background,
|
||||
isDbip: container.dataset.isDbip === 'true',
|
||||
flags: JSON.parse(container.dataset.flags),
|
||||
validIntervalsByPeriod: JSON.parse(container.dataset.validIntervalsByPeriod)
|
||||
validIntervalsByPeriod: JSON.parse(container.dataset.validIntervalsByPeriod),
|
||||
shared: !!container.dataset.sharedLinkAuth,
|
||||
}
|
||||
|
||||
const loggedIn = container.dataset.loggedIn === 'true'
|
||||
|
@ -27,9 +27,10 @@ function ScrollToTop() {
|
||||
}
|
||||
|
||||
export default function Router({ site, loggedIn, currentUserRole }) {
|
||||
console.info('xxx', site);
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<Route path="/:domain">
|
||||
<BrowserRouter basename={site.shared ? `/share/${encodeURI(site.domain)}` : encodeURI(site.domain)}>
|
||||
<Route path="/">
|
||||
<ScrollToTop />
|
||||
<Dash site={site} loggedIn={loggedIn} currentUserRole={currentUserRole} />
|
||||
<Switch>
|
||||
@ -52,7 +53,7 @@ export default function Router({ site, loggedIn, currentUserRole }) {
|
||||
<ExitPagesModal site={site} />
|
||||
</Route>
|
||||
<Route path="/:domain/countries">
|
||||
<ModalTable title="Top countries" site={site} endpoint={url.apiPath(site, '/countries')} filterKey="country" keyLabel="Country" renderIcon={renderCountryIcon} showPercentage={true}/>
|
||||
<ModalTable title="Top countries" site={site} endpoint={url.apiPath(site, '/countries')} filterKey="country" keyLabel="Country" renderIcon={renderCountryIcon} showPercentage={true} />
|
||||
</Route>
|
||||
<Route path="/:domain/regions">
|
||||
<ModalTable title="Top regions" site={site} endpoint={url.apiPath(site, '/regions')} filterKey="region" keyLabel="Region" renderIcon={renderRegionIcon} />
|
||||
@ -71,7 +72,7 @@ export default function Router({ site, loggedIn, currentUserRole }) {
|
||||
</Route>
|
||||
</Switch>
|
||||
</Route>
|
||||
</BrowserRouter>
|
||||
</BrowserRouter >
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user