feat(features): auth, accounts, home, repositories, issues, notifications

- auth: welcome/connect screens, shared connect form, connect flow, app lock
- accounts: session hook, actions, switcher + add-account screens
- home: dashboard (identity, shortcuts, recent repos, assigned issues,
  review requests, activity, unread badge)
- repositories/repository: list+search, overview, files, file viewer,
  commits, commit detail, branches, tags, repo issues/pulls, issue/pull detail
- issues/notifications: cross-repo search, query hooks, inbox with read
  marking and lifecycle-aware polling
- settings: theme/language/biometrics/poll interval/cache/about
This commit is contained in:
JustZoe101 committed 2026-10-09 16:41:21 +02:00
1 parent ad81db07b3
commit 0a889ebfed
36 files changed
+4186

No files matched your search

@@ -0,0 +1,302 @@
import { useMemo } from 'react';
import { Linking, 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 { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Card } from '@/components/ui/card';
import { Icon } from '@/components/ui/icon';
import { LabelChip } from '@/components/ui/label-chip';
import { ListItem } from '@/components/ui/list-item';
import { ErrorState, LoadingView } from '@/components/ui/state-views';
import { apiErrorMessage } from '@/core/api/error-text';
import { useRepository, useRepositoryLanguages } from '@/features/repositories/queries';
import { useReadme } from '@/features/repository/queries';
import { useSession } from '@/features/accounts/use-session';
import { useTheme } from '@/theme/theme-provider';
import { radius, spacing } from '@/theme/tokens';
import type { RepositoryStackParamList } from '@/navigation/types';
import type { ScreenProps } from '@/navigation/typing';
type Props = ScreenProps<RepositoryStackParamList, 'RepoOverview'>;
/** Repository landing page: metadata, quick navigation, stats, languages, README. */
export function RepoOverviewScreen({ navigation, route }: Props) {
const { t } = useTranslation();
const { colors } = useTheme();
const { instance } = useSession();
const { owner, name, ref } = route.params;
const repoQuery = useRepository(owner, name);
const repo = repoQuery.data;
const readmeRef = ref ?? repo?.default_branch;
const readmeQuery = useReadme(owner, name, readmeRef);
const languagesQuery = useRepositoryLanguages(owner, name);
const languages = useMemo(() => {
const entries = Object.entries(languagesQuery.data ?? {});
const total = entries.reduce((sum, [, bytes]) => sum + bytes, 0);
if (total <= 0) return [];
return entries
.map(([language, bytes]) => ({ language, bytes, percent: (bytes / total) * 100 }))
.sort((a, b) => b.bytes - a.bytes)
.slice(0, 6);
}, [languagesQuery.data]);
if (!repo && repoQuery.isPending) return <LoadingView />;
if (!repo && repoQuery.isError) {
return (
<ErrorState
title={t('errors.title')}
body={apiErrorMessage(repoQuery.error, t)}
retryLabel={t('common.retry')}
onRetry={() => void repoQuery.refetch()}
/>
);
}
if (!repo) return null;
const readmeText = decodeReadme(readmeQuery.data?.content);
return (
<Screen scroll padded={false}>
{/* Header */}
<View style={[styles.header, { borderBottomColor: colors.border }]}>
<View style={styles.titleRow}>
<AppText variant="caption" tone="tertiary">
{owner}/
</AppText>
<AppText variant="title" numberOfLines={2} style={styles.name}>
{name}
</AppText>
</View>
<AppText variant="secondary" tone={repo.description ? 'secondary' : 'tertiary'}>
{repo.description ?? t('repo.noDescription')}
</AppText>
<View style={styles.badges}>
{repo.private ? <Badge tone="neutral" icon="lock">{t('repositories.private')}</Badge> : null}
{repo.fork ? <Badge tone="neutral" icon="fork">{t('repositories.fork')}</Badge> : null}
{repo.archived ? <Badge tone="warning" icon="shield">{t('repositories.archived')}</Badge> : null}
{repo.template ? <Badge tone="info" icon="package">{t('repositories.template')}</Badge> : null}
{repo.mirror ? <Badge tone="info" icon="autoRenew">{t('repositories.mirror')}</Badge> : null}
{repo.default_branch ? (
<Badge tone="primary" icon="branch">{repo.default_branch}</Badge>
) : null}
</View>
{repo.topics && repo.topics.length > 0 ? (
<View style={styles.badges}>
{repo.topics.slice(0, 8).map((topic) => (
<LabelChip key={topic} name={topic} />
))}
</View>
) : null}
{repo.html_url ? (
<Button
label={t('repo.viewOnInstance')}
variant="secondary"
iconLeft="externalLink"
onPress={() => void Linking.openURL(repo.html_url as string).catch(() => undefined)}
/>
) : null}
</View>
{/* Quick navigation */}
<View style={styles.section}>
<AppText variant="subheading" style={styles.sectionTitle}>
{t('repo.browse')}
</AppText>
<Card padded={false} variant="flat" style={styles.card}>
<ListItem
leadingIcon="folder"
title={t('repo.files')}
onPress={() => navigation.navigate('Files', { owner, name, ref: readmeRef })}
/>
<ListItem
leadingIcon="commit"
title={t('repo.commits')}
onPress={() => navigation.navigate('Commits', { owner, name, sha: readmeRef })}
/>
<ListItem
leadingIcon="branch"
title={t('repo.branches')}
onPress={() => navigation.navigate('Branches', { owner, name })}
/>
<ListItem
leadingIcon="tag"
title={t('repo.tags')}
onPress={() => navigation.navigate('Tags', { owner, name })}
/>
{repo.has_issues !== false ? (
<ListItem
leadingIcon="issue"
title={t('repo.issuesTab')}
rightText={repo.open_issues_count ? String(repo.open_issues_count) : undefined}
onPress={() => navigation.navigate('RepoIssues', { owner, name })}
/>
) : null}
{repo.has_pull_requests !== false ? (
<ListItem
leadingIcon="pullRequest"
title={t('repo.pullsTab')}
rightText={repo.open_pr_counter ? String(repo.open_pr_counter) : undefined}
onPress={() => navigation.navigate('RepoPulls', { owner, name })}
divider={false}
/>
) : null}
</Card>
</View>
{/* Statistics */}
<View style={styles.section}>
<AppText variant="subheading" style={styles.sectionTitle}>
{t('repo.statistics')}
</AppText>
<Card style={styles.card}>
<View style={styles.statsGrid}>
<Stat label={t('repo.stars')} value={repo.stars_count} icon="star" />
<Stat label={t('repo.forks')} value={repo.forks_count} icon="fork" />
<Stat label={t('repo.watchers')} value={repo.watchers_count} icon="eye" />
<Stat label={t('repo.openIssues')} value={repo.open_issues_count} icon="issue" />
<Stat label={t('repo.openPulls')} value={repo.open_pr_counter} icon="pullRequest" />
<Stat label={t('repo.releases')} value={repo.release_counter} icon="tag" />
</View>
</Card>
</View>
{/* Languages */}
{languages.length > 0 ? (
<View style={styles.section}>
<AppText variant="subheading" style={styles.sectionTitle}>
{t('repo.languages')}
</AppText>
<Card style={styles.card}>
<View style={[styles.langBar, { backgroundColor: colors.surfaceSecondary }]}>
{languages.map((entry, index) => (
<View
key={entry.language}
style={{
flex: entry.percent,
backgroundColor: languageColor(index, colors.primary),
}}
/>
))}
</View>
<View style={styles.langList}>
{languages.map((entry, index) => (
<View key={entry.language} style={styles.langItem}>
<View
style={[styles.langDot, { backgroundColor: languageColor(index, colors.primary) }]}
/>
<AppText variant="caption" style={styles.langName} numberOfLines={1}>
{entry.language}
</AppText>
<AppText variant="caption" tone="tertiary">
{entry.percent.toFixed(1)}%
</AppText>
</View>
))}
</View>
</Card>
</View>
) : null}
{/* README */}
<View style={styles.section}>
<AppText variant="subheading" style={styles.sectionTitle}>
{t('repo.readme')}
</AppText>
{readmeQuery.isPending ? (
<View style={styles.card}>
<LoadingView />
</View>
) : readmeText ? (
<Card style={styles.card}>
<Markdown content={readmeText} baseUrl={instance?.baseUrl} />
</Card>
) : (
<Card style={styles.card}>
<AppText variant="secondary" tone="tertiary">
{t('repo.noReadme')}
</AppText>
</Card>
)}
</View>
<View style={{ height: spacing.xxl }} />
</Screen>
);
}
function Stat({
label,
value,
icon,
}: {
label: string;
value: number | undefined;
icon: 'star' | 'fork' | 'eye' | 'issue' | 'pullRequest' | 'tag';
}) {
const { colors } = useTheme();
return (
<View style={styles.stat}>
<Icon name={icon} size={16} color={colors.textTertiary} />
<AppText variant="bodyMedium">{value ?? 0}</AppText>
<AppText variant="caption" tone="tertiary" numberOfLines={1}>
{label}
</AppText>
</View>
);
}
const LANGUAGE_COLORS = ['#609926', '#3178c6', '#e34c26', '#f1e05a', '#563d7c', '#89e051'];
function languageColor(index: number, fallback: string): string {
return LANGUAGE_COLORS[index] ?? fallback;
}
function decodeReadme(content: string | undefined): string {
if (!content) return '';
try {
return globalThis.atob(content.replace(/\s/g, ''));
} catch {
return '';
}
}
const styles = StyleSheet.create({
header: {
paddingHorizontal: spacing.lg,
paddingTop: spacing.lg,
paddingBottom: spacing.lg,
gap: spacing.md,
borderBottomWidth: StyleSheet.hairlineWidth,
},
titleRow: { flexDirection: 'row', alignItems: 'baseline', flexWrap: 'wrap' },
name: { flexShrink: 1 },
badges: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.sm, alignItems: 'center' },
section: { marginTop: spacing.xl, gap: spacing.sm },
sectionTitle: { paddingHorizontal: spacing.lg },
card: { marginHorizontal: spacing.lg },
statsGrid: { flexDirection: 'row', flexWrap: 'wrap' },
stat: { width: '33.33%', alignItems: 'center', gap: 2, paddingVertical: spacing.sm },
langBar: {
flexDirection: 'row',
height: 10,
borderRadius: radius.pill,
overflow: 'hidden',
marginBottom: spacing.md,
},
langList: { gap: spacing.xs },
langItem: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm },
langDot: { width: 10, height: 10, borderRadius: radius.pill },
langName: { flex: 1 },
});