fix: app
This commit is contained in:
parent
5e4a9c82cd
commit
5a4d1ac1bd
|
|
@ -22,7 +22,7 @@ import LoadingState from '@/components/LoadingState'
|
|||
import ErrorState from '@/components/ErrorState'
|
||||
import PaginationLoader from '@/components/PaginationLoader'
|
||||
|
||||
import { MessageCard } from '@/components/message/MessageCard'
|
||||
import { MessageCard, type Message as MessageCardMessage } from '@/components/message/MessageCard'
|
||||
import { MessageTabBar, type MessageType, TAB_ITEMS } from '@/components/message/MessageTabBar'
|
||||
import { AnnouncementBanner } from '@/components/message/AnnouncementBanner'
|
||||
import { SwipeToDelete } from '@/components/message/SwipeToDelete'
|
||||
|
|
@ -76,7 +76,7 @@ export default function MessageScreen() {
|
|||
const {
|
||||
announcements,
|
||||
execute: executeAnnouncements,
|
||||
} = useAnnouncements({ limit: 10 })
|
||||
} = useAnnouncements()
|
||||
|
||||
// Filter messages based on active tab
|
||||
const filteredMessages = filterMessagesByTab(allMessages, activeTab)
|
||||
|
|
@ -153,7 +153,7 @@ export default function MessageScreen() {
|
|||
const queryString = Object.keys(params).length > 0
|
||||
? `?${new URLSearchParams(params).toString()}`
|
||||
: ''
|
||||
router.push(`${route}${queryString}`)
|
||||
router.push(`${route}${queryString}` as any)
|
||||
}
|
||||
}, [markRead, router])
|
||||
|
||||
|
|
|
|||
|
|
@ -210,10 +210,6 @@ export const VideoItem = memo(({ item, videoHeight }: { item: TemplateDetail; vi
|
|||
likeCount={likeCount}
|
||||
favoriteCount={favoriteCount}
|
||||
loading={likeLoading || favoriteLoading}
|
||||
onLike={onLike}
|
||||
onUnlike={onUnlike}
|
||||
onFavorite={onFavorite}
|
||||
onUnfavorite={onUnfavorite}
|
||||
testID="video-social-button"
|
||||
/>
|
||||
</View>
|
||||
|
|
|
|||
|
|
@ -65,6 +65,10 @@ jest.mock('@/components/ui/video', () => ({
|
|||
VideoPlayer: ({ source }: any) => <View testID="video-player" />,
|
||||
}))
|
||||
|
||||
jest.mock('expo-linear-gradient', () => ({
|
||||
LinearGradient: ({ children }: any) => <View testID="linear-gradient">{children}</View>,
|
||||
}))
|
||||
|
||||
jest.mock('@/hooks', () => ({
|
||||
useGenerationDetail: jest.fn(),
|
||||
useDeleteGeneration: jest.fn(),
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ import {
|
|||
StatusBar as RNStatusBar,
|
||||
Alert,
|
||||
ScrollView,
|
||||
Platform,
|
||||
} from 'react-native'
|
||||
import { StatusBar } from 'expo-status-bar'
|
||||
import { SafeAreaView } from 'react-native-safe-area-context'
|
||||
import { Image } from 'expo-image'
|
||||
import { useRouter, useLocalSearchParams } from 'expo-router'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { LinearGradient } from 'expo-linear-gradient'
|
||||
|
||||
import { LeftArrowIcon, DeleteIcon, EditIcon, ChangeIcon, WhiteStarIcon } from '@/components/icon'
|
||||
import { DeleteConfirmDialog } from '@/components/ui/delete-confirm-dialog'
|
||||
|
|
@ -128,13 +128,13 @@ export default function GenerationRecordScreen() {
|
|||
switch (status?.toLowerCase()) {
|
||||
case 'completed':
|
||||
case 'success':
|
||||
return '#4CAF50'
|
||||
return '#4ADE80'
|
||||
case 'pending':
|
||||
case 'processing':
|
||||
return '#FF9800'
|
||||
return '#FF9966'
|
||||
case 'failed':
|
||||
case 'error':
|
||||
return '#F44336'
|
||||
return '#FF6B6B'
|
||||
default:
|
||||
return '#8A8A8A'
|
||||
}
|
||||
|
|
@ -277,50 +277,61 @@ export default function GenerationRecordScreen() {
|
|||
|
||||
{/* 操作按钮 */}
|
||||
<View style={styles.actionSection}>
|
||||
{/* 下载按钮 */}
|
||||
{/* 下载按钮 - 主要操作使用渐变色 */}
|
||||
{hasResult && (
|
||||
<Pressable
|
||||
style={[styles.actionButton, styles.downloadButton, downloading && styles.buttonDisabled]}
|
||||
style={[styles.primaryButtonContainer, downloading && styles.buttonDisabled]}
|
||||
onPress={handleDownload}
|
||||
disabled={downloading}
|
||||
>
|
||||
<Text style={styles.downloadButtonText}>
|
||||
{downloading
|
||||
? `${t('generationRecord.downloading')} ${Math.round(progress * 100)}%`
|
||||
: t('generationRecord.download')}
|
||||
</Text>
|
||||
<LinearGradient
|
||||
colors={['#9966FF', '#FF6699', '#FF9966']}
|
||||
locations={[0.0015, 0.4985, 0.9956]}
|
||||
start={{ x: 1, y: 0 }}
|
||||
end={{ x: 0, y: 0 }}
|
||||
style={styles.gradientButton}
|
||||
>
|
||||
<Text style={styles.primaryButtonText}>
|
||||
{downloading
|
||||
? `${t('generationRecord.downloading')} ${Math.round(progress * 100)}%`
|
||||
: t('generationRecord.download')}
|
||||
</Text>
|
||||
</LinearGradient>
|
||||
</Pressable>
|
||||
)}
|
||||
|
||||
{/* 重新生成按钮 */}
|
||||
<Pressable
|
||||
style={[styles.actionButton, styles.rerunButton, rerunning && styles.buttonDisabled]}
|
||||
onPress={handleRerun}
|
||||
disabled={rerunning}
|
||||
>
|
||||
<ChangeIcon />
|
||||
<Text style={styles.actionButtonText}>{t('generationRecord.regenerate')}</Text>
|
||||
</Pressable>
|
||||
|
||||
{/* 再来一次按钮 */}
|
||||
{generation.template && (
|
||||
{/* 次要操作按钮行 */}
|
||||
<View style={styles.secondaryButtonRow}>
|
||||
{/* 重新生成按钮 */}
|
||||
<Pressable
|
||||
style={[styles.actionButton, styles.tryAgainButton]}
|
||||
onPress={handleTryAgain}
|
||||
style={[styles.secondaryButton, rerunning && styles.buttonDisabled]}
|
||||
onPress={handleRerun}
|
||||
disabled={rerunning}
|
||||
>
|
||||
<EditIcon />
|
||||
<Text style={styles.actionButtonText}>{t('generationRecord.reEdit')}</Text>
|
||||
<ChangeIcon />
|
||||
<Text style={styles.secondaryButtonText}>{t('generationRecord.regenerate')}</Text>
|
||||
</Pressable>
|
||||
)}
|
||||
|
||||
{/* 删除按钮 */}
|
||||
<Pressable
|
||||
style={[styles.actionButton, styles.deleteActionButton, deleting && styles.buttonDisabled]}
|
||||
onPress={() => setDeleteDialogOpen(true)}
|
||||
disabled={deleting}
|
||||
>
|
||||
<DeleteIcon />
|
||||
</Pressable>
|
||||
{/* 再来一次按钮 */}
|
||||
{generation.template && (
|
||||
<Pressable
|
||||
style={styles.secondaryButton}
|
||||
onPress={handleTryAgain}
|
||||
>
|
||||
<EditIcon />
|
||||
<Text style={styles.secondaryButtonText}>{t('generationRecord.reEdit')}</Text>
|
||||
</Pressable>
|
||||
)}
|
||||
|
||||
{/* 删除按钮 */}
|
||||
<Pressable
|
||||
style={[styles.deleteButton, deleting && styles.buttonDisabled]}
|
||||
onPress={() => setDeleteDialogOpen(true)}
|
||||
disabled={deleting}
|
||||
>
|
||||
<DeleteIcon />
|
||||
</Pressable>
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
|
|
@ -438,40 +449,52 @@ const styles = StyleSheet.create({
|
|||
paddingHorizontal: 12,
|
||||
gap: 12,
|
||||
},
|
||||
actionButton: {
|
||||
// 主要按钮 - 渐变色
|
||||
primaryButtonContainer: {
|
||||
height: 48,
|
||||
borderRadius: 12,
|
||||
overflow: 'hidden',
|
||||
},
|
||||
gradientButton: {
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
paddingHorizontal: 16,
|
||||
paddingVertical: 12,
|
||||
borderRadius: 12,
|
||||
backgroundColor: '#1C1E22',
|
||||
gap: 8,
|
||||
},
|
||||
downloadButton: {
|
||||
backgroundColor: '#4CAF50',
|
||||
},
|
||||
downloadButtonText: {
|
||||
primaryButtonText: {
|
||||
color: '#FFFFFF',
|
||||
fontSize: 14,
|
||||
fontSize: 16,
|
||||
fontWeight: '600',
|
||||
},
|
||||
rerunButton: {
|
||||
backgroundColor: '#1C1E22',
|
||||
// 次要按钮行
|
||||
secondaryButtonRow: {
|
||||
flexDirection: 'row',
|
||||
gap: 8,
|
||||
},
|
||||
tryAgainButton: {
|
||||
backgroundColor: '#1C1E22',
|
||||
secondaryButton: {
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
height: 48,
|
||||
borderRadius: 12,
|
||||
backgroundColor: '#262A31',
|
||||
gap: 6,
|
||||
},
|
||||
deleteActionButton: {
|
||||
backgroundColor: '#1C1E22',
|
||||
width: 48,
|
||||
alignSelf: 'flex-end',
|
||||
},
|
||||
actionButtonText: {
|
||||
secondaryButtonText: {
|
||||
color: '#F5F5F5',
|
||||
fontSize: 14,
|
||||
fontWeight: '500',
|
||||
},
|
||||
deleteButton: {
|
||||
width: 48,
|
||||
height: 48,
|
||||
borderRadius: 12,
|
||||
backgroundColor: '#262A31',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
buttonDisabled: {
|
||||
opacity: 0.5,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue