Repository navigation
feat(mobile): one-tap git pills on the thread bar #32394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
wSedlacek
wants to merge
8
commits into
pingdotgg:main
from
wSedlacek:t3/simplify-mobile-pr-creation
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c95edd2
feat(mobile): one-tap git pills on the thread bar
wSedlacek 502339d
fix(mobile): correct git pill labels and keep terminal reachable
wSedlacek bfcc28f
feat(mobile): Edit-style git pill with Safari-Back long-press menu
wSedlacek eb66a69
feat(mobile): linked PRs own the thread-bar glass pill
wSedlacek ce11359
fix(mobile): keep git pill visible on narrow iOS bars
wSedlacek b8198b9
fix(mobile): use menuActionsFromAppBarItems for confirm long-press
wSedlacek add6bb1
test(web): keep minimap next-turn resize case off the bottom on CI
wSedlacek 61e0821
fix(mobile): keep git menu reachable when the pill is disabled
wSedlacek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,12 +1,6 @@ | ||
| export function splitAndroidHeaderActions<Action extends { readonly overflowOnly?: boolean }>( | ||
| actions: ReadonlyArray<Action>, | ||
| wide: boolean, | ||
| ) { | ||
| const inline = actions.filter((action) => !action.overflowOnly); | ||
| const directCount = actions.length > 2 ? (wide ? 3 : 1) : inline.length; | ||
| const visibleActions = inline.slice(0, directCount); | ||
| return { | ||
| visibleActions, | ||
| overflowActions: actions.filter((action) => !visibleActions.includes(action)), | ||
| }; | ||
| } | ||
| export { | ||
| findHeaderMenuAction, | ||
| headerMenuActions, | ||
| headerMenuActions as androidHeaderMenuActions, | ||
| splitAndroidHeaderActions, | ||
| } from "./headerMenu"; |
This file contains hidden or 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,60 @@ | ||
| import type { MenuAction } from "@react-native-menu/menu"; | ||
| import type { AppBarMenuItem } from "./AppBar.types"; | ||
|
|
||
| export function headerMenuActions(items: ReadonlyArray<AppBarMenuItem>): MenuAction[] { | ||
| return items.flatMap((item): MenuAction[] => | ||
| "items" in item | ||
| ? item.inline && !item.title | ||
| ? headerMenuActions(item.items) | ||
| : [ | ||
| { | ||
| id: item.id, | ||
| title: item.title ?? "", | ||
| image: item.icon, | ||
| subactions: headerMenuActions(item.items), | ||
| }, | ||
| ] | ||
| : [ | ||
| { | ||
| id: item.id, | ||
| title: item.title, | ||
| subtitle: item.subtitle, | ||
| image: item.icon, | ||
| imageColor: item.iconColor, | ||
| state: item.selected ? "on" : undefined, | ||
| attributes: | ||
| item.disabled || item.destructive | ||
| ? { disabled: item.disabled, destructive: item.destructive } | ||
| : undefined, | ||
| }, | ||
| ], | ||
| ); | ||
| } | ||
|
|
||
| export function findHeaderMenuAction( | ||
| items: ReadonlyArray<AppBarMenuItem>, | ||
| id: string, | ||
| ): Extract<AppBarMenuItem, { readonly onPress: () => void }> | undefined { | ||
| for (const item of items) { | ||
| if ("items" in item) { | ||
| const action = findHeaderMenuAction(item.items, id); | ||
| if (action) return action; | ||
| } else if (item.id === id) { | ||
| return item; | ||
| } | ||
| } | ||
| return undefined; | ||
| } | ||
|
|
||
| export function splitAndroidHeaderActions<Action extends { readonly overflowOnly?: boolean }>( | ||
| actions: ReadonlyArray<Action>, | ||
| wide: boolean, | ||
| ) { | ||
| const inline = actions.filter((action) => !action.overflowOnly); | ||
| const directCount = actions.length > 2 ? (wide ? 3 : 1) : inline.length; | ||
| const visibleActions = inline.slice(0, directCount); | ||
| return { | ||
| visibleActions, | ||
| overflowActions: actions.filter((action) => !visibleActions.includes(action)), | ||
| }; | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.