feat: 新增目标页面引导功能及相关组件
- 在目标页面中集成用户引导功能,帮助用户了解页面各项功能 - 创建 GoalsPageGuide 组件,支持多步骤引导和动态高亮功能区域 - 实现引导状态的检查、标记和重置功能,确保用户体验 - 添加开发测试按钮,方便开发者重置引导状态 - 更新相关文档,详细描述引导功能的实现和使用方法
This commit is contained in:
53
components/GuideTestButton.tsx
Normal file
53
components/GuideTestButton.tsx
Normal file
@@ -0,0 +1,53 @@
|
||||
import { resetGuideStates } from '@/utils/devTools';
|
||||
import React from 'react';
|
||||
import { Alert, StyleSheet, Text, TouchableOpacity } from 'react-native';
|
||||
|
||||
interface GuideTestButtonProps {
|
||||
visible?: boolean;
|
||||
}
|
||||
|
||||
export const GuideTestButton: React.FC<GuideTestButtonProps> = ({ visible = false }) => {
|
||||
if (!visible) return null;
|
||||
|
||||
const handleResetGuides = async () => {
|
||||
Alert.alert(
|
||||
'重置用户引导',
|
||||
'确定要重置所有用户引导状态吗?这将清除用户已完成的引导记录。',
|
||||
[
|
||||
{ text: '取消', style: 'cancel' },
|
||||
{
|
||||
text: '确定',
|
||||
style: 'destructive',
|
||||
onPress: async () => {
|
||||
await resetGuideStates();
|
||||
Alert.alert('成功', '用户引导状态已重置,下次进入页面时将重新显示引导。');
|
||||
},
|
||||
},
|
||||
]
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<TouchableOpacity style={styles.button} onPress={handleResetGuides}>
|
||||
<Text style={styles.buttonText}>重置引导</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
button: {
|
||||
position: 'absolute',
|
||||
top: 50,
|
||||
right: 20,
|
||||
backgroundColor: '#FF6B6B',
|
||||
paddingHorizontal: 12,
|
||||
paddingVertical: 8,
|
||||
borderRadius: 8,
|
||||
zIndex: 1000,
|
||||
},
|
||||
buttonText: {
|
||||
color: '#FFFFFF',
|
||||
fontSize: 12,
|
||||
fontWeight: '600',
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user