diff --git a/src/client/components/perspectives/sampo/InstanceHomePage.js b/src/client/components/perspectives/sampo/InstanceHomePage.js index f01f8bdcc2d5849b121cc2aabd992743b41e46b4..73c54ada1078e37ad7d608c5ee5697b484f8f4cb 100644 --- a/src/client/components/perspectives/sampo/InstanceHomePage.js +++ b/src/client/components/perspectives/sampo/InstanceHomePage.js @@ -155,6 +155,8 @@ class InstanceHomePage extends React.Component { const { classes, perspectiveState, perspectiveConfig, rootUrl, screenSize, layoutConfig } = this.props const { instanceTableData, fetching } = perspectiveState const resultClass = perspectiveConfig.id + const defaultInstancePageTab = perspectiveConfig.defaultInstancePageTab + ? perspectiveConfig.defaultInstancePageTab : 'table' const hasTableData = this.hasTableData() return ( <div className={classes.root}> @@ -180,7 +182,13 @@ class InstanceHomePage extends React.Component { <> <Route exact path={`${rootUrl}/${resultClass}/page/${this.state.localID}`} - render={() => <Redirect to={`${rootUrl}/${resultClass}/page/${this.state.localID}/table`} />} + render={routeProps => + <Redirect + to={{ + pathname: `${rootUrl}/${resultClass}/page/${this.state.localID}/${defaultInstancePageTab}`, + hash: routeProps.location.hash + }} + />} /> <Route path={[`${rootUrl}/${resultClass}/page/${this.state.localID}/table`, '/iframe.html']} // support also rendering in Storybook diff --git a/src/client/components/perspectives/sampo/Perspective3.js b/src/client/components/perspectives/sampo/Perspective3.js index 5fb6d5b2a6f3582cbc5d64a531f686e666c24f6a..94b1c109cd3eba4f1f26e5ff301f42ee079e1f3f 100644 --- a/src/client/components/perspectives/sampo/Perspective3.js +++ b/src/client/components/perspectives/sampo/Perspective3.js @@ -22,6 +22,7 @@ const Perspective3 = props => { routeProps={props.routeProps} tabs={props.perspective.tabs} screenSize={props.screenSize} + layoutConfig={props.layoutConfig} /> <Route exact path={`${rootUrl}/${perspective.id}/faceted-search`} diff --git a/src/client/configs/sampo/PerspectiveConfig.js b/src/client/configs/sampo/PerspectiveConfig.js index f0aaf623cce1bc4d6c96ba662e75aa71b609f095..04cb345e2bfc780784dfdc8a70a5d625a4e236fb 100644 --- a/src/client/configs/sampo/PerspectiveConfig.js +++ b/src/client/configs/sampo/PerspectiveConfig.js @@ -20,6 +20,8 @@ export const perspectiveConfig = [ id: 'perspective1', frontPageImage: manuscriptsImage, defaultActiveFacets: new Set([]), + defaultTab: 'table', + defaultInstancePageTab: 'table', tabs: [ { id: 'table', diff --git a/src/client/containers/SemanticPortal.js b/src/client/containers/SemanticPortal.js index 323ba7c5b11760d63680a9a5d3b83c9722e51629..e6d50069f2158e4876aaf6ff6b6516aec10511a7 100644 --- a/src/client/containers/SemanticPortal.js +++ b/src/client/containers/SemanticPortal.js @@ -396,7 +396,10 @@ const SemanticPortal = props => { <Switch> <Redirect from={`/${perspective.id}/page/:id`} - to={`${rootUrlWithLang}/${perspective.id}/page/:id`} + to={{ + pathname: `${rootUrlWithLang}/${perspective.id}/page/:id`, + hash: props.location.hash + }} /> <Route path={`${rootUrlWithLang}/${perspective.id}/page/:id`} diff --git a/src/client/index.js b/src/client/index.js index 3f65f304e59e2cff9659c72e4f6f1ea56218b488..fc312ff8106606af99165eb71871878c68349a10 100644 --- a/src/client/index.js +++ b/src/client/index.js @@ -27,12 +27,16 @@ if (Object.prototype.hasOwnProperty.call(availableLocales, localeFromUrl)) { } else { // support urls without a locale locale = defaultLocale + const { pathname, hash } = window.location const newPathname = updateLocaleToPathname({ - pathname: window.location.pathname, + pathname, locale, replaceOld: false }) - history.push({ pathname: newPathname }) + history.push({ + pathname: newPathname, + hash + }) } store.dispatch(loadLocales(locale))