chore: fix ts
This commit is contained in:
@@ -110,7 +110,7 @@ export default function CategoriesScreen() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: { flex: 1, backgroundColor: colors.background },
|
container: { flex: 1, backgroundColor: colors.bgPrimary },
|
||||||
header: {
|
header: {
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
@@ -119,7 +119,7 @@ export default function CategoriesScreen() {
|
|||||||
borderBottomWidth: 1,
|
borderBottomWidth: 1,
|
||||||
borderBottomColor: colors.border,
|
borderBottomColor: colors.border,
|
||||||
},
|
},
|
||||||
title: { fontSize: fontSize.xl, fontWeight: "700", color: colors.text },
|
title: { fontSize: fontSize.xl, fontWeight: "700", color: colors.textPrimary },
|
||||||
addBtn: {
|
addBtn: {
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
@@ -127,60 +127,69 @@ export default function CategoriesScreen() {
|
|||||||
backgroundColor: colors.accent,
|
backgroundColor: colors.accent,
|
||||||
paddingHorizontal: spacing.m,
|
paddingHorizontal: spacing.m,
|
||||||
paddingVertical: spacing.s,
|
paddingVertical: spacing.s,
|
||||||
borderRadius: borderRadius.m,
|
borderRadius: borderRadius.md,
|
||||||
},
|
},
|
||||||
addBtnText: { color: "#fff", fontWeight: "600", fontSize: fontSize.s },
|
addBtnText: { color: colors.textWhite, fontWeight: "600", fontSize: fontSize.sm },
|
||||||
list: { padding: spacing.m, gap: spacing.s },
|
list: { padding: spacing.m, gap: spacing.s },
|
||||||
row: {
|
row: {
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "space-between",
|
justifyContent: "space-between",
|
||||||
},
|
},
|
||||||
catName: { fontSize: fontSize.m, color: colors.text, fontWeight: "600", textTransform: "capitalize" },
|
catName: {
|
||||||
|
fontSize: fontSize.md,
|
||||||
|
color: colors.textPrimary,
|
||||||
|
fontWeight: "600",
|
||||||
|
textTransform: "capitalize",
|
||||||
|
},
|
||||||
catDate: { fontSize: fontSize.xs, color: colors.textSecondary, marginTop: 2 },
|
catDate: { fontSize: fontSize.xs, color: colors.textSecondary, marginTop: 2 },
|
||||||
actions: { flexDirection: "row", gap: spacing.s },
|
actions: { flexDirection: "row", gap: spacing.s },
|
||||||
actionBtn: { padding: 8 },
|
actionBtn: { padding: 8 },
|
||||||
overlay: {
|
overlay: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: "rgba(0,0,0,0.5)",
|
backgroundColor: colors.overlay,
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
padding: spacing.l,
|
padding: spacing.xl,
|
||||||
},
|
},
|
||||||
modal: {
|
modal: {
|
||||||
backgroundColor: colors.surface,
|
backgroundColor: colors.bgCard,
|
||||||
borderRadius: borderRadius.l,
|
borderRadius: borderRadius.lg,
|
||||||
padding: spacing.l,
|
padding: spacing.l,
|
||||||
gap: spacing.m,
|
gap: spacing.m,
|
||||||
},
|
},
|
||||||
modalTitle: { fontSize: fontSize.l, fontWeight: "700", color: colors.text },
|
modalTitle: { fontSize: fontSize.lg, fontWeight: "700", color: colors.textPrimary },
|
||||||
input: {
|
input: {
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderColor: colors.border,
|
borderColor: colors.border,
|
||||||
borderRadius: borderRadius.m,
|
borderRadius: borderRadius.md,
|
||||||
padding: spacing.m,
|
padding: spacing.m,
|
||||||
color: colors.text,
|
color: colors.textPrimary,
|
||||||
fontSize: fontSize.m,
|
fontSize: fontSize.md,
|
||||||
backgroundColor: colors.background,
|
backgroundColor: colors.bgInput,
|
||||||
},
|
},
|
||||||
modalBtns: { flexDirection: "row", gap: spacing.s },
|
modalBtns: { flexDirection: "row", gap: spacing.s },
|
||||||
cancelBtn: {
|
cancelBtn: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
padding: spacing.m,
|
padding: spacing.m,
|
||||||
borderRadius: borderRadius.m,
|
borderRadius: borderRadius.md,
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderColor: colors.border,
|
borderColor: colors.border,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
},
|
},
|
||||||
cancelBtnText: { color: colors.text, fontWeight: "600" },
|
cancelBtnText: { color: colors.textPrimary, fontWeight: "600" },
|
||||||
saveBtn: {
|
saveBtn: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
padding: spacing.m,
|
padding: spacing.m,
|
||||||
borderRadius: borderRadius.m,
|
borderRadius: borderRadius.md,
|
||||||
backgroundColor: colors.accent,
|
backgroundColor: colors.accent,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
},
|
},
|
||||||
saveBtnText: { color: "#fff", fontWeight: "600" },
|
saveBtnText: { color: colors.textWhite, fontWeight: "600" },
|
||||||
empty: { textAlign: "center", color: colors.textSecondary, marginTop: spacing.xl },
|
empty: {
|
||||||
|
textAlign: "center",
|
||||||
|
color: colors.textSecondary,
|
||||||
|
marginTop: spacing.xl,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (loading) return <LoadingSpinner />;
|
if (loading) return <LoadingSpinner />;
|
||||||
@@ -190,7 +199,7 @@ export default function CategoriesScreen() {
|
|||||||
<View style={styles.header}>
|
<View style={styles.header}>
|
||||||
<Text style={styles.title}>Catégories</Text>
|
<Text style={styles.title}>Catégories</Text>
|
||||||
<TouchableOpacity style={styles.addBtn} onPress={openCreate}>
|
<TouchableOpacity style={styles.addBtn} onPress={openCreate}>
|
||||||
<Ionicons name="add" size={18} color="#fff" />
|
<Ionicons name="add" size={18} color={colors.textWhite} />
|
||||||
<Text style={styles.addBtnText}>Ajouter</Text>
|
<Text style={styles.addBtnText}>Ajouter</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
@@ -208,7 +217,8 @@ export default function CategoriesScreen() {
|
|||||||
<View>
|
<View>
|
||||||
<Text style={styles.catName}>{item.name}</Text>
|
<Text style={styles.catName}>{item.name}</Text>
|
||||||
<Text style={styles.catDate}>
|
<Text style={styles.catDate}>
|
||||||
Créée le {new Date(item.created_at).toLocaleDateString("fr-FR")}
|
Créée le{" "}
|
||||||
|
{new Date(item.created_at).toLocaleDateString("fr-FR")}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.actions}>
|
<View style={styles.actions}>
|
||||||
@@ -216,13 +226,21 @@ export default function CategoriesScreen() {
|
|||||||
style={styles.actionBtn}
|
style={styles.actionBtn}
|
||||||
onPress={() => openEdit(item)}
|
onPress={() => openEdit(item)}
|
||||||
>
|
>
|
||||||
<Ionicons name="pencil-outline" size={20} color={colors.info} />
|
<Ionicons
|
||||||
|
name="pencil-outline"
|
||||||
|
size={20}
|
||||||
|
color={colors.info}
|
||||||
|
/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={styles.actionBtn}
|
style={styles.actionBtn}
|
||||||
onPress={() => handleDelete(item)}
|
onPress={() => handleDelete(item)}
|
||||||
>
|
>
|
||||||
<Ionicons name="trash-outline" size={20} color={colors.danger} />
|
<Ionicons
|
||||||
|
name="trash-outline"
|
||||||
|
size={20}
|
||||||
|
color={colors.danger}
|
||||||
|
/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
@@ -270,10 +288,10 @@ export default function CategoriesScreen() {
|
|||||||
type={alert.type}
|
type={alert.type}
|
||||||
title={alert.title}
|
title={alert.title}
|
||||||
message={alert.message}
|
message={alert.message}
|
||||||
onConfirm={alert.onConfirm || hideAlert}
|
onClose={hideAlert}
|
||||||
onCancel={alert.type === "confirm" ? hideAlert : undefined}
|
onConfirm={alert.onConfirm}
|
||||||
confirmText={alert.type === "confirm" ? "Confirmer" : "OK"}
|
confirmText={alert.confirmText || (alert.type === "confirm" ? "Confirmer" : "OK")}
|
||||||
cancelText="Annuler"
|
cancelText={alert.cancelText || "Annuler"}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user