Spaces:
Running
Running
File size: 4,041 Bytes
bb8f662 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | import React from 'react';
import { View, Text, TouchableOpacity, ScrollView, StyleSheet } from 'react-native';
import { MaterialCommunityIcons } from '@expo/vector-icons';
import { theme } from '../styles/theme';
const SUGGESTED_QUESTIONS = [
{
category: 'Objects',
icon: 'cube-outline',
questions: [
'What objects are in the image?',
'What is the main object?',
'How many objects are there?',
],
},
{
category: 'Colors',
icon: 'palette',
questions: [
'What color is the object?',
'What colors are in the image?',
'What is the dominant color?',
],
},
{
category: 'Counting',
icon: 'counter',
questions: [
'How many people are there?',
'How many items are visible?',
'What is the count of objects?',
],
},
{
category: 'Spatial',
icon: 'compass',
questions: [
'What is on the left?',
'What is on the right?',
'What is in the center?',
'What is above the object?',
'What is below the object?',
],
},
{
category: 'Actions',
icon: 'run',
questions: [
'What is happening in the image?',
'What is the person doing?',
'What activity is shown?',
],
},
{
category: 'Scene',
icon: 'image-multiple',
questions: [
'Where is this photo taken?',
'What type of scene is this?',
'Is this indoors or outdoors?',
],
},
];
export default function SuggestedQuestions({ onQuestionSelect }) {
return (
<View style={styles.container}>
<View style={styles.header}>
<MaterialCommunityIcons
name="lightbulb-on"
size={20}
color={theme.colors.primary}
/>
<Text style={styles.headerText}>Suggested Questions</Text>
</View>
<ScrollView
horizontal
showsHorizontalScrollIndicator={false}
contentContainerStyle={styles.scrollContent}
>
{SUGGESTED_QUESTIONS.map((category, categoryIndex) => (
<View key={categoryIndex} style={styles.categoryContainer}>
<View style={styles.categoryHeader}>
<MaterialCommunityIcons
name={category.icon}
size={16}
color={theme.colors.textSecondary}
/>
<Text style={styles.categoryText}>{category.category}</Text>
</View>
{category.questions.map((question, questionIndex) => (
<TouchableOpacity
key={questionIndex}
style={styles.chip}
onPress={() => onQuestionSelect(question)}
activeOpacity={0.7}
>
<Text style={styles.chipText} numberOfLines={1}>
{question}
</Text>
</TouchableOpacity>
))}
</View>
))}
</ScrollView>
</View>
);
}
const styles = StyleSheet.create({
container: {
marginBottom: theme.spacing.lg,
},
header: {
flexDirection: 'row',
alignItems: 'center',
marginBottom: theme.spacing.md,
},
headerText: {
fontSize: 16,
fontWeight: '600',
color: theme.colors.text,
marginLeft: theme.spacing.sm,
},
scrollContent: {
paddingRight: theme.spacing.lg,
},
categoryContainer: {
marginRight: theme.spacing.lg,
},
categoryHeader: {
flexDirection: 'row',
alignItems: 'center',
marginBottom: theme.spacing.sm,
},
categoryText: {
fontSize: 12,
fontWeight: '600',
color: theme.colors.textSecondary,
marginLeft: theme.spacing.xs,
textTransform: 'uppercase',
},
chip: {
backgroundColor: theme.colors.card,
paddingHorizontal: theme.spacing.md,
paddingVertical: theme.spacing.sm,
borderRadius: theme.borderRadius.full,
marginBottom: theme.spacing.sm,
borderWidth: 1,
borderColor: theme.colors.primary,
...theme.shadows.sm,
},
chipText: {
color: theme.colors.text,
fontSize: 14,
maxWidth: 200,
},
}); |