-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Show compact PR number badges in mobile thread rows #3827
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
Merged
+132
−40
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import type { VcsStatusResult } from "@t3tools/contracts"; | ||
| import { resolveChangeRequestPresentation } from "@t3tools/shared/sourceControl"; | ||
|
|
||
| export type ThreadPr = NonNullable<VcsStatusResult["pr"]>; | ||
|
|
||
| export interface ThreadPrPresentation { | ||
| readonly number: number; | ||
| readonly state: ThreadPr["state"]; | ||
| readonly url: string; | ||
| /** Compact desktop-style label, e.g. "#3774". */ | ||
| readonly label: string; | ||
| /** Full, provider-aware label for assistive technologies. */ | ||
| readonly accessibilityLabel: string; | ||
| readonly textClassName: string; | ||
| } | ||
|
|
||
| const PR_STATE_TEXT_CLASS: Record<ThreadPr["state"], string> = { | ||
| open: "text-emerald-600 dark:text-emerald-400", | ||
| merged: "text-violet-600 dark:text-violet-400", | ||
| closed: "text-zinc-500 dark:text-zinc-400", | ||
| }; | ||
|
|
||
| export function presentThreadPr( | ||
| pr: ThreadPr, | ||
| provider: VcsStatusResult["sourceControlProvider"] | null | undefined, | ||
| ): ThreadPrPresentation { | ||
| const presentation = resolveChangeRequestPresentation(provider); | ||
| return { | ||
| number: pr.number, | ||
| state: pr.state, | ||
| url: pr.url, | ||
| label: `#${pr.number}`, | ||
| accessibilityLabel: `#${pr.number} ${presentation.longName} ${pr.state}`, | ||
| textClassName: PR_STATE_TEXT_CLASS[pr.state], | ||
| }; | ||
| } |
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,36 @@ | ||
| import type { VcsStatusResult } from "@t3tools/contracts"; | ||
| import { describe, expect, it } from "vite-plus/test"; | ||
|
|
||
| import { presentThreadPr } from "./thread-pr-presentation"; | ||
|
|
||
| const pullRequest: NonNullable<VcsStatusResult["pr"]> = { | ||
| number: 3774, | ||
| title: "Desktop-style pull request indicator", | ||
| url: "https://github.com/t3tools/t3code/pull/3774", | ||
| baseRef: "main", | ||
| headRef: "codex/desktop-style-pr-indicator", | ||
| state: "merged", | ||
| }; | ||
|
|
||
| describe("presentThreadPr", () => { | ||
| it("uses the compact desktop-style pull request number label", () => { | ||
| expect(presentThreadPr(pullRequest, undefined)).toMatchObject({ | ||
| label: "#3774", | ||
| accessibilityLabel: "#3774 pull request merged", | ||
| textClassName: "text-violet-600 dark:text-violet-400", | ||
| }); | ||
| }); | ||
|
|
||
| it("uses merge-request terminology for GitLab", () => { | ||
| expect( | ||
| presentThreadPr(pullRequest, { | ||
| kind: "gitlab", | ||
| name: "GitLab", | ||
| baseUrl: "https://gitlab.com", | ||
| }), | ||
| ).toMatchObject({ | ||
| label: "#3774", | ||
| accessibilityLabel: "#3774 merge request merged", | ||
| }); | ||
| }); | ||
| }); |
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium
threads/thread-list-items.tsx:519The PR badge
Viewat line 520 setsaccessibilityLabelbut is not an accessibility element — in React Native aViewwithoutaccessible={true}is not exposed to VoiceOver/TalkBack, and itsaccessibilityLabelis ignored. Since the parentPressablealready announces the thread title, the PR status is never read to screen-reader users. Consider addingaccessibleandaccessibilityRole="text"to theViewso the PR information is exposed as a separate element, or fold the PR label into the parent'saccessibilityLabel.🚀 Reply "fix it for me" or copy this AI Prompt for your agent: