chore: update
This commit is contained in:
@@ -25,6 +25,7 @@ import OrdersScreen from "../screens/cabine/OrdersScreen";
|
||||
import DeliveryScreen from "../screens/cabine/DeliveryScreen";
|
||||
import UsersScreen from "../screens/cabine/UsersScreen";
|
||||
import AlertsScreen from "../screens/cabine/AlertsScreen";
|
||||
import AddressScreen from "../screens/cabine/AddressScreen";
|
||||
|
||||
const Tab = createBottomTabNavigator<CabineTabParamList>();
|
||||
|
||||
@@ -42,7 +43,9 @@ export default function CabineNavigator() {
|
||||
const res = await getCabineNotifications();
|
||||
setNotifications(res.notifications ?? []);
|
||||
setUnreadCount(res.unread_count ?? 0);
|
||||
} catch { /* ignore */ }
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -59,8 +62,12 @@ export default function CabineNavigator() {
|
||||
try {
|
||||
await markCabineNotificationsRead();
|
||||
setUnreadCount(0);
|
||||
setNotifications((prev) => prev.map((n) => ({ ...n, read: true })));
|
||||
} catch { /* ignore */ }
|
||||
setNotifications((prev) =>
|
||||
prev.map((n) => ({ ...n, read: true })),
|
||||
);
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -106,11 +113,16 @@ export default function CabineNavigator() {
|
||||
<View
|
||||
style={[
|
||||
styles.badge,
|
||||
{ backgroundColor: colors.danger },
|
||||
{
|
||||
backgroundColor:
|
||||
colors.danger,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Text style={styles.badgeText}>
|
||||
{unreadCount > 9 ? "9+" : unreadCount}
|
||||
{unreadCount > 9
|
||||
? "9+"
|
||||
: unreadCount}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
@@ -121,7 +133,11 @@ export default function CabineNavigator() {
|
||||
style={{ marginRight: spacing.m }}
|
||||
>
|
||||
<Ionicons
|
||||
name={isDark ? "sunny-outline" : "moon-outline"}
|
||||
name={
|
||||
isDark
|
||||
? "sunny-outline"
|
||||
: "moon-outline"
|
||||
}
|
||||
size={22}
|
||||
color={colors.textSecondary}
|
||||
/>
|
||||
@@ -151,7 +167,11 @@ export default function CabineNavigator() {
|
||||
options={{
|
||||
title: "Dashboard",
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="grid-outline" size={size} color={color} />
|
||||
<Ionicons
|
||||
name="grid-outline"
|
||||
size={size}
|
||||
color={color}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
@@ -161,7 +181,11 @@ export default function CabineNavigator() {
|
||||
options={{
|
||||
title: "Commandes",
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="receipt-outline" size={size} color={color} />
|
||||
<Ionicons
|
||||
name="receipt-outline"
|
||||
size={size}
|
||||
color={color}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
@@ -171,7 +195,11 @@ export default function CabineNavigator() {
|
||||
options={{
|
||||
title: "Livreurs",
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="bicycle-outline" size={size} color={color} />
|
||||
<Ionicons
|
||||
name="bicycle-outline"
|
||||
size={size}
|
||||
color={color}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
@@ -181,7 +209,11 @@ export default function CabineNavigator() {
|
||||
options={{
|
||||
title: "Clients",
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="people-outline" size={size} color={color} />
|
||||
<Ionicons
|
||||
name="people-outline"
|
||||
size={size}
|
||||
color={color}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
@@ -191,7 +223,25 @@ export default function CabineNavigator() {
|
||||
options={{
|
||||
title: "Alertes",
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="alert-circle-outline" size={size} color={color} />
|
||||
<Ionicons
|
||||
name="alert-circle-outline"
|
||||
size={size}
|
||||
color={color}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="Adresses"
|
||||
component={AddressScreen}
|
||||
options={{
|
||||
title: "Adresses",
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons
|
||||
name="map-outline"
|
||||
size={size}
|
||||
color={color}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
@@ -211,16 +261,32 @@ export default function CabineNavigator() {
|
||||
]}
|
||||
>
|
||||
<View style={styles.modalHeader}>
|
||||
<Text style={[styles.modalTitle, { color: colors.textWhite }]}>
|
||||
<Text
|
||||
style={[
|
||||
styles.modalTitle,
|
||||
{ color: colors.textWhite },
|
||||
]}
|
||||
>
|
||||
Notifications
|
||||
</Text>
|
||||
<TouchableOpacity onPress={() => setModalVisible(false)}>
|
||||
<Ionicons name="close" size={24} color={colors.textSecondary} />
|
||||
<TouchableOpacity
|
||||
onPress={() => setModalVisible(false)}
|
||||
>
|
||||
<Ionicons
|
||||
name="close"
|
||||
size={24}
|
||||
color={colors.textSecondary}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
<ScrollView style={styles.notifList}>
|
||||
{notifications.length === 0 ? (
|
||||
<Text style={[styles.emptyText, { color: colors.textMuted }]}>
|
||||
<Text
|
||||
style={[
|
||||
styles.emptyText,
|
||||
{ color: colors.textMuted },
|
||||
]}
|
||||
>
|
||||
Aucune notification
|
||||
</Text>
|
||||
) : (
|
||||
@@ -235,7 +301,8 @@ export default function CabineNavigator() {
|
||||
: colors.info,
|
||||
backgroundColor: n.read
|
||||
? "transparent"
|
||||
: colors.bgPrimary ?? colors.bgSecondary,
|
||||
: (colors.bgPrimary ??
|
||||
colors.bgSecondary),
|
||||
},
|
||||
]}
|
||||
>
|
||||
@@ -248,7 +315,10 @@ export default function CabineNavigator() {
|
||||
{n.message}
|
||||
</Text>
|
||||
<Text
|
||||
style={[styles.notifTime, { color: colors.textMuted }]}
|
||||
style={[
|
||||
styles.notifTime,
|
||||
{ color: colors.textMuted },
|
||||
]}
|
||||
>
|
||||
{formatTime(n.created_at)}
|
||||
</Text>
|
||||
|
||||
@@ -28,6 +28,7 @@ export type CabineTabParamList = {
|
||||
Delivery: undefined;
|
||||
Users: undefined;
|
||||
Alerts: undefined;
|
||||
Adresses: undefined;
|
||||
};
|
||||
|
||||
export type DeliveryTabParamList = {
|
||||
|
||||
@@ -319,11 +319,6 @@ export default function SettingsScreen() {
|
||||
const ZIP_COLOR = "#9333ea";
|
||||
const TOTAL_COLOR = "#f97316";
|
||||
|
||||
// Le mode séparé nécessite que W ET Z aient au moins une catégorie
|
||||
const hasBothPools =
|
||||
(settings.points_categories_weed ?? []).length > 0 &&
|
||||
(settings.points_categories_zipette ?? []).length > 0;
|
||||
|
||||
// Chips disponibles selon le mode
|
||||
const availableChips: PoolAssignment[] = settings.points_separated
|
||||
? ["weed", "zipette", "none"] // mode séparé : T désactivé
|
||||
@@ -411,20 +406,16 @@ export default function SettingsScreen() {
|
||||
thumbColor="#fff"
|
||||
/>
|
||||
</View>
|
||||
<View style={[s.row, { opacity: hasBothPools ? 1 : 0.4 }]}>
|
||||
<View style={s.row}>
|
||||
<View style={s.rowLeft}>
|
||||
<Text style={s.rowLabel}>Points séparés par pool</Text>
|
||||
<Text style={s.rowDesc}>
|
||||
Activé : Weed → point / Zipette → point_zipette{"\n"}
|
||||
Désactivé : Barème Total sur la somme W+Z{"\n"}
|
||||
{!hasBothPools && (
|
||||
"⚠️ Nécessite des catégories W ET Z configurées"
|
||||
)}
|
||||
Activé : barèmes Weed + Zipette utilisés séparément{"\n"}
|
||||
Désactivé : barème Total utilisé (catégorie T)
|
||||
</Text>
|
||||
</View>
|
||||
<Switch
|
||||
value={settings.points_separated}
|
||||
disabled={!hasBothPools}
|
||||
onValueChange={(v) =>
|
||||
setSettings((prev) => ({ ...prev, points_separated: v }))
|
||||
}
|
||||
@@ -542,9 +533,7 @@ export default function SettingsScreen() {
|
||||
)}
|
||||
</View>
|
||||
|
||||
{/* Barème de points — conditionnel selon le mode */}
|
||||
{settings.points_separated ? (
|
||||
<>
|
||||
{/* Barèmes de points — toujours présents */}
|
||||
<TiersSection
|
||||
title="Barème Weed / Hash"
|
||||
tiers={settings.points_weed_tiers ?? []}
|
||||
@@ -561,17 +550,14 @@ export default function SettingsScreen() {
|
||||
s={s}
|
||||
accentColor={ZIP_COLOR}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<TiersSection
|
||||
title="Barème Total (W + Z)"
|
||||
title="Barème Total"
|
||||
tiers={settings.points_total_tiers ?? []}
|
||||
onChange={(tiers) => setSettings((p) => ({ ...p, points_total_tiers: tiers }))}
|
||||
colors={colors}
|
||||
s={s}
|
||||
accentColor={TOTAL_COLOR}
|
||||
/>
|
||||
)}
|
||||
|
||||
<TouchableOpacity
|
||||
style={s.saveButton}
|
||||
|
||||
Reference in New Issue
Block a user