feat(phase5): Actions re-run/cancel, package deletion, inline-comment tests
- action run controls (re-run / cancel) with cache invalidation - package deletion from the Packages screen - endpoint tests for inline review comments + replies (121 tests)
This commit is contained in:
1 parent
b810292b1f
commit
cd448bdd52
9 files changed
+182
-22
No files matched your search
@@ -1,14 +1,16 @@
|
||||
import { StyleSheet, View } from 'react-native';
|
||||
import { Alert, StyleSheet, View } from 'react-native';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { QueryList } from '@/components/layout/query-list';
|
||||
import { AppText } from '@/components/ui/app-text';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { IconButton } from '@/components/ui/icon-button';
|
||||
import { EmptyState } from '@/components/ui/state-views';
|
||||
import { apiErrorMessage } from '@/core/api/error-text';
|
||||
import type { Package } from '@/core/api/types';
|
||||
import { flattenPages } from '@/core/utils/infinite';
|
||||
import { formatRelativeTime } from '@/core/utils/format';
|
||||
import { usePackages } from '@/features/profile/queries';
|
||||
import { useDeletePackage, usePackages } from '@/features/profile/queries';
|
||||
import { useSession } from '@/features/accounts/use-session';
|
||||
import { spacing } from '@/theme/tokens';
|
||||
|
||||
@@ -16,9 +18,26 @@ import { spacing } from '@/theme/tokens';
|
||||
export function PackagesScreen() {
|
||||
const { t } = useTranslation();
|
||||
const { account } = useSession();
|
||||
const query = usePackages(account?.login ?? '');
|
||||
const login = account?.login ?? '';
|
||||
const query = usePackages(login);
|
||||
const deletePackage = useDeletePackage();
|
||||
const packages: Package[] = flattenPages(query.data);
|
||||
|
||||
const confirmDelete = (pkg: Package) => {
|
||||
Alert.alert(t('packages.deleteTitle'), t('packages.deleteBody', { name: pkg.name ?? '' }), [
|
||||
{ text: t('common.cancel'), style: 'cancel' },
|
||||
{
|
||||
text: t('common.delete'),
|
||||
style: 'destructive',
|
||||
onPress: () =>
|
||||
deletePackage.mutate(
|
||||
{ owner: login, type: pkg.type ?? '', name: pkg.name ?? '' },
|
||||
{ onError: (error) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)) },
|
||||
),
|
||||
},
|
||||
]);
|
||||
};
|
||||
|
||||
return (
|
||||
<QueryList<Package>
|
||||
query={query}
|
||||
@@ -44,6 +63,11 @@ export function PackagesScreen() {
|
||||
) : null}
|
||||
</View>
|
||||
</View>
|
||||
<IconButton
|
||||
name="trash"
|
||||
onPress={() => confirmDelete(pkg)}
|
||||
accessibilityLabel={t('common.delete')}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
empty={<EmptyState icon="package" title={t('packages.empty')} />}
|
||||
@@ -52,7 +76,13 @@ export function PackagesScreen() {
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
row: { paddingHorizontal: spacing.lg, paddingVertical: spacing.md },
|
||||
body: { gap: spacing.xs },
|
||||
row: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
gap: spacing.md,
|
||||
paddingHorizontal: spacing.lg,
|
||||
paddingVertical: spacing.md,
|
||||
},
|
||||
body: { flex: 1, gap: spacing.xs },
|
||||
metaRow: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm, flexWrap: 'wrap' },
|
||||
});
|
||||
Reference in new issue
Block a user