This commit is contained in:
imeepos
2026-01-28 17:38:49 +08:00
parent d6cc74ab00
commit e478b126cd
3 changed files with 49 additions and 37 deletions

View File

@@ -68,39 +68,6 @@ export default function GenerationRecordScreen() {
}
}
if (loading && generations.length === 0) {
return (
<SafeAreaView style={styles.container} edges={['top']}>
<StatusBar style="light" />
<RNStatusBar barStyle="light-content" />
<View style={styles.header}>
<Pressable style={styles.backButton} onPress={() => router.back()}>
<LeftArrowIcon />
</Pressable>
<Text style={styles.headerTitle}>{t('generationRecord.title')}</Text>
<View style={styles.headerSpacer} />
</View>
<LoadingState testID="loading-state" />
</SafeAreaView>
)
}
if (error && generations.length === 0) {
return (
<SafeAreaView style={styles.container} edges={['top']}>
<StatusBar style="light" />
<RNStatusBar barStyle="light-content" />
<View style={styles.header}>
<Pressable style={styles.backButton} onPress={() => router.back()}>
<LeftArrowIcon />
</Pressable>
<Text style={styles.headerTitle}>{t('generationRecord.title')}</Text>
<View style={styles.headerSpacer} />
</View>
<ErrorState testID="error-state" message={error.message} onRetry={handleRefresh} />
</SafeAreaView>
)
}
const renderItem = ({ item }: { item: TemplateGeneration }) => (
<View style={styles.itemContainer}>
@@ -155,6 +122,41 @@ export default function GenerationRecordScreen() {
</View>
)
if (loading && generations.length === 0) {
return (
<SafeAreaView style={styles.container} edges={['top']}>
<StatusBar style="light" />
<RNStatusBar barStyle="light-content" />
<View style={styles.header}>
<Pressable style={styles.backButton} onPress={() => router.back()}>
<LeftArrowIcon />
</Pressable>
<Text style={styles.headerTitle}>{t('generationRecord.title')}</Text>
<View style={styles.headerSpacer} />
</View>
<LoadingState testID="loading-state" />
</SafeAreaView>
)
}
if (error && generations.length === 0) {
return (
<SafeAreaView style={styles.container} edges={['top']}>
<StatusBar style="light" />
<RNStatusBar barStyle="light-content" />
<View style={styles.header}>
<Pressable style={styles.backButton} onPress={() => router.back()}>
<LeftArrowIcon />
</Pressable>
<Text style={styles.headerTitle}>{t('generationRecord.title')}</Text>
<View style={styles.headerSpacer} />
</View>
<ErrorState testID="error-state" message={error.message} onRetry={handleRefresh} />
</SafeAreaView>
)
}
return (
<SafeAreaView style={styles.container} edges={['top']}>
<StatusBar style="light" />