forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change links in multi-column mode so tabs are open in single-column m…
…ode (mastodon#25893)
- Loading branch information
1 parent
9e60485
commit bdeb89b
Showing
12 changed files
with
77 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { PropsWithChildren } from 'react'; | ||
import React from 'react'; | ||
|
||
import type { History } from 'history'; | ||
import { createBrowserHistory } from 'history'; | ||
import { Router as OriginalRouter } from 'react-router'; | ||
|
||
import { layoutFromWindow } from 'mastodon/is_mobile'; | ||
|
||
const browserHistory = createBrowserHistory(); | ||
const originalPush = browserHistory.push.bind(browserHistory); | ||
|
||
browserHistory.push = (path: string, state: History.LocationState) => { | ||
if (layoutFromWindow() === 'multi-column' && !path.startsWith('/deck')) { | ||
originalPush(`/deck${path}`, state); | ||
} else { | ||
originalPush(path, state); | ||
} | ||
}; | ||
|
||
export const Router: React.FC<PropsWithChildren> = ({ children }) => { | ||
return <OriginalRouter history={browserHistory}>{children}</OriginalRouter>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
/mutes | ||
/followed_tags | ||
/statuses/(*any) | ||
/deck/(*any) | ||
).freeze | ||
|
||
root 'home#index' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters