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:
1 parent
ad81db07b3
commit
0a889ebfed
36 files changed
+4186
No files matched your search
@@ -0,0 +1,132 @@
|
||||
import { 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, StatusBadge } from '@/components/ui/badge';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Icon } from '@/components/ui/icon';
|
||||
import { LabelChip } from '@/components/ui/label-chip';
|
||||
import { ErrorState, LoadingView } from '@/components/ui/state-views';
|
||||
import { apiErrorMessage } from '@/core/api/error-text';
|
||||
import { useSession } from '@/features/accounts/use-session';
|
||||
import { useIssue } from '@/features/issues/queries';
|
||||
import { formatRelativeTime } 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, 'IssueDetail'>;
|
||||
|
||||
/** Full issue view: state, author, labels, milestone and rendered body. */
|
||||
export function IssueDetailScreen({ route }: Props) {
|
||||
const { t } = useTranslation();
|
||||
const { colors } = useTheme();
|
||||
const { instance } = useSession();
|
||||
const { owner, name, index } = route.params;
|
||||
|
||||
const query = useIssue(owner, name, index);
|
||||
const issue = query.data;
|
||||
|
||||
if (query.isPending) return <LoadingView />;
|
||||
if (query.isError) {
|
||||
return (
|
||||
<ErrorState
|
||||
title={t('issues.notFound')}
|
||||
body={apiErrorMessage(query.error, t)}
|
||||
retryLabel={t('common.retry')}
|
||||
onRetry={() => void query.refetch()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (!issue) return null;
|
||||
|
||||
const author = issue.user;
|
||||
const state = issue.state === 'closed' ? 'closed' : 'open';
|
||||
|
||||
return (
|
||||
<Screen scroll padded>
|
||||
<View style={styles.titleBlock}>
|
||||
<AppText variant="heading">
|
||||
{issue.title} <AppText variant="heading" tone="tertiary">{`#${issue.number}`}</AppText>
|
||||
</AppText>
|
||||
<View style={styles.stateRow}>
|
||||
<StatusBadge label={state === 'closed' ? t('issues.closed') : t('issues.open')} state={state} />
|
||||
{issue.is_locked ? <Badge tone="neutral" icon="lock">{`#${issue.number}`}</Badge> : null}
|
||||
<AppText variant="caption" tone="tertiary">
|
||||
{t('issues.openedBy', { name: author?.login ?? t('common.unknown') })} ·{' '}
|
||||
{formatRelativeTime(issue.created_at, t)}
|
||||
</AppText>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={styles.authorRow}>
|
||||
<Avatar url={author?.avatar_url} name={author?.login ?? '?'} size={28} />
|
||||
<AppText variant="bodyMedium" style={styles.authorName}>
|
||||
{author?.login ?? t('common.unknown')}
|
||||
</AppText>
|
||||
</View>
|
||||
|
||||
{issue.labels && issue.labels.length > 0 ? (
|
||||
<View style={styles.labels}>
|
||||
{issue.labels.map((label, index2) => (
|
||||
<LabelChip key={label.id ?? `${label.name}-${index2}`} name={label.name} color={label.color} />
|
||||
))}
|
||||
</View>
|
||||
) : null}
|
||||
|
||||
<Card style={styles.bodyCard}>
|
||||
{issue.body && issue.body.trim().length > 0 ? (
|
||||
<Markdown content={issue.body} baseUrl={instance?.baseUrl} />
|
||||
) : (
|
||||
<AppText variant="secondary" tone="tertiary">
|
||||
{t('issues.noDescription')}
|
||||
</AppText>
|
||||
)}
|
||||
</Card>
|
||||
|
||||
<View style={styles.metaGrid}>
|
||||
{issue.assignees && issue.assignees.length > 0 ? (
|
||||
<MetaRow
|
||||
icon="person"
|
||||
label={t('issues.assignedTo', {
|
||||
name: issue.assignees.map((a) => a.login).join(', '),
|
||||
})}
|
||||
/>
|
||||
) : null}
|
||||
{issue.milestone ? <MetaRow icon="tag" label={`${t('issues.milestone')}: ${issue.milestone.title}`} /> : null}
|
||||
<MetaRow
|
||||
icon="mail"
|
||||
label={t('issues.comments', { count: issue.comments ?? 0 })}
|
||||
color={colors.textSecondary}
|
||||
/>
|
||||
</View>
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
|
||||
function MetaRow({ icon, label, color }: { icon: 'person' | 'tag' | 'mail'; label: string; color?: string }) {
|
||||
const { colors } = useTheme();
|
||||
return (
|
||||
<View style={styles.metaRow}>
|
||||
<Icon name={icon} size={15} color={color ?? colors.textTertiary} />
|
||||
<AppText variant="caption" tone="secondary">
|
||||
{label}
|
||||
</AppText>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
titleBlock: { gap: spacing.sm },
|
||||
stateRow: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm, flexWrap: 'wrap' },
|
||||
authorRow: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm },
|
||||
authorName: { flex: 1 },
|
||||
labels: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.sm },
|
||||
bodyCard: { minHeight: 80 },
|
||||
metaGrid: { gap: spacing.sm },
|
||||
metaRow: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm },
|
||||
});
|
||||
Reference in new issue
Block a user