Remove /deck prefix

This commit is contained in:
Laura Hausmann
2023-10-12 19:54:26 +02:00
parent d7254bd332
commit d35cbe4473
3 changed files with 6 additions and 15 deletions

View File

@@ -21,11 +21,7 @@ browserHistory.push = (path: string, state?: MastodonLocationState) => {
state = state ?? {};
state.fromMastodon = true;
if (layoutFromWindow() === 'multi-column' && !path.startsWith('/deck')) {
originalPush(`/deck${path}`, state);
} else {
originalPush(path, state);
}
originalPush(path, state);
};
browserHistory.replace = (path: string, state?: MastodonLocationState) => {
@@ -34,11 +30,7 @@ browserHistory.replace = (path: string, state?: MastodonLocationState) => {
state.fromMastodon = true;
}
if (layoutFromWindow() === 'multi-column' && !path.startsWith('/deck')) {
originalReplace(`/deck${path}`, state);
} else {
originalReplace(path, state);
}
originalReplace(path, state);
};
export const Router: React.FC<PropsWithChildren> = ({ children }) => {

View File

@@ -174,7 +174,7 @@ class SwitchingColumnsArea extends PureComponent {
if (singleColumn) {
redirect = <Redirect from='/' to='/home' exact />;
} else {
redirect = <Redirect from='/' to='/deck/getting-started' exact />;
redirect = <Redirect from='/' to='/getting-started' exact />;
}
} else if (singleUserMode && owner && initialState?.accounts[owner]) {
redirect = <Redirect from='/' to={`/@${initialState.accounts[owner].username}`} exact />;
@@ -189,9 +189,8 @@ class SwitchingColumnsArea extends PureComponent {
<WrappedSwitch>
{redirect}
{singleColumn ? <Redirect from='/deck' to='/home' exact /> : null}
{singleColumn && pathName.startsWith('/deck/') ? <Redirect from={pathName} to={pathName.slice(5)} /> : null}
{!singleColumn && pathName === '/getting-started' ? <Redirect from='/getting-started' to='/deck/getting-started' exact /> : null}
{singleColumn ? <Redirect from='/getting-started' to='/home' exact /> : null}
{pathName.startsWith('/deck/') ? <Redirect from={pathName} to={pathName.slice(5)} /> : null}
<WrappedRoute path='/getting-started' component={GettingStarted} content={children} />
<WrappedRoute path='/keyboard-shortcuts' component={KeyboardShortcuts} content={children} />