Files
gitea-native/src/features/profile/screens/org-teams-screen.tsx
T
JustZoe101 587bf732b5 feat: release asset upload, transfer, Actions secrets/variables/artifacts, admin, teams/projects, file search, reactions, attachments, package version delete
- client: multipart postForm; expo-document-picker + react-native-webview deps
- release assets: upload (DocumentPicker) and delete; run artifacts list
- repository transfer; Actions secrets + variables management screen
- admin (users/orgs/repos) screen gated on is_admin
- org teams, repo projects (read-only); find-file via recursive git tree
- issue reactions toggle and attachments list; package version delete
- endpoint tests (126 total)
2026-10-09 18:40:08 +02:00

64 lines
2.1 KiB
TypeScript

import { StyleSheet, View } from 'react-native';
import { useRoute, type RouteProp } from '@react-navigation/native';
import { useTranslation } from 'react-i18next';
import { Screen } from '@/components/layout/screen';
import { AppText } from '@/components/ui/app-text';
import { Badge } from '@/components/ui/badge';
import { Card } from '@/components/ui/card';
import { EmptyState, ErrorState, LoadingView } from '@/components/ui/state-views';
import { apiErrorMessage } from '@/core/api/error-text';
import { useOrgTeams } from '@/features/repositories/settings-queries';
import { spacing } from '@/theme/tokens';
import type { SettingsStackParamList } from '@/navigation/types';
/** Teams within an organization (read-only). */
export function OrgTeamsScreen() {
const { t } = useTranslation();
const route = useRoute<RouteProp<SettingsStackParamList, 'OrgTeams'>>();
const { org } = route.params;
const query = useOrgTeams(org);
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()}
/>
);
}
const teams = query.data ?? [];
if (teams.length === 0) return <EmptyState icon="people" title={t('organizations.noTeams')} />;
return (
<Screen scroll padded>
{teams.map((team) => (
<Card key={team.id ?? team.name}>
<View style={styles.row}>
<View style={styles.body}>
<AppText variant="bodyMedium" numberOfLines={1}>
{team.name}
</AppText>
{team.description ? (
<AppText variant="caption" tone="tertiary" numberOfLines={2}>
{team.description}
</AppText>
) : null}
</View>
{team.permission ? <Badge tone="neutral">{team.permission}</Badge> : null}
</View>
</Card>
))}
</Screen>
);
}
const styles = StyleSheet.create({
row: { flexDirection: 'row', alignItems: 'center', gap: spacing.md },
body: { flex: 1, gap: 2 },
});