feat(app): React Navigation shell and i18next setup
- React Navigation 7: conditional root stack (Auth | Main | Repository | Settings | Accounts modal), 5 bottom tabs with nested native stacks - typed param lists, deep-link config, header options, root-nav helper - providers: gesture handler, safe area, theme, persisted query client, app lock - i18next + expo-localization (en/nl), persisted language preference
This commit is contained in:
1 parent
08229fdf86
commit
ad81db07b3
17 files changed
+1500
No files matched your search
+90
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* Application root.
|
||||
*
|
||||
* Composition order (outer → inner):
|
||||
* GestureHandlerRootView → SafeAreaProvider → AppThemeProvider →
|
||||
* PersistQueryClientProvider (offline cache) → NavigationContainer → AppLockGate
|
||||
*
|
||||
* The accounts store must hydrate before the navigator mounts (tokens come from
|
||||
* SecureStore), so the splash screen is held until then.
|
||||
*/
|
||||
|
||||
import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client';
|
||||
import { NavigationContainer } from '@react-navigation/native';
|
||||
import * as SplashScreen from 'expo-splash-screen';
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import { useEffect } from 'react';
|
||||
import { StyleSheet } from 'react-native';
|
||||
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
||||
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
||||
|
||||
import { useAccountsStore } from '@/core/accounts/accounts-store';
|
||||
import {
|
||||
OFFLINE_CACHE_MAX_AGE,
|
||||
queryClient,
|
||||
queryPersister,
|
||||
shouldDehydrateQuery,
|
||||
} from '@/core/api/query-client';
|
||||
import { useSettingsStore } from '@/features/settings/settings-store';
|
||||
import { applyLanguagePreference } from '@/i18n';
|
||||
import { AppLockGate } from '@/features/auth/app-lock';
|
||||
import { linking } from '@/navigation/linking';
|
||||
import { RootNavigator } from '@/navigation/root-navigator';
|
||||
import { AppThemeProvider, useNavigationTheme, useTheme } from '@/theme/theme-provider';
|
||||
|
||||
void SplashScreen.preventAutoHideAsync().catch(() => undefined);
|
||||
|
||||
function AppShell() {
|
||||
const hydrated = useAccountsStore((s) => s.hydrated);
|
||||
const language = useSettingsStore((s) => s.language);
|
||||
const navigationTheme = useNavigationTheme();
|
||||
const { isDark } = useTheme();
|
||||
|
||||
useEffect(() => {
|
||||
void useAccountsStore.getState().hydrate();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
applyLanguagePreference(language);
|
||||
}, [language]);
|
||||
|
||||
useEffect(() => {
|
||||
if (hydrated) void SplashScreen.hideAsync().catch(() => undefined);
|
||||
}, [hydrated]);
|
||||
|
||||
if (!hydrated) return null;
|
||||
|
||||
return (
|
||||
<NavigationContainer theme={navigationTheme} linking={linking}>
|
||||
<StatusBar style={isDark ? 'light' : 'dark'} />
|
||||
<AppLockGate>
|
||||
<RootNavigator />
|
||||
</AppLockGate>
|
||||
</NavigationContainer>
|
||||
);
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<GestureHandlerRootView style={styles.root}>
|
||||
<SafeAreaProvider>
|
||||
<AppThemeProvider>
|
||||
<PersistQueryClientProvider
|
||||
client={queryClient}
|
||||
persistOptions={{
|
||||
persister: queryPersister,
|
||||
maxAge: OFFLINE_CACHE_MAX_AGE,
|
||||
dehydrateOptions: { shouldDehydrateQuery },
|
||||
}}
|
||||
>
|
||||
<AppShell />
|
||||
</PersistQueryClientProvider>
|
||||
</AppThemeProvider>
|
||||
</SafeAreaProvider>
|
||||
</GestureHandlerRootView>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
root: { flex: 1 },
|
||||
});
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* i18n bootstrap (i18next + react-i18next + expo-localization).
|
||||
*
|
||||
* - Detects the device language (English / Dutch) at startup.
|
||||
* - The user can override the language in Settings; the choice is persisted by
|
||||
* the settings store and applied via {@link applyLanguagePreference}.
|
||||
* - Includes an Intl.PluralRules polyfill for Hermes builds that lack it.
|
||||
*/
|
||||
|
||||
import i18n from 'i18next';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
|
||||
import { getLocales } from 'expo-localization';
|
||||
|
||||
import en from './locales/en.json';
|
||||
import nl from './locales/nl.json';
|
||||
|
||||
// i18next needs Intl.PluralRules; some Hermes builds ship without it.
|
||||
if (typeof Intl === 'undefined' || typeof Intl.PluralRules !== 'function') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
require('intl-pluralrules');
|
||||
}
|
||||
|
||||
export const SUPPORTED_LANGUAGES = ['en', 'nl'] as const;
|
||||
export type SupportedLanguage = (typeof SUPPORTED_LANGUAGES)[number];
|
||||
export type LanguagePreference = SupportedLanguage | 'system';
|
||||
|
||||
export function detectDeviceLanguage(): SupportedLanguage {
|
||||
const locales = getLocales();
|
||||
for (const locale of locales) {
|
||||
const code = locale.languageCode?.toLowerCase();
|
||||
if (code && (SUPPORTED_LANGUAGES as readonly string[]).includes(code)) {
|
||||
return code as SupportedLanguage;
|
||||
}
|
||||
}
|
||||
return 'en';
|
||||
}
|
||||
|
||||
// eslint-disable-next-line import/no-named-as-default-member
|
||||
void i18n.use(initReactI18next).init({
|
||||
resources: {
|
||||
en: { translation: en },
|
||||
nl: { translation: nl },
|
||||
},
|
||||
lng: detectDeviceLanguage(),
|
||||
fallbackLng: 'en',
|
||||
interpolation: {
|
||||
// React already escapes output.
|
||||
escapeValue: false,
|
||||
},
|
||||
returnNull: false,
|
||||
});
|
||||
|
||||
/** Applies the user's persisted language preference ('system' → device language). */
|
||||
export function applyLanguagePreference(preference: LanguagePreference): void {
|
||||
const target = preference === 'system' ? detectDeviceLanguage() : preference;
|
||||
if (i18n.language !== target) {
|
||||
// eslint-disable-next-line import/no-named-as-default-member
|
||||
void i18n.changeLanguage(target);
|
||||
}
|
||||
}
|
||||
|
||||
export { i18n };
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Locale parity guard.
|
||||
*
|
||||
* Every key must exist in both `en` and `nl`, and both must use the same
|
||||
* interpolation placeholders — otherwise a translated screen renders raw
|
||||
* `{{count}}` text for one language.
|
||||
*/
|
||||
|
||||
import en from './locales/en.json';
|
||||
import nl from './locales/nl.json';
|
||||
|
||||
function leafPaths(value: unknown, prefix = ''): string[] {
|
||||
if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
|
||||
return Object.entries(value as Record<string, unknown>).flatMap(([key, child]) =>
|
||||
leafPaths(child, prefix ? `${prefix}.${key}` : key),
|
||||
);
|
||||
}
|
||||
return [prefix];
|
||||
}
|
||||
|
||||
function placeholders(value: unknown): string[] {
|
||||
return [...String(value).matchAll(/\{\{\s*([\w.]+)/g)].map((match) => match[1]).sort();
|
||||
}
|
||||
|
||||
function leafEntries(value: unknown, prefix = ''): [string, unknown][] {
|
||||
if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
|
||||
return Object.entries(value as Record<string, unknown>).flatMap(([key, child]) =>
|
||||
leafEntries(child, prefix ? `${prefix}.${key}` : key),
|
||||
);
|
||||
}
|
||||
return [[prefix, value]];
|
||||
}
|
||||
|
||||
describe('locales', () => {
|
||||
it('en and nl expose exactly the same keys', () => {
|
||||
const enKeys = new Set(leafPaths(en));
|
||||
const nlKeys = new Set(leafPaths(nl));
|
||||
const missingInNl = [...enKeys].filter((key) => !nlKeys.has(key));
|
||||
const missingInEn = [...nlKeys].filter((key) => !enKeys.has(key));
|
||||
expect({ missingInNl, missingInEn }).toEqual({ missingInNl: [], missingInEn: [] });
|
||||
});
|
||||
|
||||
it('has no empty or whitespace-only values in either language', () => {
|
||||
const blank = (locale: unknown) =>
|
||||
leafEntries(locale)
|
||||
.filter(([, value]) => typeof value === 'string' && value.trim().length === 0)
|
||||
.map(([key]) => key);
|
||||
expect(blank(en)).toEqual([]);
|
||||
expect(blank(nl)).toEqual([]);
|
||||
});
|
||||
|
||||
it('uses matching interpolation placeholders in both languages', () => {
|
||||
const nlMap = new Map(leafEntries(nl).map(([key, value]) => [key, value]));
|
||||
const mismatches = leafEntries(en)
|
||||
.filter(([key]) => key !== '')
|
||||
.filter(([key, enValue]) => {
|
||||
const nlValue = nlMap.get(key);
|
||||
return JSON.stringify(placeholders(enValue)) !== JSON.stringify(placeholders(nlValue));
|
||||
})
|
||||
.map(([key]) => key);
|
||||
expect(mismatches).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,336 @@
|
||||
{
|
||||
"common": {
|
||||
"appName": "Gitea Native",
|
||||
"tagline": "Unofficial Gitea client",
|
||||
"unofficialNotice": "Unofficial — not affiliated with the Gitea project",
|
||||
"cancel": "Cancel",
|
||||
"close": "Close",
|
||||
"retry": "Try again",
|
||||
"save": "Save",
|
||||
"done": "Done",
|
||||
"delete": "Delete",
|
||||
"remove": "Remove",
|
||||
"disconnect": "Disconnect",
|
||||
"confirm": "Confirm",
|
||||
"edit": "Edit",
|
||||
"refresh": "Refresh",
|
||||
"search": "Search",
|
||||
"clear": "Clear",
|
||||
"loading": "Loading…",
|
||||
"viewAll": "View all",
|
||||
"back": "Back",
|
||||
"signIn": "Sign in",
|
||||
"signOut": "Sign out",
|
||||
"optional": "optional",
|
||||
"required": "required",
|
||||
"copy": "Copy",
|
||||
"copied": "Copied",
|
||||
"unknown": "Unknown",
|
||||
"never": "Never",
|
||||
"add": "Add",
|
||||
"showSecret": "Show value",
|
||||
"hideSecret": "Hide value",
|
||||
"clearField": "Clear field"
|
||||
},
|
||||
"tabs": {
|
||||
"home": "Home",
|
||||
"repositories": "Repositories",
|
||||
"issues": "Issues",
|
||||
"pullRequests": "Pull Requests",
|
||||
"inbox": "Inbox"
|
||||
},
|
||||
"auth": {
|
||||
"welcome": {
|
||||
"title": "Your Gitea, in your pocket",
|
||||
"subtitle": "Browse repositories, issues, pull requests and notifications from any self-hosted Gitea instance.",
|
||||
"disclaimer": "Gitea Native is an open-source, unofficial client. It is not affiliated with, endorsed by, or connected to the Gitea project.",
|
||||
"connectButton": "Connect an instance",
|
||||
"yourAccounts": "Your accounts"
|
||||
},
|
||||
"connect": {
|
||||
"title": "Connect instance",
|
||||
"instanceUrl": "Instance address",
|
||||
"instanceUrlPlaceholder": "https://codeberg.org",
|
||||
"instanceUrlHelp": "The address of your Gitea instance. Remote instances must use HTTPS.",
|
||||
"token": "Personal access token",
|
||||
"tokenPlaceholder": "Paste your token",
|
||||
"tokenHelp": "Create a token in Gitea → Settings → Applications → Generate Token. It is stored securely in your device keychain and never leaves your device except to talk to this instance.",
|
||||
"label": "Label",
|
||||
"labelPlaceholder": "Work, personal…",
|
||||
"submit": "Validate and connect",
|
||||
"validating": "Validating credentials…",
|
||||
"saving": "Saving…",
|
||||
"checkingVersion": "Contacting instance…"
|
||||
},
|
||||
"errors": {
|
||||
"url": "That instance address is not valid.",
|
||||
"token": "Enter your personal access token.",
|
||||
"insecure": "Remote instances must use HTTPS.",
|
||||
"network": "Could not reach the instance. Check the address and your connection.",
|
||||
"auth": "The token was rejected by this instance. Check that it is valid and not expired.",
|
||||
"forbidden": "This token does not have permission to access your account.",
|
||||
"generic": "Could not connect to this instance."
|
||||
}
|
||||
},
|
||||
"lock": {
|
||||
"title": "App locked",
|
||||
"subtitle": "Authenticate to unlock Gitea Native",
|
||||
"unlock": "Unlock",
|
||||
"unlocking": "Authenticating…",
|
||||
"biometricPrompt": "Unlock Gitea Native",
|
||||
"failed": "Authentication failed. Try again.",
|
||||
"unavailable": "Biometric unlock is unavailable. Disable it in Settings to continue.",
|
||||
"notConfigured": "Set up Face ID, fingerprint or screen lock in your device settings."
|
||||
},
|
||||
"home": {
|
||||
"greeting": "Signed in as {{name}}",
|
||||
"instanceOn": "on {{instance}}",
|
||||
"shortcuts": "Shortcuts",
|
||||
"shortcutRepositories": "Repositories",
|
||||
"shortcutIssues": "Your issues",
|
||||
"shortcutPulls": "Your pull requests",
|
||||
"shortcutInbox": "Inbox",
|
||||
"recentRepos": "Recent repositories",
|
||||
"assignedIssues": "Assigned to you",
|
||||
"reviewPulls": "Review requested",
|
||||
"activity": "Recent activity",
|
||||
"unreadNotifications": "{{count}} unread notifications",
|
||||
"emptyRepos": "No repositories yet",
|
||||
"emptyIssues": "Nothing is assigned to you",
|
||||
"emptyPulls": "No pull requests need your attention",
|
||||
"emptyActivity": "No recent activity"
|
||||
},
|
||||
"repositories": {
|
||||
"title": "Repositories",
|
||||
"searchPlaceholder": "Search repositories",
|
||||
"sortUpdated": "Recently updated",
|
||||
"sortName": "Name",
|
||||
"sortStars": "Most stars",
|
||||
"sortCreated": "Recently created",
|
||||
"visibilityAll": "All",
|
||||
"visibilityPrivate": "Private",
|
||||
"visibilityPublic": "Public",
|
||||
"starred": "Starred",
|
||||
"all": "All",
|
||||
"empty": "No repositories yet",
|
||||
"emptySearch": "No repositories match “{{query}}”",
|
||||
"emptyStarred": "You haven't starred any repositories",
|
||||
"private": "Private",
|
||||
"fork": "Fork",
|
||||
"archived": "Archived",
|
||||
"template": "Template",
|
||||
"mirror": "Mirror",
|
||||
"updated": "Updated {{when}}",
|
||||
"createdAt": "Created {{when}}",
|
||||
"owner": "Owner"
|
||||
},
|
||||
"repo": {
|
||||
"overview": "Overview",
|
||||
"files": "Files",
|
||||
"commits": "Commits",
|
||||
"branches": "Branches",
|
||||
"tags": "Tags",
|
||||
"issuesTab": "Issues",
|
||||
"pullsTab": "Pull requests",
|
||||
"readme": "README",
|
||||
"description": "Description",
|
||||
"defaultBranch": "Default branch",
|
||||
"topics": "Topics",
|
||||
"statistics": "Statistics",
|
||||
"stars": "Stars",
|
||||
"forks": "Forks",
|
||||
"watchers": "Watchers",
|
||||
"openIssues": "Open issues",
|
||||
"openPulls": "Open pull requests",
|
||||
"releases": "Releases",
|
||||
"language": "Language",
|
||||
"size": "Size",
|
||||
"license": "License",
|
||||
"createdAt": "Created",
|
||||
"updatedAt": "Updated",
|
||||
"pushedAt": "Last push",
|
||||
"noDescription": "No description provided",
|
||||
"notFound": "This repository could not be found.",
|
||||
"noPermission": "You don't have permission to view this repository.",
|
||||
"viewOnInstance": "Open in browser",
|
||||
"browse": "Browse",
|
||||
"empty": "This repository is empty",
|
||||
"noReadme": "No README file",
|
||||
"languages": "Languages"
|
||||
},
|
||||
"files": {
|
||||
"title": "Files",
|
||||
"root": "root",
|
||||
"empty": "This folder is empty",
|
||||
"binary": "Binary file — no preview",
|
||||
"large": "This file is large ({{size}}). Preview may be incomplete.",
|
||||
"image": "Image preview",
|
||||
"lines": "{{count}} lines",
|
||||
"loadingFile": "Loading file…",
|
||||
"rawUnavailable": "File contents could not be loaded.",
|
||||
"submodule": "Submodule",
|
||||
"symlink": "Symlink to {{target}}",
|
||||
"currentRef": "Branch: {{ref}}",
|
||||
"pathNotFound": "This path does not exist in the repository."
|
||||
},
|
||||
"commits": {
|
||||
"title": "Commits",
|
||||
"empty": "No commits yet",
|
||||
"emptyPath": "No commits for this path",
|
||||
"stats": "+{{additions}} −{{deletions}}",
|
||||
"filesChanged": "{{count}} files changed",
|
||||
"verified": "Verified",
|
||||
"unverified": "Unverified signature",
|
||||
"commitTitle": "Commit {{sha}}",
|
||||
"parents": "Parents",
|
||||
"changes": "Changes",
|
||||
"message": "Message",
|
||||
"author": "Author",
|
||||
"committer": "Committed",
|
||||
"showAllFiles": "Show all files",
|
||||
"fileFilter": "File: {{path}}",
|
||||
"diff": "Diff"
|
||||
},
|
||||
"branches": {
|
||||
"title": "Branches",
|
||||
"searchPlaceholder": "Search branches",
|
||||
"current": "Current",
|
||||
"protected": "Protected",
|
||||
"default": "Default",
|
||||
"empty": "No branches found",
|
||||
"tagsTitle": "Tags",
|
||||
"emptyTags": "No tags yet"
|
||||
},
|
||||
"issues": {
|
||||
"title": "Issues",
|
||||
"searchPlaceholder": "Search issues",
|
||||
"assigned": "Assigned",
|
||||
"created": "Authored",
|
||||
"mentioned": "Mentioned",
|
||||
"stateOpen": "Open",
|
||||
"stateClosed": "Closed",
|
||||
"stateAll": "All",
|
||||
"emptyAssigned": "No issues are assigned to you",
|
||||
"emptyCreated": "You haven't created any issues",
|
||||
"emptySearch": "No issues match “{{query}}”",
|
||||
"comments": "{{count}} comments",
|
||||
"open": "Open",
|
||||
"closed": "Closed",
|
||||
"inRepository": "in {{repository}}",
|
||||
"detailsUnavailable": "Issue details are not available yet.",
|
||||
"openedBy": "Opened by {{name}}",
|
||||
"assignedTo": "Assigned to {{name}}",
|
||||
"labels": "Labels",
|
||||
"milestone": "Milestone",
|
||||
"noDescription": "No description provided",
|
||||
"notFound": "This issue could not be found."
|
||||
},
|
||||
"pulls": {
|
||||
"title": "Pull requests",
|
||||
"searchPlaceholder": "Search pull requests",
|
||||
"reviewRequested": "Review requested",
|
||||
"created": "Authored",
|
||||
"stateOpen": "Open",
|
||||
"stateClosed": "Closed",
|
||||
"stateMerged": "Merged",
|
||||
"stateAll": "All",
|
||||
"draft": "Draft",
|
||||
"emptyReview": "No pull requests are waiting for your review",
|
||||
"emptyCreated": "You haven't created any pull requests",
|
||||
"emptySearch": "No pull requests match “{{query}}”",
|
||||
"into": "{{head}} → {{base}}",
|
||||
"detailsUnavailable": "Pull request details are not available yet.",
|
||||
"openedBy": "Opened by {{name}}",
|
||||
"reviewers": "Reviewers",
|
||||
"noDescription": "No description provided",
|
||||
"changedFiles": "{{count}} files changed",
|
||||
"notFound": "This pull request could not be found."
|
||||
},
|
||||
"inbox": {
|
||||
"title": "Inbox",
|
||||
"filterUnread": "Unread",
|
||||
"filterAll": "All",
|
||||
"markRead": "Mark as read",
|
||||
"markAllRead": "Mark all as read",
|
||||
"empty": "You're all caught up",
|
||||
"emptyUnread": "No unread notifications",
|
||||
"typeIssue": "Issue",
|
||||
"typePull": "Pull request",
|
||||
"typeCommit": "Commit",
|
||||
"typeRepository": "Repository",
|
||||
"unread": "Unread",
|
||||
"unreadBadge": "{{count}} unread",
|
||||
"inRepository": "{{repository}}",
|
||||
"openFailed": "This notification could not be opened."
|
||||
},
|
||||
"settings": {
|
||||
"title": "Settings",
|
||||
"appearance": "Appearance",
|
||||
"theme": "Theme",
|
||||
"themeSystem": "System",
|
||||
"themeLight": "Light",
|
||||
"themeDark": "Dark",
|
||||
"language": "Language",
|
||||
"languageSystem": "System default",
|
||||
"security": "Security",
|
||||
"biometrics": "Biometric app lock",
|
||||
"biometricsHelp": "Require Face ID, fingerprint or device credentials when reopening the app.",
|
||||
"biometricsUnavailable": "No biometric hardware or enrolled credentials on this device.",
|
||||
"notifications": "Notifications",
|
||||
"pollInterval": "Refresh interval",
|
||||
"pollIntervalManual": "Manual only",
|
||||
"pollIntervalSeconds": "{{count}} seconds",
|
||||
"data": "Data",
|
||||
"clearCache": "Clear cached data",
|
||||
"clearCacheTitle": "Clear cached data?",
|
||||
"clearCacheConfirm": "This removes all cached repository data. Your accounts stay signed in.",
|
||||
"clearCacheDone": "Cached data cleared",
|
||||
"accounts": "Accounts and instances",
|
||||
"about": "About",
|
||||
"version": "Version {{version}}",
|
||||
"aboutBody": "Gitea Native is an unofficial, open-source client for Gitea. It is not affiliated with, endorsed by, or connected to the Gitea project or Codeberg.",
|
||||
"giteaProject": "Gitea project"
|
||||
},
|
||||
"accounts": {
|
||||
"title": "Accounts",
|
||||
"active": "Active",
|
||||
"switchTo": "Switch to {{name}}",
|
||||
"addAccount": "Add account",
|
||||
"addFirstAccount": "Connect your first Gitea instance",
|
||||
"instances": "Instances",
|
||||
"accountsOnInstance": "{{count}} accounts",
|
||||
"accountOnInstance": "1 account",
|
||||
"removeAccountTitle": "Remove account?",
|
||||
"removeAccountBody": "{{name}} is removed from this device and its access token is deleted from the keychain. Cached data for this account is cleared.",
|
||||
"removeInstanceTitle": "Disconnect instance?",
|
||||
"removeInstanceBody": "All accounts on {{instance}} are removed from this device, including their tokens and cached data.",
|
||||
"removeDone": "Account removed",
|
||||
"disconnectDone": "Instance disconnected",
|
||||
"noAccounts": "No accounts yet",
|
||||
"signedInAs": "Signed in as {{name}}",
|
||||
"instance": "Instance",
|
||||
"version": "Gitea {{version}}"
|
||||
},
|
||||
"errors": {
|
||||
"title": "Something went wrong",
|
||||
"network": "Could not reach the server. Check your connection and try again.",
|
||||
"timeout": "The server took too long to respond.",
|
||||
"unauthorized": "Your access token is no longer valid. Sign in again to continue.",
|
||||
"forbidden": "You don't have permission to do that.",
|
||||
"notFound": "Not found on this instance.",
|
||||
"rateLimit": "The instance is rate limiting requests. Try again in a moment.",
|
||||
"server": "The instance returned an error. Try again later.",
|
||||
"conflict": "The file changed on the server since you loaded it.",
|
||||
"invalidResponse": "The server sent a response the app could not read.",
|
||||
"unknown": "Unexpected error.",
|
||||
"empty": "Nothing here yet",
|
||||
"offline": "You appear to be offline. Showing cached data where available."
|
||||
},
|
||||
"time": {
|
||||
"justNow": "just now",
|
||||
"minutesAgo": "{{count}}m ago",
|
||||
"hoursAgo": "{{count}}h ago",
|
||||
"daysAgo": "{{count}}d ago",
|
||||
"weeksAgo": "{{count}}w ago"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
{
|
||||
"common": {
|
||||
"appName": "Gitea Native",
|
||||
"tagline": "Onofficiële Gitea-client",
|
||||
"unofficialNotice": "Onofficieel — niet gelieerd aan het Gitea-project",
|
||||
"cancel": "Annuleren",
|
||||
"close": "Sluiten",
|
||||
"retry": "Opnieuw proberen",
|
||||
"save": "Opslaan",
|
||||
"done": "Klaar",
|
||||
"delete": "Verwijderen",
|
||||
"remove": "Verwijderen",
|
||||
"disconnect": "Loskoppelen",
|
||||
"confirm": "Bevestigen",
|
||||
"edit": "Bewerken",
|
||||
"refresh": "Vernieuwen",
|
||||
"search": "Zoeken",
|
||||
"clear": "Wissen",
|
||||
"loading": "Laden…",
|
||||
"viewAll": "Alles bekijken",
|
||||
"back": "Terug",
|
||||
"signIn": "Inloggen",
|
||||
"signOut": "Uitloggen",
|
||||
"optional": "optioneel",
|
||||
"required": "verplicht",
|
||||
"copy": "Kopiëren",
|
||||
"copied": "Gekopieerd",
|
||||
"unknown": "Onbekend",
|
||||
"never": "Nooit",
|
||||
"add": "Toevoegen",
|
||||
"showSecret": "Waarde tonen",
|
||||
"hideSecret": "Waarde verbergen",
|
||||
"clearField": "Veld wissen"
|
||||
},
|
||||
"tabs": {
|
||||
"home": "Home",
|
||||
"repositories": "Repository's",
|
||||
"issues": "Issues",
|
||||
"pullRequests": "Pull requests",
|
||||
"inbox": "Inbox"
|
||||
},
|
||||
"auth": {
|
||||
"welcome": {
|
||||
"title": "Jouw Gitea, in je zak",
|
||||
"subtitle": "Doorblader repository's, issues, pull requests en notificaties van elke zelf-gehoste Gitea-instance.",
|
||||
"disclaimer": "Gitea Native is een onofficiële client met open broncode. Het project is niet gelieerd aan, en niet door het Gitea-project goedgekeurd.",
|
||||
"connectButton": "Instance koppelen",
|
||||
"yourAccounts": "Jouw accounts"
|
||||
},
|
||||
"connect": {
|
||||
"title": "Instance koppelen",
|
||||
"instanceUrl": "Instance-adres",
|
||||
"instanceUrlPlaceholder": "https://codeberg.org",
|
||||
"instanceUrlHelp": "Het adres van je Gitea-instance. Externe instances moeten HTTPS gebruiken.",
|
||||
"token": "Personal access token",
|
||||
"tokenPlaceholder": "Plak je token",
|
||||
"tokenHelp": "Maak een token in Gitea → Instellingen → Toepassingen → Token genereren. Het wordt veilig in de keychain van je apparaat opgeslagen en verlaat je apparaat alleen om met deze instance te praten.",
|
||||
"label": "Label",
|
||||
"labelPlaceholder": "Werk, privé…",
|
||||
"submit": "Valideren en koppelen",
|
||||
"validating": "Referenties valideren…",
|
||||
"saving": "Opslaan…",
|
||||
"checkingVersion": "Instance bereiken…"
|
||||
},
|
||||
"errors": {
|
||||
"url": "Dat instance-adres is ongeldig.",
|
||||
"token": "Voer je personal access token in.",
|
||||
"insecure": "Externe instances moeten HTTPS gebruiken.",
|
||||
"network": "De instance was niet bereikbaar. Controleer het adres en je verbinding.",
|
||||
"auth": "Het token is door deze instance geweigerd. Controleer of het geldig is en niet verlopen.",
|
||||
"forbidden": "Dit token heeft geen toegang tot je account.",
|
||||
"generic": "Koppelen met deze instance is mislukt."
|
||||
}
|
||||
},
|
||||
"lock": {
|
||||
"title": "App vergrendeld",
|
||||
"subtitle": "Verifieer om Gitea Native te ontgrendelen",
|
||||
"unlock": "Ontgrendelen",
|
||||
"unlocking": "Verifiëren…",
|
||||
"biometricPrompt": "Ontgrendel Gitea Native",
|
||||
"failed": "Verificatie mislukt. Probeer het opnieuw.",
|
||||
"unavailable": "Biometrisch ontgrendelen is niet beschikbaar. Schakel het uit bij Instellingen om verder te gaan.",
|
||||
"notConfigured": "Stel gezichtsherkenning, vingerafdruk of schermvergrendeling in bij je apparaatinstellingen."
|
||||
},
|
||||
"home": {
|
||||
"greeting": "Ingelogd als {{name}}",
|
||||
"instanceOn": "op {{instance}}",
|
||||
"shortcuts": "Snelkoppelingen",
|
||||
"shortcutRepositories": "Repository's",
|
||||
"shortcutIssues": "Jouw issues",
|
||||
"shortcutPulls": "Jouw pull requests",
|
||||
"shortcutInbox": "Inbox",
|
||||
"recentRepos": "Recente repository's",
|
||||
"assignedIssues": "Aan jou toegewezen",
|
||||
"reviewPulls": "Review gevraagd",
|
||||
"activity": "Recente activiteit",
|
||||
"unreadNotifications": "{{count}} ongelezen notificaties",
|
||||
"emptyRepos": "Nog geen repository's",
|
||||
"emptyIssues": "Er is niets aan jou toegewezen",
|
||||
"emptyPulls": "Geen pull requests vragen om jouw aandacht",
|
||||
"emptyActivity": "Geen recente activiteit"
|
||||
},
|
||||
"repositories": {
|
||||
"title": "Repository's",
|
||||
"searchPlaceholder": "Zoek repository's",
|
||||
"sortUpdated": "Recent bijgewerkt",
|
||||
"sortName": "Naam",
|
||||
"sortStars": "Meeste sterren",
|
||||
"sortCreated": "Recent aangemaakt",
|
||||
"visibilityAll": "Alle",
|
||||
"visibilityPrivate": "Privé",
|
||||
"visibilityPublic": "Publiek",
|
||||
"starred": "Met ster",
|
||||
"all": "Alle",
|
||||
"empty": "Nog geen repository's",
|
||||
"emptySearch": "Geen repository's gevonden voor “{{query}}”",
|
||||
"emptyStarred": "Je hebt nog geen repository's met een ster gegeven",
|
||||
"private": "Privé",
|
||||
"fork": "Fork",
|
||||
"archived": "Gearchiveerd",
|
||||
"template": "Sjabloon",
|
||||
"mirror": "Mirror",
|
||||
"updated": "Bijgewerkt {{when}}",
|
||||
"createdAt": "Aangemaakt {{when}}",
|
||||
"owner": "Eigenaar"
|
||||
},
|
||||
"repo": {
|
||||
"overview": "Overzicht",
|
||||
"files": "Bestanden",
|
||||
"commits": "Commits",
|
||||
"branches": "Branches",
|
||||
"tags": "Tags",
|
||||
"issuesTab": "Issues",
|
||||
"pullsTab": "Pull requests",
|
||||
"readme": "README",
|
||||
"description": "Beschrijving",
|
||||
"defaultBranch": "Standaardbranch",
|
||||
"topics": "Onderwerpen",
|
||||
"statistics": "Statistieken",
|
||||
"stars": "Sterren",
|
||||
"forks": "Forks",
|
||||
"watchers": "Volgers",
|
||||
"openIssues": "Open issues",
|
||||
"openPulls": "Open pull requests",
|
||||
"releases": "Releases",
|
||||
"language": "Taal",
|
||||
"size": "Grootte",
|
||||
"license": "Licentie",
|
||||
"createdAt": "Aangemaakt",
|
||||
"updatedAt": "Bijgewerkt",
|
||||
"pushedAt": "Laatste push",
|
||||
"noDescription": "Geen beschrijving opgegeven",
|
||||
"notFound": "Deze repository kon niet worden gevonden.",
|
||||
"noPermission": "Je hebt geen rechten om deze repository te bekijken.",
|
||||
"viewOnInstance": "Openen in browser",
|
||||
"browse": "Bladeren",
|
||||
"empty": "Deze repository is leeg",
|
||||
"noReadme": "Geen README-bestand",
|
||||
"languages": "Talen"
|
||||
},
|
||||
"files": {
|
||||
"title": "Bestanden",
|
||||
"root": "root",
|
||||
"empty": "Deze map is leeg",
|
||||
"binary": "Binair bestand — geen voorbeeld",
|
||||
"large": "Dit bestand is groot ({{size}}). Het voorbeeld is mogelijk onvolledig.",
|
||||
"image": "Afbeeldingsvoorbeeld",
|
||||
"lines": "{{count}} regels",
|
||||
"loadingFile": "Bestand laden…",
|
||||
"rawUnavailable": "De bestandsinhoud kon niet worden geladen.",
|
||||
"submodule": "Submodule",
|
||||
"symlink": "Symlink naar {{target}}",
|
||||
"currentRef": "Branch: {{ref}}",
|
||||
"pathNotFound": "Dit pad bestaat niet in de repository."
|
||||
},
|
||||
"commits": {
|
||||
"title": "Commits",
|
||||
"empty": "Nog geen commits",
|
||||
"emptyPath": "Geen commits voor dit pad",
|
||||
"stats": "+{{additions}} −{{deletions}}",
|
||||
"filesChanged": "{{count}} bestanden gewijzigd",
|
||||
"verified": "Geverifieerd",
|
||||
"unverified": "Ongeldige handtekening",
|
||||
"commitTitle": "Commit {{sha}}",
|
||||
"parents": "Ouders",
|
||||
"changes": "Wijzigingen",
|
||||
"message": "Bericht",
|
||||
"author": "Auteur",
|
||||
"committer": "Gecommit door",
|
||||
"showAllFiles": "Alle bestanden tonen",
|
||||
"fileFilter": "Bestand: {{path}}",
|
||||
"diff": "Diff"
|
||||
},
|
||||
"branches": {
|
||||
"title": "Branches",
|
||||
"searchPlaceholder": "Zoek branches",
|
||||
"current": "Huidig",
|
||||
"protected": "Beschermd",
|
||||
"default": "Standaard",
|
||||
"empty": "Geen branches gevonden",
|
||||
"tagsTitle": "Tags",
|
||||
"emptyTags": "Nog geen tags"
|
||||
},
|
||||
"issues": {
|
||||
"title": "Issues",
|
||||
"searchPlaceholder": "Zoek issues",
|
||||
"assigned": "Toegewezen",
|
||||
"created": "Gemaakt",
|
||||
"mentioned": "Genoemd",
|
||||
"stateOpen": "Open",
|
||||
"stateClosed": "Gesloten",
|
||||
"stateAll": "Alle",
|
||||
"emptyAssigned": "Er zijn geen issues aan jou toegewezen",
|
||||
"emptyCreated": "Je hebt nog geen issues aangemaakt",
|
||||
"emptySearch": "Geen issues gevonden voor “{{query}}”",
|
||||
"comments": "{{count}} reacties",
|
||||
"open": "Open",
|
||||
"closed": "Gesloten",
|
||||
"inRepository": "in {{repository}}",
|
||||
"detailsUnavailable": "Issue-details zijn nog niet beschikbaar.",
|
||||
"openedBy": "Geopend door {{name}}",
|
||||
"assignedTo": "Toegewezen aan {{name}}",
|
||||
"labels": "Labels",
|
||||
"milestone": "Mijlpaal",
|
||||
"noDescription": "Geen beschrijving opgegeven",
|
||||
"notFound": "Deze issue kon niet worden gevonden."
|
||||
},
|
||||
"pulls": {
|
||||
"title": "Pull requests",
|
||||
"searchPlaceholder": "Zoek pull requests",
|
||||
"reviewRequested": "Review gevraagd",
|
||||
"created": "Gemaakt",
|
||||
"stateOpen": "Open",
|
||||
"stateClosed": "Gesloten",
|
||||
"stateMerged": "Gemerged",
|
||||
"stateAll": "Alle",
|
||||
"draft": "Concept",
|
||||
"emptyReview": "Geen pull requests wachten op jouw review",
|
||||
"emptyCreated": "Je hebt nog geen pull requests aangemaakt",
|
||||
"emptySearch": "Geen pull requests gevonden voor “{{query}}”",
|
||||
"into": "{{head}} → {{base}}",
|
||||
"detailsUnavailable": "Pull request-details zijn nog niet beschikbaar.",
|
||||
"openedBy": "Geopend door {{name}}",
|
||||
"reviewers": "Reviewers",
|
||||
"noDescription": "Geen beschrijving opgegeven",
|
||||
"changedFiles": "{{count}} bestanden gewijzigd",
|
||||
"notFound": "Deze pull request kon niet worden gevonden."
|
||||
},
|
||||
"inbox": {
|
||||
"title": "Inbox",
|
||||
"filterUnread": "Ongelezen",
|
||||
"filterAll": "Alle",
|
||||
"markRead": "Markeren als gelezen",
|
||||
"markAllRead": "Alles markeren als gelezen",
|
||||
"empty": "Je bent helemaal bij",
|
||||
"emptyUnread": "Geen ongelezen notificaties",
|
||||
"typeIssue": "Issue",
|
||||
"typePull": "Pull request",
|
||||
"typeCommit": "Commit",
|
||||
"typeRepository": "Repository",
|
||||
"unread": "Ongelezen",
|
||||
"unreadBadge": "{{count}} ongelezen",
|
||||
"inRepository": "{{repository}}",
|
||||
"openFailed": "Deze notificatie kon niet worden geopend."
|
||||
},
|
||||
"settings": {
|
||||
"title": "Instellingen",
|
||||
"appearance": "Weergave",
|
||||
"theme": "Thema",
|
||||
"themeSystem": "Systeem",
|
||||
"themeLight": "Licht",
|
||||
"themeDark": "Donker",
|
||||
"language": "Taal",
|
||||
"languageSystem": "Systeemstandaard",
|
||||
"security": "Beveiliging",
|
||||
"biometrics": "App vergrendelen met biometrie",
|
||||
"biometricsHelp": "Vraag om gezichtsherkenning, vingerafdruk of apparaatcode bij het heropenen van de app.",
|
||||
"biometricsUnavailable": "Geen biometrische hardware of geregistreerde referenties op dit apparaat.",
|
||||
"notifications": "Notificaties",
|
||||
"pollInterval": "Vernieuwingsinterval",
|
||||
"pollIntervalManual": "Alleen handmatig",
|
||||
"pollIntervalSeconds": "{{count}} seconden",
|
||||
"data": "Gegevens",
|
||||
"clearCache": "Cachegegevens wissen",
|
||||
"clearCacheTitle": "Cachegegevens wissen?",
|
||||
"clearCacheConfirm": "Dit verwijdert alle gecachte repository-gegevens. Je accounts blijven ingelogd.",
|
||||
"clearCacheDone": "Cache gewist",
|
||||
"accounts": "Accounts en instances",
|
||||
"about": "Over",
|
||||
"version": "Versie {{version}}",
|
||||
"aboutBody": "Gitea Native is een onofficiële client met open broncode voor Gitea. Het project is niet gelieerd aan, en niet door het Gitea-project of Codeberg goedgekeurd.",
|
||||
"giteaProject": "Gitea-project"
|
||||
},
|
||||
"accounts": {
|
||||
"title": "Accounts",
|
||||
"active": "Actief",
|
||||
"switchTo": "Schakel naar {{name}}",
|
||||
"addAccount": "Account toevoegen",
|
||||
"addFirstAccount": "Koppel je eerste Gitea-instance",
|
||||
"instances": "Instances",
|
||||
"accountsOnInstance": "{{count}} accounts",
|
||||
"accountOnInstance": "1 account",
|
||||
"removeAccountTitle": "Account verwijderen?",
|
||||
"removeAccountBody": "{{name}} wordt van dit apparaat verwijderd en het toegangstoken wordt uit de keychain gewist. Gecachte gegevens van dit account worden gewist.",
|
||||
"removeInstanceTitle": "Instance loskoppelen?",
|
||||
"removeInstanceBody": "Alle accounts op {{instance}} worden van dit apparaat verwijderd, inclusief hun tokens en gecachte gegevens.",
|
||||
"removeDone": "Account verwijderd",
|
||||
"disconnectDone": "Instance losgekoppeld",
|
||||
"noAccounts": "Nog geen accounts",
|
||||
"signedInAs": "Ingelogd als {{name}}",
|
||||
"instance": "Instance",
|
||||
"version": "Gitea {{version}}"
|
||||
},
|
||||
"errors": {
|
||||
"title": "Er is iets misgegaan",
|
||||
"network": "De server was niet bereikbaar. Controleer je verbinding en probeer het opnieuw.",
|
||||
"timeout": "De server reageerde te langzaam.",
|
||||
"unauthorized": "Je toegangstoken is niet meer geldig. Log opnieuw in om verder te gaan.",
|
||||
"forbidden": "Je hebt geen rechten om dat te doen.",
|
||||
"notFound": "Niet gevonden op deze instance.",
|
||||
"rateLimit": "De instance limiteert de verzoeken. Probeer het zo opnieuw.",
|
||||
"server": "De instance gaf een fout. Probeer het later opnieuw.",
|
||||
"conflict": "Het bestand is op de server gewijzigd sinds je het hebt geladen.",
|
||||
"invalidResponse": "De server stuurde een reactie die de app niet kon lezen.",
|
||||
"unknown": "Onverwachte fout.",
|
||||
"empty": "Nog niets hier",
|
||||
"offline": "Je lijkt offline te zijn. Gecachte gegevens worden waar mogelijk getoond."
|
||||
},
|
||||
"time": {
|
||||
"justNow": "zojuist",
|
||||
"minutesAgo": "{{count}} min geleden",
|
||||
"hoursAgo": "{{count}} u geleden",
|
||||
"daysAgo": "{{count}} d geleden",
|
||||
"weeksAgo": "{{count}} w geleden"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { AccountsScreen } from '@/features/accounts/screens/accounts-screen';
|
||||
import { AddAccountScreen } from '@/features/accounts/screens/add-account-screen';
|
||||
import { useStackScreenOptions } from '@/navigation/header-options';
|
||||
import type { AccountsStackParamList } from '@/navigation/types';
|
||||
|
||||
const Stack = createNativeStackNavigator<AccountsStackParamList>();
|
||||
|
||||
export function AccountsNavigator() {
|
||||
const { t } = useTranslation();
|
||||
const screenOptions = useStackScreenOptions();
|
||||
|
||||
return (
|
||||
<Stack.Navigator screenOptions={screenOptions}>
|
||||
<Stack.Screen
|
||||
name="Accounts"
|
||||
component={AccountsScreen}
|
||||
options={{ title: t('accounts.title') }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="AddAccount"
|
||||
component={AddAccountScreen}
|
||||
options={{ title: t('accounts.addAccount') }}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { ConnectScreen } from '@/features/auth/screens/connect-screen';
|
||||
import { WelcomeScreen } from '@/features/auth/screens/welcome-screen';
|
||||
import { useStackScreenOptions } from '@/navigation/header-options';
|
||||
import type { AuthStackParamList } from '@/navigation/types';
|
||||
|
||||
const Stack = createNativeStackNavigator<AuthStackParamList>();
|
||||
|
||||
export function AuthNavigator() {
|
||||
const { t } = useTranslation();
|
||||
const screenOptions = useStackScreenOptions();
|
||||
|
||||
return (
|
||||
<Stack.Navigator screenOptions={screenOptions}>
|
||||
<Stack.Screen name="Welcome" component={WelcomeScreen} options={{ headerShown: false }} />
|
||||
<Stack.Screen
|
||||
name="Connect"
|
||||
component={ConnectScreen}
|
||||
options={{ title: t('auth.connect.title') }}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Shared native-stack screen options derived from the active theme, so every
|
||||
* stack (tabs, repository, settings, accounts) renders identical headers.
|
||||
*/
|
||||
|
||||
import { useMemo } from 'react';
|
||||
import type { NativeStackNavigationOptions } from '@react-navigation/native-stack';
|
||||
|
||||
import { useTheme } from '@/theme/theme-provider';
|
||||
|
||||
export function useStackScreenOptions(): NativeStackNavigationOptions {
|
||||
const { colors } = useTheme();
|
||||
return useMemo(
|
||||
() => ({
|
||||
headerStyle: { backgroundColor: colors.surface },
|
||||
headerTintColor: colors.text,
|
||||
headerTitleStyle: { color: colors.text },
|
||||
headerShadowVisible: false,
|
||||
headerBackButtonDisplayMode: 'minimal',
|
||||
contentStyle: { backgroundColor: colors.background },
|
||||
}),
|
||||
[colors],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* Deep linking config.
|
||||
*
|
||||
* Custom scheme: `giteanative://…` (see app.json).
|
||||
* Universal links are intentionally not claimed — the app is unofficial and
|
||||
* has no associated-domains entitlement configured.
|
||||
*/
|
||||
|
||||
import * as Linking from 'expo-linking';
|
||||
|
||||
import type { LinkingOptions } from '@react-navigation/native';
|
||||
|
||||
import type { RootStackParamList } from './types';
|
||||
|
||||
const prefixes = [Linking.createURL('/')];
|
||||
|
||||
export const linking: LinkingOptions<RootStackParamList> = {
|
||||
prefixes,
|
||||
config: {
|
||||
screens: {
|
||||
Auth: {
|
||||
screens: {
|
||||
Welcome: 'welcome',
|
||||
Connect: 'connect',
|
||||
},
|
||||
},
|
||||
Main: {
|
||||
screens: {
|
||||
HomeTab: {
|
||||
screens: { Home: 'home' },
|
||||
},
|
||||
RepositoriesTab: {
|
||||
screens: { RepositoryList: 'repositories' },
|
||||
},
|
||||
IssuesTab: {
|
||||
screens: { Issues: 'issues' },
|
||||
},
|
||||
PullsTab: {
|
||||
screens: { PullRequests: 'pull-requests' },
|
||||
},
|
||||
InboxTab: {
|
||||
screens: { Inbox: 'inbox' },
|
||||
},
|
||||
},
|
||||
},
|
||||
Repository: {
|
||||
screens: {
|
||||
RepoOverview: 'repo/:owner/:name',
|
||||
Files: 'repo/:owner/:name/tree/:path',
|
||||
FileViewer: 'repo/:owner/:name/blob/:path',
|
||||
Commits: 'repo/:owner/:name/commits',
|
||||
CommitDetail: 'repo/:owner/:name/commit/:sha',
|
||||
Branches: 'repo/:owner/:name/branches',
|
||||
Tags: 'repo/:owner/:name/tags',
|
||||
RepoIssues: 'repo/:owner/:name/issues',
|
||||
IssueDetail: 'repo/:owner/:name/issue/:index',
|
||||
RepoPulls: 'repo/:owner/:name/pulls',
|
||||
PullDetail: 'repo/:owner/:name/pull/:index',
|
||||
},
|
||||
},
|
||||
Settings: {
|
||||
screens: { Settings: 'settings' },
|
||||
},
|
||||
Accounts: {
|
||||
screens: { Accounts: 'accounts', AddAccount: 'accounts/add' },
|
||||
},
|
||||
},
|
||||
},
|
||||
// getInitialURL / subscribe default to React Native's Linking, which is what
|
||||
// we want; Expo's `Linking.createURL` above covers Expo Go/scheme handling.
|
||||
};
|
||||
@@ -0,0 +1,82 @@
|
||||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { Icon, type IconName } from '@/components/ui/icon';
|
||||
import { useUnreadCount } from '@/features/notifications/queries';
|
||||
import { useSettingsStore } from '@/features/settings/settings-store';
|
||||
import { useTheme } from '@/theme/theme-provider';
|
||||
import {
|
||||
HomeStackNavigator,
|
||||
InboxStackNavigator,
|
||||
IssuesStackNavigator,
|
||||
PullsStackNavigator,
|
||||
RepositoriesStackNavigator,
|
||||
} from '@/navigation/tab-stacks';
|
||||
import type { MainTabParamList } from '@/navigation/types';
|
||||
|
||||
const Tab = createBottomTabNavigator<MainTabParamList>();
|
||||
|
||||
const TAB_ICONS: Record<keyof MainTabParamList, IconName> = {
|
||||
HomeTab: 'home',
|
||||
RepositoriesTab: 'repo',
|
||||
IssuesTab: 'issue',
|
||||
PullsTab: 'pullRequest',
|
||||
InboxTab: 'inbox',
|
||||
};
|
||||
|
||||
/** The five-tab shell. Headers live in the inner stacks, so they are hidden here. */
|
||||
export function MainTabs() {
|
||||
const { t } = useTranslation();
|
||||
const { colors } = useTheme();
|
||||
const pollSeconds = useSettingsStore((s) => s.notificationPollSeconds);
|
||||
const unread = useUnreadCount(pollSeconds);
|
||||
const unreadCount = unread.data?.count ?? 0;
|
||||
|
||||
return (
|
||||
<Tab.Navigator
|
||||
screenOptions={({ route }) => ({
|
||||
headerShown: false,
|
||||
tabBarActiveTintColor: colors.primary,
|
||||
tabBarInactiveTintColor: colors.textTertiary,
|
||||
tabBarStyle: {
|
||||
backgroundColor: colors.surface,
|
||||
borderTopColor: colors.border,
|
||||
},
|
||||
tabBarLabelStyle: { fontSize: 11 },
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Icon name={TAB_ICONS[route.name]} size={size} color={color} />
|
||||
),
|
||||
})}
|
||||
>
|
||||
<Tab.Screen
|
||||
name="HomeTab"
|
||||
component={HomeStackNavigator}
|
||||
options={{ title: t('tabs.home') }}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="RepositoriesTab"
|
||||
component={RepositoriesStackNavigator}
|
||||
options={{ title: t('tabs.repositories') }}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="IssuesTab"
|
||||
component={IssuesStackNavigator}
|
||||
options={{ title: t('tabs.issues') }}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="PullsTab"
|
||||
component={PullsStackNavigator}
|
||||
options={{ title: t('tabs.pullRequests') }}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="InboxTab"
|
||||
component={InboxStackNavigator}
|
||||
options={{
|
||||
title: t('tabs.inbox'),
|
||||
tabBarBadge: unreadCount > 0 ? unreadCount : undefined,
|
||||
tabBarBadgeStyle: { backgroundColor: colors.error, color: '#FFFFFF' },
|
||||
}}
|
||||
/>
|
||||
</Tab.Navigator>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* 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 { BranchesScreen } from '@/features/repository/screens/branches-screen';
|
||||
import { CommitDetailScreen } from '@/features/repository/screens/commit-detail-screen';
|
||||
import { CommitsScreen } from '@/features/repository/screens/commits-screen';
|
||||
import { FileViewerScreen } from '@/features/repository/screens/file-viewer-screen';
|
||||
import { FilesScreen } from '@/features/repository/screens/files-screen';
|
||||
import { IssueDetailScreen } from '@/features/repository/screens/issue-detail-screen';
|
||||
import { PullDetailScreen } from '@/features/repository/screens/pull-detail-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 { TagsScreen } from '@/features/repository/screens/tags-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="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="RepoIssues"
|
||||
component={RepoIssuesScreen}
|
||||
options={{ title: t('repo.issuesTab') }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="IssueDetail"
|
||||
component={IssueDetailScreen}
|
||||
options={({ route }) => ({ title: `#${route.params.index}` })}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="RepoPulls"
|
||||
component={RepoPullsScreen}
|
||||
options={{ title: t('repo.pullsTab') }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="PullDetail"
|
||||
component={PullDetailScreen}
|
||||
options={({ route }) => ({ title: `#${route.params.index}` })}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Root navigator.
|
||||
*
|
||||
* Renders either the auth flow (no signed-in account) or the main app. The
|
||||
* switch is driven entirely by session state, so connecting/disconnecting an
|
||||
* account transitions the UI without imperative navigation.
|
||||
*/
|
||||
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
|
||||
import { useSession } from '@/features/accounts/use-session';
|
||||
import { AccountsNavigator } from '@/navigation/accounts-navigator';
|
||||
import { AuthNavigator } from '@/navigation/auth-navigator';
|
||||
import { MainTabs } from '@/navigation/main-tabs';
|
||||
import { RepositoryNavigator } from '@/navigation/repository-navigator';
|
||||
import { SettingsNavigator } from '@/navigation/settings-navigator';
|
||||
import type { RootStackParamList } from '@/navigation/types';
|
||||
|
||||
const Stack = createNativeStackNavigator<RootStackParamList>();
|
||||
|
||||
export function RootNavigator() {
|
||||
const { hasAccounts, token } = useSession();
|
||||
const signedIn = hasAccounts && Boolean(token);
|
||||
|
||||
return (
|
||||
<Stack.Navigator screenOptions={{ headerShown: false }}>
|
||||
{signedIn ? (
|
||||
<>
|
||||
<Stack.Screen name="Main" component={MainTabs} />
|
||||
<Stack.Screen name="Repository" component={RepositoryNavigator} />
|
||||
<Stack.Screen name="Settings" component={SettingsNavigator} />
|
||||
<Stack.Screen
|
||||
name="Accounts"
|
||||
component={AccountsNavigator}
|
||||
options={{ presentation: 'modal' }}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<Stack.Screen name="Auth" component={AuthNavigator} />
|
||||
)}
|
||||
</Stack.Navigator>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { SettingsScreen } from '@/features/settings/screens/settings-screen';
|
||||
import { useStackScreenOptions } from '@/navigation/header-options';
|
||||
import type { SettingsStackParamList } from '@/navigation/types';
|
||||
|
||||
const Stack = createNativeStackNavigator<SettingsStackParamList>();
|
||||
|
||||
export function SettingsNavigator() {
|
||||
const { t } = useTranslation();
|
||||
const screenOptions = useStackScreenOptions();
|
||||
|
||||
return (
|
||||
<Stack.Navigator screenOptions={screenOptions}>
|
||||
<Stack.Screen
|
||||
name="Settings"
|
||||
component={SettingsScreen}
|
||||
options={{ title: t('settings.title') }}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* The native stack behind each bottom tab. Keeping a stack per tab gives every
|
||||
* tab its own header (title + account/settings actions) while sharing the
|
||||
* tab bar (which hides the redundant outer header).
|
||||
*/
|
||||
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { HeaderAccountAndSettings } from '@/components/layout/header-buttons';
|
||||
import { HomeScreen } from '@/features/home/screens/home-screen';
|
||||
import { InboxScreen } from '@/features/inbox/screens/inbox-screen';
|
||||
import { IssuesScreen } from '@/features/issues/screens/issues-screen';
|
||||
import { PullRequestsScreen } from '@/features/pulls/screens/pull-requests-screen';
|
||||
import { RepositoryListScreen } from '@/features/repositories/screens/repository-list-screen';
|
||||
import { useStackScreenOptions } from '@/navigation/header-options';
|
||||
import type {
|
||||
HomeStackParamList,
|
||||
InboxStackParamList,
|
||||
IssuesStackParamList,
|
||||
PullsStackParamList,
|
||||
RepositoriesStackParamList,
|
||||
} from '@/navigation/types';
|
||||
|
||||
function useTabHeader() {
|
||||
const screenOptions = useStackScreenOptions();
|
||||
return {
|
||||
...screenOptions,
|
||||
headerRight: () => <HeaderAccountAndSettings />,
|
||||
};
|
||||
}
|
||||
|
||||
const HomeStack = createNativeStackNavigator<HomeStackParamList>();
|
||||
export function HomeStackNavigator() {
|
||||
const { t } = useTranslation();
|
||||
const options = useTabHeader();
|
||||
return (
|
||||
<HomeStack.Navigator screenOptions={options}>
|
||||
<HomeStack.Screen name="Home" component={HomeScreen} options={{ title: t('tabs.home') }} />
|
||||
</HomeStack.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
const RepositoriesStack = createNativeStackNavigator<RepositoriesStackParamList>();
|
||||
export function RepositoriesStackNavigator() {
|
||||
const { t } = useTranslation();
|
||||
const options = useTabHeader();
|
||||
return (
|
||||
<RepositoriesStack.Navigator screenOptions={options}>
|
||||
<RepositoriesStack.Screen
|
||||
name="RepositoryList"
|
||||
component={RepositoryListScreen}
|
||||
options={{ title: t('tabs.repositories') }}
|
||||
/>
|
||||
</RepositoriesStack.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
const IssuesStack = createNativeStackNavigator<IssuesStackParamList>();
|
||||
export function IssuesStackNavigator() {
|
||||
const { t } = useTranslation();
|
||||
const options = useTabHeader();
|
||||
return (
|
||||
<IssuesStack.Navigator screenOptions={options}>
|
||||
<IssuesStack.Screen
|
||||
name="Issues"
|
||||
component={IssuesScreen}
|
||||
options={{ title: t('tabs.issues') }}
|
||||
/>
|
||||
</IssuesStack.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
const PullsStack = createNativeStackNavigator<PullsStackParamList>();
|
||||
export function PullsStackNavigator() {
|
||||
const { t } = useTranslation();
|
||||
const options = useTabHeader();
|
||||
return (
|
||||
<PullsStack.Navigator screenOptions={options}>
|
||||
<PullsStack.Screen
|
||||
name="PullRequests"
|
||||
component={PullRequestsScreen}
|
||||
options={{ title: t('tabs.pullRequests') }}
|
||||
/>
|
||||
</PullsStack.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
const InboxStack = createNativeStackNavigator<InboxStackParamList>();
|
||||
export function InboxStackNavigator() {
|
||||
const { t } = useTranslation();
|
||||
const options = useTabHeader();
|
||||
return (
|
||||
<InboxStack.Navigator screenOptions={options}>
|
||||
<InboxStack.Screen name="Inbox" component={InboxScreen} options={{ title: t('tabs.inbox') }} />
|
||||
</InboxStack.Navigator>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* React Navigation param lists. Every `useNavigation` / `useRoute` in the app
|
||||
* is typed against these — adding a screen means adding it here first.
|
||||
*/
|
||||
|
||||
import type { NavigatorScreenParams } from '@react-navigation/native';
|
||||
|
||||
export type AuthStackParamList = {
|
||||
Welcome: undefined;
|
||||
Connect: { baseUrl?: string } | undefined;
|
||||
};
|
||||
|
||||
export type HomeStackParamList = {
|
||||
Home: undefined;
|
||||
};
|
||||
|
||||
export type RepositoriesStackParamList = {
|
||||
RepositoryList: undefined;
|
||||
};
|
||||
|
||||
export type IssuesStackParamList = {
|
||||
Issues: undefined;
|
||||
};
|
||||
|
||||
export type PullsStackParamList = {
|
||||
PullRequests: undefined;
|
||||
};
|
||||
|
||||
export type InboxStackParamList = {
|
||||
Inbox: undefined;
|
||||
};
|
||||
|
||||
export type MainTabParamList = {
|
||||
HomeTab: NavigatorScreenParams<HomeStackParamList>;
|
||||
RepositoriesTab: NavigatorScreenParams<RepositoriesStackParamList>;
|
||||
IssuesTab: NavigatorScreenParams<IssuesStackParamList>;
|
||||
PullsTab: NavigatorScreenParams<PullsStackParamList>;
|
||||
InboxTab: NavigatorScreenParams<InboxStackParamList>;
|
||||
};
|
||||
|
||||
export type RepositoryStackParamList = {
|
||||
RepoOverview: { owner: string; name: string; ref?: string };
|
||||
Files: { owner: string; name: string; path?: string; ref?: string };
|
||||
FileViewer: { owner: string; name: string; path: string; ref?: string };
|
||||
Commits: { owner: string; name: string; sha?: string; path?: string };
|
||||
CommitDetail: { owner: string; name: string; sha: string };
|
||||
Branches: { owner: string; name: string };
|
||||
Tags: { owner: string; name: string };
|
||||
RepoIssues: { owner: string; name: string };
|
||||
IssueDetail: { owner: string; name: string; index: number };
|
||||
RepoPulls: { owner: string; name: string };
|
||||
PullDetail: { owner: string; name: string; index: number };
|
||||
};
|
||||
|
||||
export type SettingsStackParamList = {
|
||||
Settings: undefined;
|
||||
};
|
||||
|
||||
export type AccountsStackParamList = {
|
||||
Accounts: undefined;
|
||||
AddAccount: { baseUrl?: string } | undefined;
|
||||
};
|
||||
|
||||
export type RootStackParamList = {
|
||||
Auth: NavigatorScreenParams<AuthStackParamList>;
|
||||
Main: NavigatorScreenParams<MainTabParamList>;
|
||||
Repository: NavigatorScreenParams<RepositoryStackParamList>;
|
||||
Settings: NavigatorScreenParams<SettingsStackParamList>;
|
||||
Accounts: NavigatorScreenParams<AccountsStackParamList>;
|
||||
};
|
||||
|
||||
declare global {
|
||||
namespace ReactNavigation {
|
||||
// Empty interface intentionally augments the library's default param list.
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||
interface RootParamList extends RootStackParamList {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Screen prop helpers: every screen gets a navigation prop that is composed
|
||||
* with the main tabs and the root stack, so screens can navigate anywhere
|
||||
* (`navigation.navigate('Repository', …)`, `navigate('Settings')`, …) while
|
||||
* keeping full type safety.
|
||||
*/
|
||||
|
||||
import type { BottomTabScreenProps } from '@react-navigation/bottom-tabs';
|
||||
import type { CompositeScreenProps, ParamListBase } from '@react-navigation/native';
|
||||
import type { NativeStackScreenProps } from '@react-navigation/native-stack';
|
||||
|
||||
import type { MainTabParamList, RootStackParamList } from './types';
|
||||
|
||||
export type ScreenProps<
|
||||
Params extends ParamListBase,
|
||||
RouteName extends keyof Params & string,
|
||||
> = CompositeScreenProps<
|
||||
NativeStackScreenProps<Params, RouteName>,
|
||||
CompositeScreenProps<
|
||||
BottomTabScreenProps<MainTabParamList>,
|
||||
NativeStackScreenProps<RootStackParamList>
|
||||
>
|
||||
>;
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Typed handle on the *root* navigator.
|
||||
*
|
||||
* Screens nested inside a stack/tab use this to open root-level screens
|
||||
* (Settings, the Accounts modal) without fighting `CompositeScreenProps`
|
||||
* param-list merging when route names overlap between navigators.
|
||||
*/
|
||||
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
||||
|
||||
import type { RootStackParamList } from './types';
|
||||
|
||||
export type RootNavigationProp = NativeStackNavigationProp<RootStackParamList>;
|
||||
|
||||
export function useRootNavigation(): RootNavigationProp {
|
||||
return useNavigation<RootNavigationProp>();
|
||||
}
|
||||
Reference in new issue
Block a user