feat(phase5): star/watch/fork, releases, wiki fallback, capability probe
- endpoints: is-starred (404→false), star/unstar, subscription watch/unwatch, fork, releases list/detail - hooks: useIsStarred/useToggleStar, useSubscription/useToggleWatch, useForkRepository, useReleases/useRelease - repo overview: star/watch/fork actions, Releases + Wiki entries (wiki via explicit browser fallback gated by capability probe) - screens: Releases list, Release detail with downloadable assets - core/capabilities: version parsing + per-capability minimum versions + tests - i18n (en/nl); README/ROADMAP/FEATURE_PARITY updated for phases 3-5
This commit is contained in:
1 parent
c9dd49446a
commit
5e8c9492b3
16 files changed
+769
-24
No files matched your search
@@ -32,6 +32,14 @@ covers the read-heavy Git workflow:
|
|||||||
- **Issues & pull requests**: cross-repository lists (assigned, created,
|
- **Issues & pull requests**: cross-repository lists (assigned, created,
|
||||||
review-requested), per-repository lists, and detail screens with Markdown
|
review-requested), per-repository lists, and detail screens with Markdown
|
||||||
bodies, labels, assignees, milestones and reviewers.
|
bodies, labels, assignees, milestones and reviewers.
|
||||||
|
- **Collaboration**: comment threads with compose/edit/delete, create and edit
|
||||||
|
issues, approve / request-changes / comment reviews, merge (squash or merge
|
||||||
|
commit), a native unified diff viewer, and CI check statuses.
|
||||||
|
- **Quick Edit**: edit a file in-app and commit it through the Contents API —
|
||||||
|
to a branch or a new branch (protected branches are handled), optionally
|
||||||
|
opening a pull request in the same step.
|
||||||
|
- **Repository actions**: star/unstar, watch/unwatch, fork, plus releases and
|
||||||
|
assets, and a configurable "Open in editor" action.
|
||||||
- **Notification inbox**: unread/all filters, mark-as-read, mark-all-read, and
|
- **Notification inbox**: unread/all filters, mark-as-read, mark-all-read, and
|
||||||
life-cycle-aware polling.
|
life-cycle-aware polling.
|
||||||
- **English & Dutch**, light/dark/system theme, accessible touch targets and
|
- **English & Dutch**, light/dark/system theme, accessible touch targets and
|
||||||
@@ -172,20 +180,22 @@ state/data-flow, API client and account-registry design.
|
|||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
See [`ROADMAP.md`](ROADMAP.md). Phases 0–2 are complete; Phase 3
|
See [`ROADMAP.md`](ROADMAP.md). Phases 0–4 are complete; Phase 5 (advanced) is
|
||||||
(collaboration) is partially implemented (read paths) and the write paths
|
in progress — stars, watches, forks, releases, wiki and a capability probe are
|
||||||
(comments, reviews, merges, diffs) are planned.
|
in, while orgs, Actions, packages and admin screens are planned.
|
||||||
|
|
||||||
## Known limitations
|
## Known limitations
|
||||||
|
|
||||||
- Read-only collaboration: you can view issues, pull requests and
|
- The in-app editor is a native monospace field; syntax highlighting and
|
||||||
notifications, but cannot yet create comments, review, or merge from the app.
|
search/replace (CodeMirror in a WebView) are planned.
|
||||||
- The commit view lists changed files; an inline unified/split diff viewer is
|
- Pull-request review comments are at the PR level; line-level (inline) review
|
||||||
planned.
|
comments are planned.
|
||||||
|
- Gitea Actions, packages, organizations and admin screens are not built yet.
|
||||||
- Gitea's REST API exposes no total count for some endpoints, so infinite
|
- Gitea's REST API exposes no total count for some endpoints, so infinite
|
||||||
scroll falls back to a page-length heuristic.
|
scroll falls back to a page-length heuristic.
|
||||||
- Features that are unavailable or disabled on a given instance degrade to a
|
- Features that are unavailable or disabled on a given instance degrade to a
|
||||||
clear empty/error state; a browser fallback is planned but not yet wired.
|
clear empty/error state, or open in the browser where that is the only path
|
||||||
|
(wiki). A version-based capability probe gates features without a server flag.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
+9
-7
@@ -17,7 +17,7 @@ This document is the living implementation plan. It is updated as phases land.
|
|||||||
| 2 | Core Git experience: home, repos, browsing, commits | ✅ Done |
|
| 2 | Core Git experience: home, repos, browsing, commits | ✅ Done |
|
||||||
| 3 | Collaboration: issues, PRs, reviews, notifications | ✅ Done (read + write) |
|
| 3 | Collaboration: issues, PRs, reviews, notifications | ✅ Done (read + write) |
|
||||||
| 4 | Code editing: Quick Edit, commit flow, editor workspace | ✅ Done (native editor) |
|
| 4 | Code editing: Quick Edit, commit flow, editor workspace | ✅ Done (native editor) |
|
||||||
| 5 | Advanced: Actions, packages, orgs, wiki, releases, admin | ⬜ Planned |
|
| 5 | Advanced: Actions, packages, orgs, wiki, releases, admin | 🟡 In progress |
|
||||||
|
|
||||||
Detailed acceptance criteria per phase are in `docs/FEATURE_PARITY.md`.
|
Detailed acceptance criteria per phase are in `docs/FEATURE_PARITY.md`.
|
||||||
Architectural decisions are recorded in `docs/ARCHITECTURE.md`.
|
Architectural decisions are recorded in `docs/ARCHITECTURE.md`.
|
||||||
@@ -117,18 +117,20 @@ Architectural decisions are recorded in `docs/ARCHITECTURE.md`.
|
|||||||
- [ ] CodeMirror 6 editor in a WebView (syntax highlighting, search/replace)
|
- [ ] CodeMirror 6 editor in a WebView (syntax highlighting, search/replace)
|
||||||
- [ ] Line-level diff preview before committing
|
- [ ] Line-level diff preview before committing
|
||||||
|
|
||||||
## Phase 5 — Advanced features (planned)
|
## Phase 5 — Advanced features (in progress)
|
||||||
|
|
||||||
|
- [x] Star / unstar and watch / unwatch repositories
|
||||||
|
- [x] Fork a repository
|
||||||
|
- [x] Releases list and detail with downloadable assets
|
||||||
|
- [x] Wiki entry with an explicit browser fallback (never silent)
|
||||||
|
- [x] Instance capability service (version parsing + feature gating) with tests
|
||||||
- [ ] Repository create/edit/delete, settings, collaborators, webhooks, deploy keys
|
- [ ] Repository create/edit/delete, settings, collaborators, webhooks, deploy keys
|
||||||
- [ ] Protected branches, releases, assets, forks
|
- [ ] Protected-branch management, release management, asset upload
|
||||||
- [ ] Wiki, projects, organizations, teams, permissions
|
- [ ] Organizations, teams, projects, permissions
|
||||||
- [ ] Gitea Actions: workflows, runs, jobs, logs, artifacts, reruns
|
- [ ] Gitea Actions: workflows, runs, jobs, logs, artifacts, reruns
|
||||||
- [ ] Package registries
|
- [ ] Package registries
|
||||||
- [ ] User settings: SSH/GPG keys, tokens, profile
|
- [ ] User settings: SSH/GPG keys, tokens, profile
|
||||||
- [ ] Administration screens where instance permissions allow
|
- [ ] Administration screens where instance permissions allow
|
||||||
- [ ] Instance capability service (version, endpoint probing, tri-state: supported /
|
|
||||||
unsupported / disabled / unauthorized / unknown) + graceful degradation
|
|
||||||
- [ ] Browser fallback for API-unavailable features (explicit, never silent)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+12
-6
@@ -115,15 +115,21 @@ roadmap).
|
|||||||
| VS Code / editor workspace | ✅ | configurable URL template, no token passthrough |
|
| VS Code / editor workspace | ✅ | configurable URL template, no token passthrough |
|
||||||
| Syntax highlighting / search-replace | ⬜ | planned (CodeMirror 6 in a WebView) |
|
| Syntax highlighting / search-replace | ⬜ | planned (CodeMirror 6 in a WebView) |
|
||||||
|
|
||||||
## Advanced (planned)
|
## Advanced (partially implemented)
|
||||||
|
|
||||||
| Feature | Status |
|
| Feature | Status |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| Repo create/edit/settings/webhooks | ⬜ |
|
| Star / unstar repository | ✅ |
|
||||||
| Protected branches / releases / forks | ⬜ |
|
| Watch / unwatch repository | ✅ |
|
||||||
| Wiki / projects / orgs / teams | ⬜ |
|
| Fork repository | ✅ |
|
||||||
| Gitea Actions (runs, jobs, logs) | ⬜ |
|
| Releases list + detail (with assets) | ✅ |
|
||||||
|
| Wiki (explicit browser fallback) | ✅ |
|
||||||
|
| Instance capability probe (version-gated) | ✅ |
|
||||||
|
| Repo create/edit/delete/settings/webhooks | ⬜ |
|
||||||
|
| Protected branch management | ⬜ |
|
||||||
|
| Release management (create/edit/upload) | ⬜ |
|
||||||
|
| Organizations / teams / projects | ⬜ |
|
||||||
|
| Gitea Actions (runs, jobs, logs, artifacts) | ⬜ |
|
||||||
| Package registries | ⬜ |
|
| Package registries | ⬜ |
|
||||||
| User settings (SSH/GPG keys, tokens) | ⬜ |
|
| User settings (SSH/GPG keys, tokens) | ⬜ |
|
||||||
| Admin screens | ⬜ |
|
| Admin screens | ⬜ |
|
||||||
| Capability probe + browser fallback | 🌐 |
|
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
* Gitea instances at `/swagger.v1.json`.
|
* Gitea instances at `/swagger.v1.json`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { ApiError } from './errors';
|
||||||
import type { GiteaClient, RequestOptions } from './client';
|
import type { GiteaClient, RequestOptions } from './client';
|
||||||
import type {
|
import type {
|
||||||
Activity,
|
Activity,
|
||||||
@@ -25,9 +26,11 @@ import type {
|
|||||||
NotificationThread,
|
NotificationThread,
|
||||||
PullRequest,
|
PullRequest,
|
||||||
PullReview,
|
PullReview,
|
||||||
|
Release,
|
||||||
Repository,
|
Repository,
|
||||||
ReviewEvent,
|
ReviewEvent,
|
||||||
ServerVersion,
|
ServerVersion,
|
||||||
|
Subscription,
|
||||||
Tag,
|
Tag,
|
||||||
User,
|
User,
|
||||||
} from './types';
|
} from './types';
|
||||||
@@ -145,6 +148,108 @@ export function fetchRepositoryLanguages(
|
|||||||
return client.get<Record<string, number>>(`${repoPath(owner, repo)}/languages`, options);
|
return client.get<Record<string, number>>(`${repoPath(owner, repo)}/languages`, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- repository actions (star / watch / fork) ------------------------------
|
||||||
|
|
||||||
|
/** `true` when the authenticated user has starred the repository (404 → false). */
|
||||||
|
export async function fetchIsStarred(
|
||||||
|
client: GiteaClient,
|
||||||
|
owner: string,
|
||||||
|
repo: string,
|
||||||
|
options?: RequestOptions,
|
||||||
|
): Promise<boolean> {
|
||||||
|
try {
|
||||||
|
await client.get<void>(`/user/starred/${enc(owner)}/${enc(repo)}`, options);
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof ApiError && error.kind === 'not-found') return false;
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function starRepo(client: GiteaClient, owner: string, repo: string, options?: RequestOptions) {
|
||||||
|
return client.put<void>(`/user/starred/${enc(owner)}/${enc(repo)}`, undefined, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function unstarRepo(
|
||||||
|
client: GiteaClient,
|
||||||
|
owner: string,
|
||||||
|
repo: string,
|
||||||
|
options?: RequestOptions,
|
||||||
|
) {
|
||||||
|
return client.delete<void>(`/user/starred/${enc(owner)}/${enc(repo)}`, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fetchSubscription(
|
||||||
|
client: GiteaClient,
|
||||||
|
owner: string,
|
||||||
|
repo: string,
|
||||||
|
options?: RequestOptions,
|
||||||
|
): Promise<Subscription> {
|
||||||
|
return client.get<Subscription>(`${repoPath(owner, repo)}/subscription`, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function watchRepo(
|
||||||
|
client: GiteaClient,
|
||||||
|
owner: string,
|
||||||
|
repo: string,
|
||||||
|
options?: RequestOptions,
|
||||||
|
): Promise<Subscription> {
|
||||||
|
return client.put<Subscription>(
|
||||||
|
`${repoPath(owner, repo)}/subscription`,
|
||||||
|
{ subscribed: true, ignored: false },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function unwatchRepo(
|
||||||
|
client: GiteaClient,
|
||||||
|
owner: string,
|
||||||
|
repo: string,
|
||||||
|
options?: RequestOptions,
|
||||||
|
) {
|
||||||
|
return client.delete<void>(`${repoPath(owner, repo)}/subscription`, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ForkRepoInput {
|
||||||
|
name?: string;
|
||||||
|
organization?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function forkRepository(
|
||||||
|
client: GiteaClient,
|
||||||
|
owner: string,
|
||||||
|
repo: string,
|
||||||
|
input: ForkRepoInput = {},
|
||||||
|
options?: RequestOptions,
|
||||||
|
): Promise<Repository> {
|
||||||
|
return client.post<Repository>(`${repoPath(owner, repo)}/forks`, input, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- releases --------------------------------------------------------------
|
||||||
|
|
||||||
|
export function listReleases(
|
||||||
|
client: GiteaClient,
|
||||||
|
owner: string,
|
||||||
|
repo: string,
|
||||||
|
params: PageParams = {},
|
||||||
|
options?: RequestOptions,
|
||||||
|
) {
|
||||||
|
return client.raw<Release[]>(`${repoPath(owner, repo)}/releases`, {
|
||||||
|
...options,
|
||||||
|
query: { page: params.page ?? 1, limit: params.limit ?? 20 },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fetchRelease(
|
||||||
|
client: GiteaClient,
|
||||||
|
owner: string,
|
||||||
|
repo: string,
|
||||||
|
id: number,
|
||||||
|
options?: RequestOptions,
|
||||||
|
): Promise<Release> {
|
||||||
|
return client.get<Release>(`${repoPath(owner, repo)}/releases/${id}`, options);
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Contents, README, branches, tags
|
// Contents, README, branches, tags
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -44,6 +44,18 @@ export const queryKeys = {
|
|||||||
repoLanguages: (accountId: string, owner: string, name: string) =>
|
repoLanguages: (accountId: string, owner: string, name: string) =>
|
||||||
[...queryKeys.repo(accountId, owner, name), 'languages'] as const,
|
[...queryKeys.repo(accountId, owner, name), 'languages'] as const,
|
||||||
|
|
||||||
|
repoStar: (accountId: string, owner: string, name: string) =>
|
||||||
|
[...queryKeys.repo(accountId, owner, name), 'star'] as const,
|
||||||
|
|
||||||
|
repoSubscription: (accountId: string, owner: string, name: string) =>
|
||||||
|
[...queryKeys.repo(accountId, owner, name), 'subscription'] as const,
|
||||||
|
|
||||||
|
releases: (accountId: string, owner: string, name: string, params: Record<string, unknown>) =>
|
||||||
|
[...queryKeys.repo(accountId, owner, name), 'releases', params] as const,
|
||||||
|
|
||||||
|
release: (accountId: string, owner: string, name: string, id: number) =>
|
||||||
|
[...queryKeys.repo(accountId, owner, name), 'release', id] as const,
|
||||||
|
|
||||||
contents: (accountId: string, owner: string, name: string, path: string, ref?: string) =>
|
contents: (accountId: string, owner: string, name: string, path: string, ref?: string) =>
|
||||||
[...queryKeys.repo(accountId, owner, name), 'contents', { path, ref }] as const,
|
[...queryKeys.repo(accountId, owner, name), 'contents', { path, ref }] as const,
|
||||||
|
|
||||||
|
|||||||
@@ -349,6 +349,39 @@ export interface ServerVersion {
|
|||||||
version: string;
|
version: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A release asset (downloadable file). */
|
||||||
|
export interface ReleaseAsset {
|
||||||
|
id?: number;
|
||||||
|
name?: string;
|
||||||
|
size?: number;
|
||||||
|
download_count?: number;
|
||||||
|
browser_download_url?: string;
|
||||||
|
created_at?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Release {
|
||||||
|
id?: number;
|
||||||
|
tag_name?: string;
|
||||||
|
target_commitish?: string;
|
||||||
|
name?: string;
|
||||||
|
body?: string;
|
||||||
|
draft?: boolean;
|
||||||
|
prerelease?: boolean;
|
||||||
|
author?: User;
|
||||||
|
created_at?: string;
|
||||||
|
published_at?: string;
|
||||||
|
html_url?: string;
|
||||||
|
tarball_url?: string;
|
||||||
|
zipball_url?: string;
|
||||||
|
assets?: ReleaseAsset[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Repository watch subscription state. */
|
||||||
|
export interface Subscription {
|
||||||
|
subscribed?: boolean;
|
||||||
|
ignored?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Activity {
|
export interface Activity {
|
||||||
id?: number;
|
id?: number;
|
||||||
user_id?: number;
|
user_id?: number;
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/** Instance capability detection (version parsing + feature gating). */
|
||||||
|
|
||||||
|
import { atLeast, parseGiteaVersion, supports } from './index';
|
||||||
|
|
||||||
|
describe('parseGiteaVersion', () => {
|
||||||
|
it('parses plain versions', () => {
|
||||||
|
expect(parseGiteaVersion('1.21.4')).toEqual({ major: 1, minor: 21, patch: 4, raw: '1.21.4' });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('tolerates suffixes and a leading v', () => {
|
||||||
|
expect(parseGiteaVersion('v1.22.0+rc1')?.minor).toBe(22);
|
||||||
|
expect(parseGiteaVersion('1.19.3-rc2')?.patch).toBe(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('defaults a missing patch to 0', () => {
|
||||||
|
expect(parseGiteaVersion('1.21')?.patch).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns null for empty or invalid input', () => {
|
||||||
|
expect(parseGiteaVersion(undefined)).toBeNull();
|
||||||
|
expect(parseGiteaVersion('')).toBeNull();
|
||||||
|
expect(parseGiteaVersion('development')).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('atLeast', () => {
|
||||||
|
const v = parseGiteaVersion('1.21.4');
|
||||||
|
|
||||||
|
it('compares major/minor/patch correctly', () => {
|
||||||
|
expect(atLeast(v, 1, 21, 4)).toBe(true);
|
||||||
|
expect(atLeast(v, 1, 21, 5)).toBe(false);
|
||||||
|
expect(atLeast(v, 1, 22, 0)).toBe(false);
|
||||||
|
expect(atLeast(v, 2, 0, 0)).toBe(false);
|
||||||
|
expect(atLeast(v, 1, 20, 0)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('treats an unknown version as too old', () => {
|
||||||
|
expect(atLeast(null, 1, 0, 0)).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('supports', () => {
|
||||||
|
it('gates Actions on Gitea 1.19+', () => {
|
||||||
|
expect(supports('actions', parseGiteaVersion('1.18.5'))).toBe(false);
|
||||||
|
expect(supports('actions', parseGiteaVersion('1.19.0'))).toBe(true);
|
||||||
|
expect(supports('actions', parseGiteaVersion('1.24.1'))).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('treats releases and wiki as widely available', () => {
|
||||||
|
expect(supports('releases', parseGiteaVersion('1.9.0'))).toBe(true);
|
||||||
|
expect(supports('wiki', parseGiteaVersion('1.0.0'))).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('is conservative for unknown instances', () => {
|
||||||
|
expect(supports('packages', null)).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/**
|
||||||
|
* Instance capability detection.
|
||||||
|
*
|
||||||
|
* Gitea feature availability varies by version and by instance config. Where an
|
||||||
|
* API exposes a per-repository flag (e.g. `has_actions`) we prefer that; this
|
||||||
|
* module fills the gaps for capabilities that have no flag by comparing the
|
||||||
|
* server version reported at `/version`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface GiteaVersion {
|
||||||
|
major: number;
|
||||||
|
minor: number;
|
||||||
|
patch: number;
|
||||||
|
raw: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Parses `1.21.0`, `1.22.0+rc1`, `1.19.3-rc1` … Returns null when unparseable. */
|
||||||
|
export function parseGiteaVersion(raw: string | null | undefined): GiteaVersion | null {
|
||||||
|
if (!raw) return null;
|
||||||
|
const match = raw.match(/(\d+)\.(\d+)(?:\.(\d+))?/);
|
||||||
|
if (!match) return null;
|
||||||
|
return {
|
||||||
|
major: Number(match[1]),
|
||||||
|
minor: Number(match[2]),
|
||||||
|
patch: Number(match[3] ?? 0),
|
||||||
|
raw,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** True when `version >= major.minor.patch`. Unknown versions are treated as unsupported. */
|
||||||
|
export function atLeast(
|
||||||
|
version: GiteaVersion | null,
|
||||||
|
major: number,
|
||||||
|
minor = 0,
|
||||||
|
patch = 0,
|
||||||
|
): boolean {
|
||||||
|
if (!version) return false;
|
||||||
|
if (version.major !== major) return version.major > major;
|
||||||
|
if (version.minor !== minor) return version.minor > minor;
|
||||||
|
return version.patch >= patch;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Capability = 'releases' | 'wiki' | 'projects' | 'packages' | 'actions';
|
||||||
|
|
||||||
|
/** First Gitea release that shipped each capability. */
|
||||||
|
export const CAPABILITY_SINCE: Record<Capability, [number, number, number]> = {
|
||||||
|
wiki: [1, 0, 0],
|
||||||
|
releases: [1, 9, 0],
|
||||||
|
projects: [1, 12, 0],
|
||||||
|
packages: [1, 14, 0],
|
||||||
|
actions: [1, 19, 0],
|
||||||
|
};
|
||||||
|
|
||||||
|
export function supports(capability: Capability, version: GiteaVersion | null): boolean {
|
||||||
|
const [major, minor, patch] = CAPABILITY_SINCE[capability];
|
||||||
|
return atLeast(version, major, minor, patch);
|
||||||
|
}
|
||||||
@@ -7,23 +7,35 @@
|
|||||||
import {
|
import {
|
||||||
keepPreviousData,
|
keepPreviousData,
|
||||||
useInfiniteQuery,
|
useInfiniteQuery,
|
||||||
|
useMutation,
|
||||||
useQuery,
|
useQuery,
|
||||||
|
useQueryClient,
|
||||||
type InfiniteData,
|
type InfiniteData,
|
||||||
} from '@tanstack/react-query';
|
} from '@tanstack/react-query';
|
||||||
|
|
||||||
import { useSession } from '@/features/accounts/use-session';
|
import { useSession } from '@/features/accounts/use-session';
|
||||||
import {
|
import {
|
||||||
|
fetchIsStarred,
|
||||||
|
fetchRelease,
|
||||||
fetchRepository,
|
fetchRepository,
|
||||||
fetchRepositoryLanguages,
|
fetchRepositoryLanguages,
|
||||||
|
fetchSubscription,
|
||||||
|
forkRepository,
|
||||||
listMyRepos,
|
listMyRepos,
|
||||||
|
listReleases,
|
||||||
listStarredRepos,
|
listStarredRepos,
|
||||||
searchRepositories,
|
searchRepositories,
|
||||||
|
starRepo,
|
||||||
|
unstarRepo,
|
||||||
|
unwatchRepo,
|
||||||
|
watchRepo,
|
||||||
|
type ForkRepoInput,
|
||||||
type ListMyReposParams,
|
type ListMyReposParams,
|
||||||
type SearchReposParams,
|
type SearchReposParams,
|
||||||
} from '@/core/api/endpoints';
|
} from '@/core/api/endpoints';
|
||||||
import type { RawResponse } from '@/core/api/client';
|
import type { RawResponse } from '@/core/api/client';
|
||||||
import { queryKeys } from '@/core/api/query-keys';
|
import { queryKeys } from '@/core/api/query-keys';
|
||||||
import type { Repository } from '@/core/api/types';
|
import type { Release, Repository, Subscription } from '@/core/api/types';
|
||||||
|
|
||||||
type RepoPage = RawResponse<Repository[]>;
|
type RepoPage = RawResponse<Repository[]>;
|
||||||
|
|
||||||
@@ -107,3 +119,120 @@ export function useRepositoryLanguages(owner: string, name: string) {
|
|||||||
queryFn: ({ signal }) => fetchRepositoryLanguages(client!, owner, name, { signal }),
|
queryFn: ({ signal }) => fetchRepositoryLanguages(client!, owner, name, { signal }),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Star / watch / fork
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export function useIsStarred(owner: string, name: string) {
|
||||||
|
const { client, account } = useSession();
|
||||||
|
const accountId = account?.id ?? '';
|
||||||
|
|
||||||
|
return useQuery<boolean>({
|
||||||
|
queryKey: queryKeys.repoStar(accountId, owner, name),
|
||||||
|
enabled: Boolean(client) && Boolean(accountId) && owner.length > 0,
|
||||||
|
queryFn: ({ signal }) => fetchIsStarred(client!, owner, name, { signal }),
|
||||||
|
staleTime: 60_000,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useToggleStar(owner: string, name: string) {
|
||||||
|
const { client, account } = useSession();
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
const accountId = account?.id ?? '';
|
||||||
|
const key = queryKeys.repoStar(accountId, owner, name);
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (starred: boolean) =>
|
||||||
|
starred ? unstarRepo(client!, owner, name) : starRepo(client!, owner, name),
|
||||||
|
onSuccess: () => {
|
||||||
|
void queryClient.invalidateQueries({ queryKey: key });
|
||||||
|
void queryClient.invalidateQueries({ queryKey: queryKeys.repos.starred(accountId, { limit: 20 }) });
|
||||||
|
void queryClient.invalidateQueries({ queryKey: queryKeys.repoDetail(accountId, owner, name) });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSubscription(owner: string, name: string) {
|
||||||
|
const { client, account } = useSession();
|
||||||
|
const accountId = account?.id ?? '';
|
||||||
|
|
||||||
|
return useQuery<Subscription>({
|
||||||
|
queryKey: queryKeys.repoSubscription(accountId, owner, name),
|
||||||
|
enabled: Boolean(client) && Boolean(accountId) && owner.length > 0,
|
||||||
|
queryFn: ({ signal }) => fetchSubscription(client!, owner, name, { signal }),
|
||||||
|
staleTime: 60_000,
|
||||||
|
retry: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useToggleWatch(owner: string, name: string) {
|
||||||
|
const { client, account } = useSession();
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
const accountId = account?.id ?? '';
|
||||||
|
const key = queryKeys.repoSubscription(accountId, owner, name);
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: async (watching: boolean): Promise<void> => {
|
||||||
|
if (watching) {
|
||||||
|
await unwatchRepo(client!, owner, name);
|
||||||
|
} else {
|
||||||
|
await watchRepo(client!, owner, name);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSuccess: () => {
|
||||||
|
void queryClient.invalidateQueries({ queryKey: key });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useForkRepository(owner: string, name: string) {
|
||||||
|
const { client, account } = useSession();
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
const accountId = account?.id ?? '';
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (input: ForkRepoInput) => forkRepository(client!, owner, name, input),
|
||||||
|
onSuccess: () => {
|
||||||
|
// A fork can appear in many repo lists; refresh the account's repo data.
|
||||||
|
void queryClient.invalidateQueries({ queryKey: queryKeys.account(accountId) });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Releases
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export function useReleases(owner: string, name: string, limit = 20) {
|
||||||
|
const { client, account } = useSession();
|
||||||
|
const accountId = account?.id ?? '';
|
||||||
|
const params = { limit };
|
||||||
|
|
||||||
|
return useInfiniteQuery<
|
||||||
|
RawResponse<Release[]>,
|
||||||
|
Error,
|
||||||
|
InfiniteData<RawResponse<Release[]>>,
|
||||||
|
readonly unknown[],
|
||||||
|
number
|
||||||
|
>({
|
||||||
|
queryKey: queryKeys.releases(accountId, owner, name, params),
|
||||||
|
enabled: Boolean(client) && Boolean(accountId),
|
||||||
|
initialPageParam: 1,
|
||||||
|
queryFn: ({ pageParam, signal }) =>
|
||||||
|
listReleases(client!, owner, name, { ...params, page: pageParam }, { signal }),
|
||||||
|
getNextPageParam: (last, all) => (last.hasMore ? all.length + 1 : undefined),
|
||||||
|
placeholderData: keepPreviousData,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useRelease(owner: string, name: string, id: number) {
|
||||||
|
const { client, account } = useSession();
|
||||||
|
const accountId = account?.id ?? '';
|
||||||
|
|
||||||
|
return useQuery({
|
||||||
|
queryKey: queryKeys.release(accountId, owner, name, id),
|
||||||
|
enabled: Boolean(client) && Boolean(accountId) && id > 0,
|
||||||
|
queryFn: ({ signal }) => fetchRelease(client!, owner, name, id, { signal }),
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
import { Linking, Pressable, StyleSheet, View } from 'react-native';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
import { Markdown } from '@/components/git/markdown';
|
||||||
|
import { Screen } from '@/components/layout/screen';
|
||||||
|
import { AppText } from '@/components/ui/app-text';
|
||||||
|
import { Avatar } from '@/components/ui/avatar';
|
||||||
|
import { Badge } from '@/components/ui/badge';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { Card } from '@/components/ui/card';
|
||||||
|
import { Icon } from '@/components/ui/icon';
|
||||||
|
import { ErrorState, LoadingView } from '@/components/ui/state-views';
|
||||||
|
import { apiErrorMessage } from '@/core/api/error-text';
|
||||||
|
import { useSession } from '@/features/accounts/use-session';
|
||||||
|
import { useRelease } from '@/features/repositories/queries';
|
||||||
|
import { formatBytes, formatDateTime } from '@/core/utils/format';
|
||||||
|
import { useTheme } from '@/theme/theme-provider';
|
||||||
|
import { spacing } from '@/theme/tokens';
|
||||||
|
import type { RepositoryStackParamList } from '@/navigation/types';
|
||||||
|
import type { ScreenProps } from '@/navigation/typing';
|
||||||
|
|
||||||
|
type Props = ScreenProps<RepositoryStackParamList, 'ReleaseDetail'>;
|
||||||
|
|
||||||
|
/** One release: metadata, notes and downloadable assets. */
|
||||||
|
export function ReleaseDetailScreen({ route }: Props) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { colors } = useTheme();
|
||||||
|
const { instance } = useSession();
|
||||||
|
const { owner, name, id } = route.params;
|
||||||
|
|
||||||
|
const query = useRelease(owner, name, id);
|
||||||
|
const release = query.data;
|
||||||
|
|
||||||
|
if (query.isPending) return <LoadingView />;
|
||||||
|
if (query.isError) {
|
||||||
|
return (
|
||||||
|
<ErrorState
|
||||||
|
title={t('errors.title')}
|
||||||
|
body={apiErrorMessage(query.error, t)}
|
||||||
|
retryLabel={t('common.retry')}
|
||||||
|
onRetry={() => void query.refetch()}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!release) return null;
|
||||||
|
|
||||||
|
const assets = release.assets ?? [];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Screen scroll padded>
|
||||||
|
<View style={styles.titleBlock}>
|
||||||
|
<AppText variant="heading">{release.name || release.tag_name}</AppText>
|
||||||
|
<View style={styles.badges}>
|
||||||
|
{release.tag_name ? <Badge tone="primary" icon="tag">{release.tag_name}</Badge> : null}
|
||||||
|
{release.prerelease ? <Badge tone="warning">{t('releases.prerelease')}</Badge> : null}
|
||||||
|
{release.draft ? <Badge tone="neutral">{t('releases.draft')}</Badge> : null}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={styles.authorRow}>
|
||||||
|
<Avatar url={release.author?.avatar_url} name={release.author?.login ?? '?'} size={28} />
|
||||||
|
<AppText variant="bodyMedium" style={styles.authorName}>
|
||||||
|
{release.author?.login ?? t('common.unknown')}
|
||||||
|
</AppText>
|
||||||
|
<AppText variant="caption" tone="tertiary">
|
||||||
|
{formatDateTime(release.published_at ?? release.created_at)}
|
||||||
|
</AppText>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{release.body && release.body.trim().length > 0 ? (
|
||||||
|
<Card>
|
||||||
|
<Markdown content={release.body} baseUrl={instance?.baseUrl} />
|
||||||
|
</Card>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{assets.length > 0 ? (
|
||||||
|
<>
|
||||||
|
<AppText variant="subheading">{t('releases.assets')}</AppText>
|
||||||
|
<Card padded={false} variant="flat">
|
||||||
|
{assets.map((asset, index) => (
|
||||||
|
<Pressable
|
||||||
|
key={asset.id ?? asset.name ?? index}
|
||||||
|
onPress={() =>
|
||||||
|
asset.browser_download_url
|
||||||
|
? void Linking.openURL(asset.browser_download_url).catch(() => undefined)
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
accessibilityRole="button"
|
||||||
|
accessibilityLabel={asset.name}
|
||||||
|
style={[styles.assetRow, index < assets.length - 1 && styles.divider]}
|
||||||
|
>
|
||||||
|
<Icon name="download" size={18} color={colors.textTertiary} />
|
||||||
|
<View style={styles.assetBody}>
|
||||||
|
<AppText variant="bodyMedium" numberOfLines={1}>
|
||||||
|
{asset.name}
|
||||||
|
</AppText>
|
||||||
|
<AppText variant="caption" tone="tertiary">
|
||||||
|
{t('releases.downloads', {
|
||||||
|
size: formatBytes(asset.size ?? 0),
|
||||||
|
count: asset.download_count ?? 0,
|
||||||
|
})}
|
||||||
|
</AppText>
|
||||||
|
</View>
|
||||||
|
</Pressable>
|
||||||
|
))}
|
||||||
|
</Card>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{release.html_url ? (
|
||||||
|
<Button
|
||||||
|
label={t('repo.viewOnInstance')}
|
||||||
|
variant="secondary"
|
||||||
|
iconLeft="externalLink"
|
||||||
|
onPress={() => void Linking.openURL(release.html_url as string).catch(() => undefined)}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</Screen>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
titleBlock: { gap: spacing.sm },
|
||||||
|
badges: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.sm, alignItems: 'center' },
|
||||||
|
authorRow: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm },
|
||||||
|
authorName: { flex: 1 },
|
||||||
|
assetRow: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: spacing.md,
|
||||||
|
paddingHorizontal: spacing.lg,
|
||||||
|
paddingVertical: spacing.md,
|
||||||
|
},
|
||||||
|
divider: { borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: 'rgba(128,128,128,0.25)' },
|
||||||
|
assetBody: { flex: 1, gap: 2 },
|
||||||
|
});
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import { StyleSheet, View } from 'react-native';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
import { QueryList } from '@/components/layout/query-list';
|
||||||
|
import { AppText } from '@/components/ui/app-text';
|
||||||
|
import { Badge } from '@/components/ui/badge';
|
||||||
|
import { EmptyState } from '@/components/ui/state-views';
|
||||||
|
import type { Release } from '@/core/api/types';
|
||||||
|
import { flattenPages } from '@/core/utils/infinite';
|
||||||
|
import { formatDateTime } from '@/core/utils/format';
|
||||||
|
import { useReleases } from '@/features/repositories/queries';
|
||||||
|
import { spacing } from '@/theme/tokens';
|
||||||
|
import type { RepositoryStackParamList } from '@/navigation/types';
|
||||||
|
import type { ScreenProps } from '@/navigation/typing';
|
||||||
|
|
||||||
|
type Props = ScreenProps<RepositoryStackParamList, 'Releases'>;
|
||||||
|
|
||||||
|
/** Repository releases (newest first). */
|
||||||
|
export function ReleasesScreen({ navigation, route }: Props) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { owner, name } = route.params;
|
||||||
|
|
||||||
|
const query = useReleases(owner, name);
|
||||||
|
const releases: Release[] = flattenPages(query.data);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<QueryList<Release>
|
||||||
|
query={query}
|
||||||
|
items={releases}
|
||||||
|
keyExtractor={(release) => String(release.id ?? release.tag_name)}
|
||||||
|
renderItem={(release) => (
|
||||||
|
<View style={styles.row}>
|
||||||
|
<AppText
|
||||||
|
variant="bodyMedium"
|
||||||
|
onPress={() =>
|
||||||
|
release.id ? navigation.navigate('ReleaseDetail', { owner, name, id: release.id }) : undefined
|
||||||
|
}
|
||||||
|
accessibilityRole="button"
|
||||||
|
>
|
||||||
|
{release.name || release.tag_name}
|
||||||
|
</AppText>
|
||||||
|
<View style={styles.metaRow}>
|
||||||
|
<Badge tone="neutral">{release.tag_name ?? ''}</Badge>
|
||||||
|
{release.prerelease ? <Badge tone="warning">{t('releases.prerelease')}</Badge> : null}
|
||||||
|
{release.draft ? <Badge tone="neutral">{t('releases.draft')}</Badge> : null}
|
||||||
|
{release.published_at ? (
|
||||||
|
<AppText variant="caption" tone="tertiary">
|
||||||
|
{formatDateTime(release.published_at)}
|
||||||
|
</AppText>
|
||||||
|
) : null}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
empty={<EmptyState icon="tag" title={t('releases.empty')} />}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
row: {
|
||||||
|
paddingHorizontal: spacing.lg,
|
||||||
|
paddingVertical: spacing.md,
|
||||||
|
gap: spacing.xs,
|
||||||
|
},
|
||||||
|
metaRow: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm, flexWrap: 'wrap' },
|
||||||
|
});
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { Linking, StyleSheet, View } from 'react-native';
|
import { Alert, Linking, StyleSheet, View } from 'react-native';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Markdown } from '@/components/git/markdown';
|
import { Markdown } from '@/components/git/markdown';
|
||||||
@@ -13,8 +13,17 @@ import { LabelChip } from '@/components/ui/label-chip';
|
|||||||
import { ListItem } from '@/components/ui/list-item';
|
import { ListItem } from '@/components/ui/list-item';
|
||||||
import { ErrorState, LoadingView } from '@/components/ui/state-views';
|
import { ErrorState, LoadingView } from '@/components/ui/state-views';
|
||||||
import { apiErrorMessage } from '@/core/api/error-text';
|
import { apiErrorMessage } from '@/core/api/error-text';
|
||||||
|
import { parseGiteaVersion, supports } from '@/core/capabilities';
|
||||||
import { buildEditorUrl } from '@/core/utils/editor-url';
|
import { buildEditorUrl } from '@/core/utils/editor-url';
|
||||||
import { useRepository, useRepositoryLanguages } from '@/features/repositories/queries';
|
import {
|
||||||
|
useForkRepository,
|
||||||
|
useIsStarred,
|
||||||
|
useRepository,
|
||||||
|
useRepositoryLanguages,
|
||||||
|
useSubscription,
|
||||||
|
useToggleStar,
|
||||||
|
useToggleWatch,
|
||||||
|
} from '@/features/repositories/queries';
|
||||||
import { decodeBase64, useReadme } from '@/features/repository/queries';
|
import { decodeBase64, useReadme } from '@/features/repository/queries';
|
||||||
import { useSession } from '@/features/accounts/use-session';
|
import { useSession } from '@/features/accounts/use-session';
|
||||||
import { useSettingsStore } from '@/features/settings/settings-store';
|
import { useSettingsStore } from '@/features/settings/settings-store';
|
||||||
@@ -38,6 +47,35 @@ export function RepoOverviewScreen({ navigation, route }: Props) {
|
|||||||
const readmeRef = ref ?? repo?.default_branch;
|
const readmeRef = ref ?? repo?.default_branch;
|
||||||
const readmeQuery = useReadme(owner, name, readmeRef);
|
const readmeQuery = useReadme(owner, name, readmeRef);
|
||||||
const languagesQuery = useRepositoryLanguages(owner, name);
|
const languagesQuery = useRepositoryLanguages(owner, name);
|
||||||
|
const isStarred = useIsStarred(owner, name);
|
||||||
|
const toggleStar = useToggleStar(owner, name);
|
||||||
|
const subscription = useSubscription(owner, name);
|
||||||
|
const toggleWatch = useToggleWatch(owner, name);
|
||||||
|
const forkRepo = useForkRepository(owner, name);
|
||||||
|
|
||||||
|
const version = parseGiteaVersion(instance?.version);
|
||||||
|
const repoUrl = instance ? `${instance.baseUrl}/${owner}/${name}` : null;
|
||||||
|
|
||||||
|
const confirmFork = () => {
|
||||||
|
Alert.alert(t('repo.forkTitle'), t('repo.forkBody', { name }), [
|
||||||
|
{ text: t('common.cancel'), style: 'cancel' },
|
||||||
|
{
|
||||||
|
text: t('repo.fork'),
|
||||||
|
onPress: () =>
|
||||||
|
forkRepo.mutate(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
onSuccess: (forked) =>
|
||||||
|
Alert.alert(
|
||||||
|
t('repo.forkedTitle'),
|
||||||
|
t('repo.forkedBody', { name: forked.full_name ?? name }),
|
||||||
|
),
|
||||||
|
onError: (error) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
const languages = useMemo(() => {
|
const languages = useMemo(() => {
|
||||||
const entries = Object.entries(languagesQuery.data ?? {});
|
const entries = Object.entries(languagesQuery.data ?? {});
|
||||||
@@ -127,6 +165,33 @@ export function RepoOverviewScreen({ navigation, route }: Props) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
<View style={styles.actionRow}>
|
||||||
|
<Button
|
||||||
|
label={isStarred.data ? t('repo.unstar') : t('repo.star')}
|
||||||
|
variant="secondary"
|
||||||
|
size="md"
|
||||||
|
iconLeft={isStarred.data ? 'star' : 'starOutline'}
|
||||||
|
loading={toggleStar.isPending}
|
||||||
|
onPress={() => toggleStar.mutate(isStarred.data ?? false)}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
label={subscription.data?.subscribed ? t('repo.unwatch') : t('repo.watch')}
|
||||||
|
variant="secondary"
|
||||||
|
size="md"
|
||||||
|
iconLeft="bell"
|
||||||
|
loading={toggleWatch.isPending}
|
||||||
|
onPress={() => toggleWatch.mutate(subscription.data?.subscribed ?? false)}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
label={t('repo.fork')}
|
||||||
|
variant="secondary"
|
||||||
|
size="md"
|
||||||
|
iconLeft="fork"
|
||||||
|
loading={forkRepo.isPending}
|
||||||
|
onPress={confirmFork}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* Quick navigation */}
|
{/* Quick navigation */}
|
||||||
@@ -155,6 +220,20 @@ export function RepoOverviewScreen({ navigation, route }: Props) {
|
|||||||
title={t('repo.tags')}
|
title={t('repo.tags')}
|
||||||
onPress={() => navigation.navigate('Tags', { owner, name })}
|
onPress={() => navigation.navigate('Tags', { owner, name })}
|
||||||
/>
|
/>
|
||||||
|
{repo.has_releases !== false ? (
|
||||||
|
<ListItem
|
||||||
|
leadingIcon="download"
|
||||||
|
title={t('releases.title')}
|
||||||
|
onPress={() => navigation.navigate('Releases', { owner, name })}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
{repo.has_wiki && supports('wiki', version) && repoUrl ? (
|
||||||
|
<ListItem
|
||||||
|
leadingIcon="globe"
|
||||||
|
title={t('repo.wiki')}
|
||||||
|
onPress={() => void Linking.openURL(`${repoUrl}/wiki`).catch(() => undefined)}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
{repo.has_issues !== false ? (
|
{repo.has_issues !== false ? (
|
||||||
<ListItem
|
<ListItem
|
||||||
leadingIcon="issue"
|
leadingIcon="issue"
|
||||||
@@ -299,6 +378,7 @@ const styles = StyleSheet.create({
|
|||||||
titleRow: { flexDirection: 'row', alignItems: 'baseline', flexWrap: 'wrap' },
|
titleRow: { flexDirection: 'row', alignItems: 'baseline', flexWrap: 'wrap' },
|
||||||
name: { flexShrink: 1 },
|
name: { flexShrink: 1 },
|
||||||
badges: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.sm, alignItems: 'center' },
|
badges: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.sm, alignItems: 'center' },
|
||||||
|
actionRow: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.sm },
|
||||||
section: { marginTop: spacing.xl, gap: spacing.sm },
|
section: { marginTop: spacing.xl, gap: spacing.sm },
|
||||||
sectionTitle: { paddingHorizontal: spacing.lg },
|
sectionTitle: { paddingHorizontal: spacing.lg },
|
||||||
card: { marginHorizontal: spacing.lg },
|
card: { marginHorizontal: spacing.lg },
|
||||||
|
|||||||
@@ -154,6 +154,16 @@
|
|||||||
"noPermission": "You don't have permission to view this repository.",
|
"noPermission": "You don't have permission to view this repository.",
|
||||||
"viewOnInstance": "Open in browser",
|
"viewOnInstance": "Open in browser",
|
||||||
"openInEditor": "Open in editor",
|
"openInEditor": "Open in editor",
|
||||||
|
"star": "Star",
|
||||||
|
"unstar": "Starred",
|
||||||
|
"watch": "Watch",
|
||||||
|
"unwatch": "Watching",
|
||||||
|
"fork": "Fork",
|
||||||
|
"forkTitle": "Fork this repository?",
|
||||||
|
"forkBody": "A fork of {{name}} will be created under your account.",
|
||||||
|
"forkedTitle": "Forked",
|
||||||
|
"forkedBody": "Created {{name}}.",
|
||||||
|
"wiki": "Wiki",
|
||||||
"browse": "Browse",
|
"browse": "Browse",
|
||||||
"empty": "This repository is empty",
|
"empty": "This repository is empty",
|
||||||
"noReadme": "No README file",
|
"noReadme": "No README file",
|
||||||
@@ -315,6 +325,15 @@
|
|||||||
"deleteTitle": "Delete comment?",
|
"deleteTitle": "Delete comment?",
|
||||||
"deleteBody": "This comment will be permanently deleted."
|
"deleteBody": "This comment will be permanently deleted."
|
||||||
},
|
},
|
||||||
|
"releases": {
|
||||||
|
"title": "Releases",
|
||||||
|
"detailTitle": "Release",
|
||||||
|
"empty": "No releases yet",
|
||||||
|
"prerelease": "Pre-release",
|
||||||
|
"draft": "Draft",
|
||||||
|
"assets": "Assets",
|
||||||
|
"downloads": "{{size}} · {{count}} downloads"
|
||||||
|
},
|
||||||
"checks": {
|
"checks": {
|
||||||
"success": "Checks passed",
|
"success": "Checks passed",
|
||||||
"pending": "Checks pending",
|
"pending": "Checks pending",
|
||||||
|
|||||||
@@ -154,6 +154,16 @@
|
|||||||
"noPermission": "Je hebt geen rechten om deze repository te bekijken.",
|
"noPermission": "Je hebt geen rechten om deze repository te bekijken.",
|
||||||
"viewOnInstance": "Openen in browser",
|
"viewOnInstance": "Openen in browser",
|
||||||
"openInEditor": "Openen in editor",
|
"openInEditor": "Openen in editor",
|
||||||
|
"star": "Ster",
|
||||||
|
"unstar": "Gesterd",
|
||||||
|
"watch": "Volgen",
|
||||||
|
"unwatch": "Gevolgd",
|
||||||
|
"fork": "Forken",
|
||||||
|
"forkTitle": "Deze repository forken?",
|
||||||
|
"forkBody": "Er wordt een fork van {{name}} onder jouw account aangemaakt.",
|
||||||
|
"forkedTitle": "Geforkt",
|
||||||
|
"forkedBody": "{{name}} is aangemaakt.",
|
||||||
|
"wiki": "Wiki",
|
||||||
"browse": "Bladeren",
|
"browse": "Bladeren",
|
||||||
"empty": "Deze repository is leeg",
|
"empty": "Deze repository is leeg",
|
||||||
"noReadme": "Geen README-bestand",
|
"noReadme": "Geen README-bestand",
|
||||||
@@ -315,6 +325,15 @@
|
|||||||
"deleteTitle": "Reactie verwijderen?",
|
"deleteTitle": "Reactie verwijderen?",
|
||||||
"deleteBody": "Deze reactie wordt permanent verwijderd."
|
"deleteBody": "Deze reactie wordt permanent verwijderd."
|
||||||
},
|
},
|
||||||
|
"releases": {
|
||||||
|
"title": "Releases",
|
||||||
|
"detailTitle": "Release",
|
||||||
|
"empty": "Nog geen releases",
|
||||||
|
"prerelease": "Pre-release",
|
||||||
|
"draft": "Concept",
|
||||||
|
"assets": "Bestanden",
|
||||||
|
"downloads": "{{size}} · {{count}} downloads"
|
||||||
|
},
|
||||||
"checks": {
|
"checks": {
|
||||||
"success": "Checks geslaagd",
|
"success": "Checks geslaagd",
|
||||||
"pending": "Checks in behandeling",
|
"pending": "Checks in behandeling",
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import { PullReviewScreen } from '@/features/repository/screens/pull-review-scre
|
|||||||
import { RepoIssuesScreen } from '@/features/repository/screens/repo-issues-screen';
|
import { RepoIssuesScreen } from '@/features/repository/screens/repo-issues-screen';
|
||||||
import { RepoOverviewScreen } from '@/features/repository/screens/repo-overview-screen';
|
import { RepoOverviewScreen } from '@/features/repository/screens/repo-overview-screen';
|
||||||
import { RepoPullsScreen } from '@/features/repository/screens/repo-pulls-screen';
|
import { RepoPullsScreen } from '@/features/repository/screens/repo-pulls-screen';
|
||||||
|
import { ReleaseDetailScreen } from '@/features/repository/screens/release-detail-screen';
|
||||||
|
import { ReleasesScreen } from '@/features/repository/screens/releases-screen';
|
||||||
import { TagsScreen } from '@/features/repository/screens/tags-screen';
|
import { TagsScreen } from '@/features/repository/screens/tags-screen';
|
||||||
import { shortSha } from '@/core/utils/format';
|
import { shortSha } from '@/core/utils/format';
|
||||||
import { useStackScreenOptions } from '@/navigation/header-options';
|
import { useStackScreenOptions } from '@/navigation/header-options';
|
||||||
@@ -85,6 +87,16 @@ export function RepositoryNavigator() {
|
|||||||
options={{ title: t('repo.branches') }}
|
options={{ title: t('repo.branches') }}
|
||||||
/>
|
/>
|
||||||
<Stack.Screen name="Tags" component={TagsScreen} options={{ title: t('repo.tags') }} />
|
<Stack.Screen name="Tags" component={TagsScreen} options={{ title: t('repo.tags') }} />
|
||||||
|
<Stack.Screen
|
||||||
|
name="Releases"
|
||||||
|
component={ReleasesScreen}
|
||||||
|
options={{ title: t('releases.title') }}
|
||||||
|
/>
|
||||||
|
<Stack.Screen
|
||||||
|
name="ReleaseDetail"
|
||||||
|
component={ReleaseDetailScreen}
|
||||||
|
options={{ title: t('releases.detailTitle') }}
|
||||||
|
/>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="RepoIssues"
|
name="RepoIssues"
|
||||||
component={RepoIssuesScreen}
|
component={RepoIssuesScreen}
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ export type RepositoryStackParamList = {
|
|||||||
CommitDetail: { owner: string; name: string; sha: string };
|
CommitDetail: { owner: string; name: string; sha: string };
|
||||||
Branches: { owner: string; name: string };
|
Branches: { owner: string; name: string };
|
||||||
Tags: { owner: string; name: string };
|
Tags: { owner: string; name: string };
|
||||||
|
Releases: { owner: string; name: string };
|
||||||
|
ReleaseDetail: { owner: string; name: string; id: number };
|
||||||
RepoIssues: { owner: string; name: string };
|
RepoIssues: { owner: string; name: string };
|
||||||
IssueDetail: { owner: string; name: string; index: number };
|
IssueDetail: { owner: string; name: string; index: number };
|
||||||
IssueCompose: { owner: string; name: string; index?: number };
|
IssueCompose: { owner: string; name: string; index?: number };
|
||||||
|
|||||||
Reference in new issue
Block a user