Skip to content

feat(mobile): show PR badge on task list rows (port #2422)#2496

Open
Gilbert09 wants to merge 2 commits into
mainfrom
posthog-code/mobile-task-list-pr-badge
Open

feat(mobile): show PR badge on task list rows (port #2422)#2496
Gilbert09 wants to merge 2 commits into
mainfrom
posthog-code/mobile-task-list-pr-badge

Conversation

@Gilbert09
Copy link
Copy Markdown
Member

Summary

Ports desktop PR #2422 (PR badge in the sidebar task list) to the mobile app.

Mobile already showed a PR status badge on the task detail screen, but not on the task list rows. This adds a compact, tappable PR badge to each task row: when a task has a PR url (latest_run.output.pr_url), the row shows a GitPullRequest icon + #<number> in place of the timestamp, and tapping it opens the PR via Linking.openURL.

Details

  • TaskItem.tsx: new inline PrBadge (small pill consistent with mobile styling). The PR number is parsed with the existing parseGithubIssueUrl helper (@/lib/githubIssueUrl) — no new parser added, and the desktop @posthog/git parser isn't bundle-compatible (depends on the Node-only git-url-parse).
  • The badge takes the timestamp's slot when present, matching desktop.

Tests

  • TaskItem.test.tsx: badge shown when pr_url present (with correct parsed number), hidden when absent.
  • pnpm --filter @posthog/mobile test and biome check both green; tsc clean on the changed files.

Adds a compact pull-request badge to each task row in the mobile task list,
mirroring the desktop sidebar behavior (#2422). When a task has a PR url
(`latest_run.output.pr_url`), the badge shows the PR number and opens the PR
on tap, taking the timestamp's slot.

Reuses the existing `parseGithubIssueUrl` helper to extract the PR number.

Generated-By: PostHog Code
Task-Id: eb5935b3-fcab-4471-b623-693834c6017e
@Gilbert09 Gilbert09 requested a review from a team June 5, 2026 10:45
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 5, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/mobile/src/features/tasks/components/TaskItem.test.tsx:64-90
**Prefer parameterised tests for the "no badge" cases**

The team rule is to prefer parameterised tests. The single "does not show the PR badge when there is no PR url" case only exercises `latest_run: undefined`. Other no-badge paths — `output: null`, a GitHub *issue* URL (`/issues/42`), or a non-GitHub URL — are untested and aren't obviously covered by the parser's own suite. A `it.each` table would cover all of these without duplicating the assertion logic.

Reviews (1): Last reviewed commit: "feat(mobile): show PR badge on task list..." | Re-trigger Greptile

Comment on lines +64 to +90
});
return renderer;
}

describe("TaskItem", () => {
function prIcons(renderer: ReturnType<typeof create>) {
return renderer.root.findAll(
(node) => String(node.type) === "GitPullRequest",
);
}

it("shows the PR badge with the parsed number when a PR url is present", () => {
const renderer = render(
makeTask("https://github.com/PostHog/code/pull/2422"),
);

expect(prIcons(renderer)).toHaveLength(1);
const number = renderer.root.findAll(
(node) => String(node.type) === "Text" && node.props.children === "#2422",
);
expect(number).toHaveLength(1);
});

it("does not show the PR badge when there is no PR url", () => {
expect(prIcons(render(makeTask()))).toHaveLength(0);
});
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Prefer parameterised tests for the "no badge" cases

The team rule is to prefer parameterised tests. The single "does not show the PR badge when there is no PR url" case only exercises latest_run: undefined. Other no-badge paths — output: null, a GitHub issue URL (/issues/42), or a non-GitHub URL — are untested and aren't obviously covered by the parser's own suite. A it.each table would cover all of these without duplicating the assertion logic.

Context Used: Do not attempt to comment on incorrect alphabetica... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile/src/features/tasks/components/TaskItem.test.tsx
Line: 64-90

Comment:
**Prefer parameterised tests for the "no badge" cases**

The team rule is to prefer parameterised tests. The single "does not show the PR badge when there is no PR url" case only exercises `latest_run: undefined`. Other no-badge paths — `output: null`, a GitHub *issue* URL (`/issues/42`), or a non-GitHub URL — are untested and aren't obviously covered by the parser's own suite. A `it.each` table would cover all of these without duplicating the assertion logic.

**Context Used:** Do not attempt to comment on incorrect alphabetica... ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Covers the additional no-badge paths via it.each: null output, a GitHub
issue url (kind !== "pr"), and a non-GitHub url — alongside the no-run case.

Generated-By: PostHog Code
Task-Id: eb5935b3-fcab-4471-b623-693834c6017e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant