- API: Actions (workflows/runs/jobs/logs getText), repo create/edit/delete, collaborators, webhooks, branch protections, orgs, packages, user keys/GPG keys/tokens, release create/edit/delete - hooks: features/actions, repositories/settings-queries, features/profile - screens: Actions + run detail (expandable job logs), RepoSettings, Collaborators, Webhooks, Protections, CreateRepo, Organizations, OrgRepos, Packages, Credentials, ReleaseCompose; releases list/detail management - navigation + i18n (en/nl) wired for all new screens
203 lines
7.5 KiB
TypeScript
203 lines
7.5 KiB
TypeScript
/**
|
|
* Repository stack: pushed on top of the tab shell from anywhere a repository
|
|
* is opened (search, home, inbox, deep links).
|
|
*/
|
|
|
|
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { HeaderAccountAndSettings } from '@/components/layout/header-buttons';
|
|
import { ActionsScreen } from '@/features/repository/screens/actions-screen';
|
|
import { ActionRunDetailScreen } from '@/features/repository/screens/action-run-detail-screen';
|
|
import { BranchesScreen } from '@/features/repository/screens/branches-screen';
|
|
import { CollaboratorsScreen } from '@/features/repository/screens/collaborators-screen';
|
|
import { CommitDetailScreen } from '@/features/repository/screens/commit-detail-screen';
|
|
import { CommitsScreen } from '@/features/repository/screens/commits-screen';
|
|
import { FileEditScreen } from '@/features/repository/screens/file-edit-screen';
|
|
import { FileViewerScreen } from '@/features/repository/screens/file-viewer-screen';
|
|
import { FilesScreen } from '@/features/repository/screens/files-screen';
|
|
import { IssueComposeScreen } from '@/features/repository/screens/issue-compose-screen';
|
|
import { IssueDetailScreen } from '@/features/repository/screens/issue-detail-screen';
|
|
import { ProtectionsScreen } from '@/features/repository/screens/protections-screen';
|
|
import { PullDetailScreen } from '@/features/repository/screens/pull-detail-screen';
|
|
import { PullDiffScreen } from '@/features/repository/screens/pull-diff-screen';
|
|
import { PullFilesScreen } from '@/features/repository/screens/pull-files-screen';
|
|
import { PullReviewScreen } from '@/features/repository/screens/pull-review-screen';
|
|
import { ReleaseComposeScreen } from '@/features/repository/screens/release-compose-screen';
|
|
import { RepoIssuesScreen } from '@/features/repository/screens/repo-issues-screen';
|
|
import { RepoOverviewScreen } from '@/features/repository/screens/repo-overview-screen';
|
|
import { RepoPullsScreen } from '@/features/repository/screens/repo-pulls-screen';
|
|
import { RepoSettingsScreen } from '@/features/repository/screens/repo-settings-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 { WebhooksScreen } from '@/features/repository/screens/webhooks-screen';
|
|
import { shortSha } from '@/core/utils/format';
|
|
import { useStackScreenOptions } from '@/navigation/header-options';
|
|
import type { RepositoryStackParamList } from '@/navigation/types';
|
|
|
|
const Stack = createNativeStackNavigator<RepositoryStackParamList>();
|
|
|
|
function lastSegment(path: string | undefined, fallback: string): string {
|
|
if (!path) return fallback;
|
|
const segments = path.split('/').filter(Boolean);
|
|
return segments[segments.length - 1] ?? fallback;
|
|
}
|
|
|
|
export function RepositoryNavigator() {
|
|
const { t } = useTranslation();
|
|
const base = useStackScreenOptions();
|
|
|
|
return (
|
|
<Stack.Navigator
|
|
screenOptions={{ ...base, headerRight: () => <HeaderAccountAndSettings /> }}
|
|
>
|
|
<Stack.Screen
|
|
name="RepoOverview"
|
|
component={RepoOverviewScreen}
|
|
options={({ route }) => ({ title: `${route.params.owner}/${route.params.name}` })}
|
|
/>
|
|
<Stack.Screen
|
|
name="Files"
|
|
component={FilesScreen}
|
|
options={({ route }) => ({
|
|
title: lastSegment(route.params.path, t('repo.files')),
|
|
})}
|
|
/>
|
|
<Stack.Screen
|
|
name="FileViewer"
|
|
component={FileViewerScreen}
|
|
options={({ route }) => ({
|
|
title: lastSegment(route.params.path, t('files.title')),
|
|
})}
|
|
/>
|
|
<Stack.Screen
|
|
name="FileEdit"
|
|
component={FileEditScreen}
|
|
options={({ route }) => ({
|
|
title: `${t('edit.title')} · ${lastSegment(route.params.path, t('files.title'))}`,
|
|
})}
|
|
/>
|
|
<Stack.Screen
|
|
name="Commits"
|
|
component={CommitsScreen}
|
|
options={{ title: t('repo.commits') }}
|
|
/>
|
|
<Stack.Screen
|
|
name="CommitDetail"
|
|
component={CommitDetailScreen}
|
|
options={({ route }) => ({ title: shortSha(route.params.sha) })}
|
|
/>
|
|
<Stack.Screen
|
|
name="Branches"
|
|
component={BranchesScreen}
|
|
options={{ title: t('repo.branches') }}
|
|
/>
|
|
<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
|
|
name="RepoIssues"
|
|
component={RepoIssuesScreen}
|
|
options={{ title: t('repo.issuesTab') }}
|
|
/>
|
|
<Stack.Screen
|
|
name="IssueDetail"
|
|
component={IssueDetailScreen}
|
|
options={({ route }) => ({ title: `#${route.params.index}` })}
|
|
/>
|
|
<Stack.Screen
|
|
name="IssueCompose"
|
|
component={IssueComposeScreen}
|
|
options={({ route }) => ({
|
|
title: route.params.index ? t('issues.compose.editTitle') : t('issues.compose.createTitle'),
|
|
})}
|
|
/>
|
|
<Stack.Screen
|
|
name="RepoPulls"
|
|
component={RepoPullsScreen}
|
|
options={{ title: t('repo.pullsTab') }}
|
|
/>
|
|
<Stack.Screen
|
|
name="PullDetail"
|
|
component={PullDetailScreen}
|
|
options={({ route }) => ({ title: `#${route.params.index}` })}
|
|
/>
|
|
<Stack.Screen
|
|
name="PullFiles"
|
|
component={PullFilesScreen}
|
|
options={{ title: t('pulls.changedFilesTitle') }}
|
|
/>
|
|
<Stack.Screen
|
|
name="PullDiff"
|
|
component={PullDiffScreen}
|
|
options={({ route }) => ({
|
|
title: route.params.path ? lastSegment(route.params.path, t('pulls.diff')) : t('pulls.diff'),
|
|
})}
|
|
/>
|
|
<Stack.Screen
|
|
name="PullReview"
|
|
component={PullReviewScreen}
|
|
options={({ route }) => ({
|
|
title:
|
|
route.params.event === 'APPROVE'
|
|
? t('pulls.approve')
|
|
: route.params.event === 'REQUEST_CHANGES'
|
|
? t('pulls.requestChanges')
|
|
: t('pulls.comment'),
|
|
})}
|
|
/>
|
|
<Stack.Screen
|
|
name="ReleaseCompose"
|
|
component={ReleaseComposeScreen}
|
|
options={({ route }) => ({
|
|
title: route.params.id ? t('releases.edit') : t('releases.create'),
|
|
})}
|
|
/>
|
|
<Stack.Screen
|
|
name="RepoIssues"
|
|
component={RepoIssuesScreen}
|
|
options={{ title: t('repo.issuesTab') }}
|
|
/>
|
|
<Stack.Screen
|
|
name="RepoSettings"
|
|
component={RepoSettingsScreen}
|
|
options={{ title: t('repoSettings.title') }}
|
|
/>
|
|
<Stack.Screen
|
|
name="Collaborators"
|
|
component={CollaboratorsScreen}
|
|
options={{ title: t('repoSettings.collaborators') }}
|
|
/>
|
|
<Stack.Screen
|
|
name="Webhooks"
|
|
component={WebhooksScreen}
|
|
options={{ title: t('repoSettings.webhooks') }}
|
|
/>
|
|
<Stack.Screen
|
|
name="Protections"
|
|
component={ProtectionsScreen}
|
|
options={{ title: t('repoSettings.protections') }}
|
|
/>
|
|
<Stack.Screen
|
|
name="Actions"
|
|
component={ActionsScreen}
|
|
options={{ title: t('actions.title') }}
|
|
/>
|
|
<Stack.Screen
|
|
name="ActionRunDetail"
|
|
component={ActionRunDetailScreen}
|
|
options={{ title: t('actions.runTitle') }}
|
|
/>
|
|
</Stack.Navigator>
|
|
);
|
|
}
|