feat: 交互优化

This commit is contained in:
jinyaqiu 2025-07-29 19:27:07 +08:00
parent a6cc33b7d6
commit 78a8d42ea1
5 changed files with 25 additions and 9 deletions

View File

@ -226,6 +226,9 @@ const MemoList = () => {
return ( return (
<View style={[styles.container, { paddingTop: insets.top }]}> <View style={[styles.container, { paddingTop: insets.top }]}>
<SkeletonList /> <SkeletonList />
<React.Suspense fallback={null}>
<AskNavbar />
</React.Suspense>
</View> </View>
); );
} }
@ -322,13 +325,13 @@ const styles = StyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
}, },
memoTitle: { memoTitle: {
fontSize: 14, fontSize: 16,
fontWeight: '500', fontWeight: '500',
color: '#4C320C', color: '#4C320C',
marginBottom: 4, marginBottom: 4,
}, },
memoSubtitle: { memoSubtitle: {
fontSize: 12, fontSize: 14,
color: '#AC7E35', color: '#AC7E35',
}, },
separator: { separator: {

View File

@ -11,6 +11,12 @@ interface ErrorBoundaryState {
error?: Error; error?: Error;
} }
const translations = {
error: 'Error',
issue: 'An issue occurred',
retry: 'Retry'
};
class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> { class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
constructor(props: ErrorBoundaryProps) { constructor(props: ErrorBoundaryProps) {
super(props); super(props);
@ -37,12 +43,12 @@ class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundarySta
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.title}></Text> <Text style={styles.title}>{translations.error}</Text>
<Text style={styles.error}> <Text style={styles.error}>
{this.state.error?.message || '发生了一些问题'} {this.state.error?.message || translations.issue}
</Text> </Text>
<TouchableOpacity style={styles.retryButton} onPress={this.handleRetry}> <TouchableOpacity style={styles.retryButton} onPress={this.handleRetry}>
<Text style={styles.retryText}></Text> <Text style={styles.retryText}>{translations.retry}</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
); );

View File

@ -94,7 +94,10 @@ const AskNavbar = () => {
resizeMode: 'cover' resizeMode: 'cover'
}, },
navButton: { navButton: {
padding: 16 width: width / 2, // 半屏宽度
height: 80, // 与 navbar 高度相同
justifyContent: 'center',
alignItems: 'center'
}, },
navContainer: { navContainer: {
position: 'absolute', position: 'absolute',
@ -134,7 +137,7 @@ const AskNavbar = () => {
<View style={styles.navContainer}> <View style={styles.navContainer}>
<TouchableOpacity <TouchableOpacity
onPress={() => navigateTo('/memo-list')} onPress={() => navigateTo('/memo-list')}
style={styles.navButton} style={[styles.navButton, { alignItems: "flex-start", paddingLeft: 16 }]}
> >
<TabIcon <TabIcon
isActive={pathname === "/memo-list"} isActive={pathname === "/memo-list"}

View File

@ -11,6 +11,8 @@
"memoList": "Memo List", "memoList": "Memo List",
"noChat": "No Chat", "noChat": "No Chat",
"loading": "Loading...", "loading": "Loading...",
"refresh": "Refresh" "refresh": "Refresh",
"error": "have some error",
"issue": "have some issue"
} }
} }

View File

@ -11,6 +11,8 @@
"memoList": "对话记录", "memoList": "对话记录",
"noChat": "暂无对话记录", "noChat": "暂无对话记录",
"loading": "加载中...", "loading": "加载中...",
"refresh": "刷新" "refresh": "刷新",
"error": "出错了",
"issue": "发生了一些问题"
} }
} }