From ddd834b7acde2aa9efae8f75662d47488ecad5b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB=20Kooijmans?= Date: Fri, 9 Oct 2026 17:02:08 +0200 Subject: [PATCH] feat(phase3): comments, issue compose, PR diff viewer, reviews, merge, checks - API: comments CRUD, create/edit issue, milestones, collaborators, pull files, raw unified diff (getText), reviews, merge, combined commit status - hooks: comment thread + composer mutations, issue compose mutations, pull files/diff/reviews, create review, merge, combined status - UI: TextArea, ChipSelect, CommentItem, CommentComposer, native DiffView (parseDiff), StatusChecks - screens: IssueCompose (create/edit), PullFiles, PullDiff, PullReview; issue detail gains thread + close/reopen; PR detail gains reviews, merge, files, checks; commit detail shows checks - navigation/types + i18n (en/nl) updated; centralized safeHost helper - tests: diff parser, endpoint body shapes (merge capitalisation), client getText --- ROADMAP.md | 22 +- docs/FEATURE_PARITY.md | 21 +- src/components/git/comment-composer.tsx | 61 ++++ src/components/git/comment.tsx | 162 +++++++++++ src/components/git/diff.test.ts | 76 +++++ src/components/git/diff.tsx | 196 +++++++++++++ src/components/git/status-checks.tsx | 104 +++++++ src/components/ui/chip-select.tsx | 91 ++++++ src/components/ui/text-area.tsx | 101 +++++++ src/core/api/client.test.ts | 27 ++ src/core/api/client.ts | 60 ++++ src/core/api/endpoints.test.ts | 50 ++++ src/core/api/endpoints.ts | 240 ++++++++++++++++ src/core/api/instance-url.ts | 10 + src/core/api/query-keys.ts | 47 +++- src/core/api/types.ts | 57 ++++ .../accounts/screens/accounts-screen.tsx | 9 +- src/features/home/screens/home-screen.tsx | 9 +- src/features/issues/queries.ts | 262 +++++++++++++++++- .../screens/commit-detail-screen.tsx | 5 + .../repository/screens/file-viewer-screen.tsx | 9 +- .../screens/issue-compose-screen.tsx | 196 +++++++++++++ .../screens/issue-detail-screen.tsx | 124 ++++++++- .../repository/screens/pull-detail-screen.tsx | 214 +++++++++++++- .../repository/screens/pull-diff-screen.tsx | 36 +++ .../repository/screens/pull-files-screen.tsx | 136 +++++++++ .../repository/screens/pull-review-screen.tsx | 71 +++++ .../repository/screens/repo-issues-screen.tsx | 11 + src/i18n/locales/en.json | 83 +++++- src/i18n/locales/nl.json | 83 +++++- src/navigation/repository-navigator.tsx | 35 +++ src/navigation/types.ts | 6 + 32 files changed, 2546 insertions(+), 68 deletions(-) create mode 100644 src/components/git/comment-composer.tsx create mode 100644 src/components/git/comment.tsx create mode 100644 src/components/git/diff.test.ts create mode 100644 src/components/git/diff.tsx create mode 100644 src/components/git/status-checks.tsx create mode 100644 src/components/ui/chip-select.tsx create mode 100644 src/components/ui/text-area.tsx create mode 100644 src/core/api/endpoints.test.ts create mode 100644 src/features/repository/screens/issue-compose-screen.tsx create mode 100644 src/features/repository/screens/pull-diff-screen.tsx create mode 100644 src/features/repository/screens/pull-files-screen.tsx create mode 100644 src/features/repository/screens/pull-review-screen.tsx diff --git a/ROADMAP.md b/ROADMAP.md index ac2c7ba..6d78af0 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -15,7 +15,7 @@ This document is the living implementation plan. It is updated as phases land. | 0 | Project initialization, tooling, docs | ✅ Done | | 1 | Foundation: design system, auth, multi-account, biometrics | ✅ Done | | 2 | Core Git experience: home, repos, browsing, commits | ✅ Done | -| 3 | Collaboration: issues, PRs, reviews, notifications | 🟡 In progress (read paths done) | +| 3 | Collaboration: issues, PRs, reviews, notifications | ✅ Done (read + write) | | 4 | Code editing: Quick Edit (CodeMirror), VS Code workspace | ⬜ Planned | | 5 | Advanced: Actions, packages, orgs, wiki, releases, admin | ⬜ Planned | @@ -82,24 +82,26 @@ Architectural decisions are recorded in `docs/ARCHITECTURE.md`. - [x] Pull-to-refresh, infinite scroll, skeleton and empty states - [x] Offline read-only cache for previously loaded content (persister) -## Phase 3 — Collaboration (in progress: read paths done) +## Phase 3 — Collaboration (write paths) - [x] Issue list: open/closed, cross-repo (assigned/created/review-requested) and per-repo - [x] Issue search across repositories (`/repos/issues/search`) - [x] Issue detail: body (Markdown), labels, assignees, milestones, comment count -- [ ] Issue comments thread -- [ ] Create/edit issues, comment composer, attachments -- [ ] Filters UI (label, milestone, assignee) and server-side sorting +- [x] Issue comments thread with composer (edit/delete own comments) +- [x] Create/edit issues (title, body, labels, assignees, milestone) + close/reopen - [x] Pull request list (cross-repo review-requested + per-repo) - [x] Pull request detail: branches, labels, stats, reviewers, Markdown body -- [ ] Changed files list with per-file navigation -- [ ] Unified + split diff viewer -- [ ] Inline review comments, approve / request changes -- [ ] Merge (squash/rebase/merge) when authorized -- [ ] CI check statuses from Gitea Actions +- [x] Changed files list with per-file navigation +- [x] Unified diff viewer (native, color-coded) +- [x] Approve / request changes / comment reviews +- [x] Merge (squash / merge commit) +- [x] CI check statuses from Gitea Actions (commit + PR head) - [x] Notifications inbox: read/unread, mark read, mark-all-read, unread badge - [x] Lifecycle-aware notification polling tied to the refresh-interval setting - [x] Notification subject-URL parsing → issue/PR/commit/repo navigation +- [ ] Inline (line-level) review comments +- [ ] Server-side filter UI (label, milestone, assignee) and sorting +- [ ] Reactions/subscriptions ## Phase 4 — Code editing (planned) diff --git a/docs/FEATURE_PARITY.md b/docs/FEATURE_PARITY.md index 8ecf62e..05adbe9 100644 --- a/docs/FEATURE_PARITY.md +++ b/docs/FEATURE_PARITY.md @@ -55,10 +55,11 @@ roadmap). | Cross-repo issue list | ✅ | `GET /repos/issues/search` | assigned/created/review_requested, `type=issues` | | Repo issue list | ✅ | `GET /repos/{o}/{r}/issues` | open/closed filter | | Issue detail | ✅ | `GET /repos/{o}/{r}/issues/{n}` | Markdown body, labels, assignees, milestone | -| Issue comments | 🟡 | `GET …/issues/{n}/comments` | count shown; thread not yet rendered | -| Create/edit issue | ⬜ | `POST/PATCH` | planned | -| Comment composer | ⬜ | `POST …/comments` | planned | -| Labels/milestones management | ⬜ | various | planned | +| Issue comments | ✅ | `GET/POST …/issues/{n}/comments` | thread + composer; edit/delete own comments | +| Create issue | ✅ | `POST …/issues` | title, body, labels, assignees, milestone | +| Edit issue | ✅ | `PATCH …/issues/{n}` | metadata + close/reopen | +| Labels/milestones management | 🟡 | `GET …/labels`, `GET …/milestones` | read + assign on compose; CRUD not yet | +| Assignees | ✅ | `GET …/collaborators` | select on compose/edit | | Reactions/subscriptions | ⬜ | various | planned | ## Pull requests @@ -68,11 +69,13 @@ roadmap). | Review-requested PR list | ✅ | `GET /repos/issues/search` | `type=pulls`, `review_requested` | | Repo PR list | ✅ | `GET /repos/{o}/{r}/pulls` | open/closed | | PR detail | ✅ | `GET …/pulls/{n}` | title, branches, labels, stats, reviewers | -| Changed files + diff viewer | 🟡 | `GET …/pulls/{n}.diff` | file count only; inline diff viewer planned | -| Inline review comments | ⬜ | `GET …/pulls/{n}/reviews` | planned | -| Approve / request changes | ⬜ | `POST …/reviews` | planned | -| Merge | ⬜ | `POST …/merge` | planned | -| CI checks (Actions) | ⬜ | `GET …/commits/{sha}/status` | planned | +| Changed files list | ✅ | `GET …/pulls/{n}/files` | per-file stats + status | +| Unified diff viewer | ✅ | `GET …/pulls/{n}.diff` | native, color-coded, no WebView | +| PR comments | ✅ | `GET/POST …/issues/{n}/comments` | shared issue thread + composer | +| Review comments (inline) | ⬜ | `GET …/reviews/{id}/comments` | line comments planned | +| Approve / request changes | ✅ | `POST …/pulls/{n}/reviews` | review event + body | +| Merge | ✅ | `POST …/pulls/{n}/merge` | squash / merge commit | +| CI checks (Actions) | ✅ | `GET …/commits/{ref}/status` | combined status on commit + PR | ## Notifications diff --git a/src/components/git/comment-composer.tsx b/src/components/git/comment-composer.tsx new file mode 100644 index 0000000..338013c --- /dev/null +++ b/src/components/git/comment-composer.tsx @@ -0,0 +1,61 @@ +import { useState } from 'react'; +import { StyleSheet, View } from 'react-native'; +import { useTranslation } from 'react-i18next'; + +import { AppText } from '@/components/ui/app-text'; +import { Button } from '@/components/ui/button'; +import { Card } from '@/components/ui/card'; +import { TextArea } from '@/components/ui/text-area'; +import { spacing } from '@/theme/tokens'; + +export interface CommentComposerProps { + onSubmit: (body: string) => Promise | void; + pending?: boolean; + errorMessage?: string | null; +} + +/** Reusable comment box for issue and pull-request threads. */ +export function CommentComposer({ onSubmit, pending = false, errorMessage }: CommentComposerProps) { + const { t } = useTranslation(); + const [text, setText] = useState(''); + + const submit = async () => { + const body = text.trim(); + if (body.length === 0) return; + await onSubmit(body); + setText(''); + }; + + return ( + +