~cytrogen/masto-fe

d35cbe44734ec55effc6a0983e9fbb6d120ab945 — Laura Hausmann 2 years ago d7254bd
Remove /deck prefix
M app/javascript/flavours/glitch/components/router.tsx => app/javascript/flavours/glitch/components/router.tsx +2 -10
@@ 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 }) => {

M app/javascript/flavours/glitch/features/ui/index.jsx => app/javascript/flavours/glitch/features/ui/index.jsx +3 -4
@@ 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} />

M public/index.html => public/index.html +1 -1
@@ 7,7 7,7 @@
    <link rel="manifest" type="applicaton/manifest+json" href="/manifest.json" />

    <meta name="theme-color" content="#282c37" />
    <meta content='/deck/getting-started' name='initialPath' />
    <meta content='/getting-started' name='initialPath' />

    <link rel='preload' as='script' href='/packs/js/locales/glitch/en-json.js' />
    <link rel='preload' as='script' href='/packs/js/flavours/glitch/async/getting_started.js' />