Kantongku: kategori di Pengaturan jadi grid chip ringkas
This commit is contained in:
@@ -368,30 +368,36 @@ export function SettingsScreen() {
|
|||||||
<Text style={styles.catGroupLabel}>
|
<Text style={styles.catGroupLabel}>
|
||||||
{t === 'income' ? '💚 Pemasukan' : '❤️ Pengeluaran'}
|
{t === 'income' ? '💚 Pemasukan' : '❤️ Pengeluaran'}
|
||||||
</Text>
|
</Text>
|
||||||
{categories
|
<View style={styles.catChipGrid}>
|
||||||
.filter((c) => c.type === t)
|
{categories
|
||||||
.map((c) => (
|
.filter((c) => c.type === t)
|
||||||
<View key={c.id} style={styles.recurringRow}>
|
.map((c) => (
|
||||||
<View style={styles.dataIconCircle}>
|
<View key={c.id} style={styles.catChipWrap}>
|
||||||
<Text style={styles.catEmoji}>{c.icon}</Text>
|
<Pressable
|
||||||
|
style={styles.catChip}
|
||||||
|
onPress={() =>
|
||||||
|
navigation.navigate('CategoryForm', {
|
||||||
|
categoryId: c.id,
|
||||||
|
initialName: c.name,
|
||||||
|
initialIcon: c.icon,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Text style={styles.catChipEmoji}>{c.icon}</Text>
|
||||||
|
<Text style={styles.catChipName} numberOfLines={1}>
|
||||||
|
{c.name}
|
||||||
|
</Text>
|
||||||
|
</Pressable>
|
||||||
|
<Pressable
|
||||||
|
style={styles.catChipDelete}
|
||||||
|
onPress={() => handleDeleteCategory(c)}
|
||||||
|
hitSlop={6}
|
||||||
|
>
|
||||||
|
<Ionicons name="close" size={12} color={colors.white} />
|
||||||
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
<Pressable
|
))}
|
||||||
style={styles.dataInfo}
|
</View>
|
||||||
onPress={() =>
|
|
||||||
navigation.navigate('CategoryForm', {
|
|
||||||
categoryId: c.id,
|
|
||||||
initialName: c.name,
|
|
||||||
initialIcon: c.icon,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Text style={styles.dataTitle}>{c.name}</Text>
|
|
||||||
</Pressable>
|
|
||||||
<Pressable onPress={() => handleDeleteCategory(c)} hitSlop={8}>
|
|
||||||
<Ionicons name="trash-outline" size={18} color={colors.expense} />
|
|
||||||
</Pressable>
|
|
||||||
</View>
|
|
||||||
))}
|
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
<View style={styles.divider} />
|
<View style={styles.divider} />
|
||||||
@@ -592,9 +598,45 @@ const styles = StyleSheet.create({
|
|||||||
fontWeight: '700',
|
fontWeight: '700',
|
||||||
color: colors.textMuted,
|
color: colors.textMuted,
|
||||||
marginTop: 6,
|
marginTop: 6,
|
||||||
marginBottom: 4,
|
marginBottom: 8,
|
||||||
|
},
|
||||||
|
catChipGrid: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
flexWrap: 'wrap',
|
||||||
|
gap: 8,
|
||||||
|
marginBottom: 8,
|
||||||
|
},
|
||||||
|
catChipWrap: { position: 'relative' },
|
||||||
|
catChip: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: 6,
|
||||||
|
backgroundColor: colors.background,
|
||||||
|
borderWidth: 1,
|
||||||
|
borderColor: colors.border,
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingLeft: 10,
|
||||||
|
paddingRight: 24,
|
||||||
|
paddingVertical: 8,
|
||||||
|
},
|
||||||
|
catChipEmoji: { fontSize: 15 },
|
||||||
|
catChipName: {
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: '600',
|
||||||
|
color: colors.text,
|
||||||
|
maxWidth: 90,
|
||||||
|
},
|
||||||
|
catChipDelete: {
|
||||||
|
position: 'absolute',
|
||||||
|
right: 3,
|
||||||
|
top: 3,
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
borderRadius: 8,
|
||||||
|
backgroundColor: colors.expense,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
catEmoji: { fontSize: 17 },
|
|
||||||
emptyRecurringText: {
|
emptyRecurringText: {
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
color: colors.textMuted,
|
color: colors.textMuted,
|
||||||
|
|||||||
Reference in New Issue
Block a user