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>
|
||||
|
||||
@@ -1,37 +1,38 @@
|
||||
export type AuthStackParamList = {
|
||||
RoleSelect: undefined;
|
||||
AdminLogin: undefined;
|
||||
CabineLogin: undefined;
|
||||
DeliveryLogin: undefined;
|
||||
RoleSelect: undefined;
|
||||
AdminLogin: undefined;
|
||||
CabineLogin: undefined;
|
||||
DeliveryLogin: undefined;
|
||||
};
|
||||
|
||||
export type AdminTabParamList = {
|
||||
Dashboard: undefined;
|
||||
Orders: undefined;
|
||||
Users: undefined;
|
||||
Products: undefined;
|
||||
Categories: undefined;
|
||||
Delivery: undefined;
|
||||
Alerts: undefined;
|
||||
Addresses: undefined;
|
||||
Dashboard: undefined;
|
||||
Orders: undefined;
|
||||
Users: undefined;
|
||||
Products: undefined;
|
||||
Categories: undefined;
|
||||
Delivery: undefined;
|
||||
Alerts: undefined;
|
||||
Addresses: undefined;
|
||||
};
|
||||
|
||||
export type AdminStackParamList = {
|
||||
AdminTabs: undefined;
|
||||
OrderDetail: { orderId: number };
|
||||
Settings: undefined;
|
||||
AdminTabs: undefined;
|
||||
OrderDetail: { orderId: number };
|
||||
Settings: undefined;
|
||||
};
|
||||
|
||||
export type CabineTabParamList = {
|
||||
Dashboard: undefined;
|
||||
Orders: undefined;
|
||||
Delivery: undefined;
|
||||
Users: undefined;
|
||||
Alerts: undefined;
|
||||
Dashboard: undefined;
|
||||
Orders: undefined;
|
||||
Delivery: undefined;
|
||||
Users: undefined;
|
||||
Alerts: undefined;
|
||||
Adresses: undefined;
|
||||
};
|
||||
|
||||
export type DeliveryTabParamList = {
|
||||
Dashboard: undefined;
|
||||
Stats: undefined;
|
||||
Alerts: undefined;
|
||||
Dashboard: undefined;
|
||||
Stats: undefined;
|
||||
Alerts: undefined;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user