This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"expo": {
|
"expo": {
|
||||||
"name": "Admin Panel",
|
"name": "Admin Panel",
|
||||||
"slug": "frontend-admin",
|
"slug": "frontend-admin",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"orientation": "portrait",
|
"orientation": "portrait",
|
||||||
"icon": "./assets/icon.png",
|
"icon": "./assets/icon.png",
|
||||||
"userInterfaceStyle": "dark",
|
"userInterfaceStyle": "dark",
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
StatusBar,
|
StatusBar,
|
||||||
useWindowDimensions,
|
useWindowDimensions,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Pressable,
|
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { spacing, fontSize, borderRadius } from "../../theme";
|
import { spacing, fontSize, borderRadius } from "../../theme";
|
||||||
@@ -501,14 +500,10 @@ export default function DeliveryScreen() {
|
|||||||
borderTopLeftRadius: borderRadius.xl,
|
borderTopLeftRadius: borderRadius.xl,
|
||||||
borderTopRightRadius: borderRadius.xl,
|
borderTopRightRadius: borderRadius.xl,
|
||||||
padding: spacing.l,
|
padding: spacing.l,
|
||||||
// maxHeight en pourcentage ne se résout pas de façon fiable
|
maxHeight: "80%",
|
||||||
// ici : le parent direct est un Pressable sans style (donc
|
},
|
||||||
// sans hauteur définie), et un pourcentage a besoin d'un
|
ratingsList: {
|
||||||
// ancêtre à hauteur définie pour se calculer. Une valeur
|
padding: spacing.s,
|
||||||
// en pixels dérivée de screenHeight fonctionne toujours.
|
|
||||||
maxHeight: screenHeight * 0.8,
|
|
||||||
flexShrink: 1,
|
|
||||||
overflow: "hidden",
|
|
||||||
},
|
},
|
||||||
ratingsHeader: {
|
ratingsHeader: {
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
@@ -1083,69 +1078,67 @@ export default function DeliveryScreen() {
|
|||||||
animationType="slide"
|
animationType="slide"
|
||||||
onRequestClose={() => setRatingsModal(null)}
|
onRequestClose={() => setRatingsModal(null)}
|
||||||
>
|
>
|
||||||
<Pressable style={styles.ratingsOverlay} onPress={() => setRatingsModal(null)}>
|
<View style={styles.ratingsOverlay}>
|
||||||
<Pressable onPress={() => {}}>
|
<View style={styles.ratingsSheet}>
|
||||||
<View style={styles.ratingsSheet}>
|
<View style={styles.ratingsHeader}>
|
||||||
<View style={styles.ratingsHeader}>
|
<Text style={styles.ratingsTitle}>
|
||||||
<Text style={styles.ratingsTitle}>
|
Avis — {ratingsModal?.username}
|
||||||
Avis — {ratingsModal?.username}
|
</Text>
|
||||||
</Text>
|
<TouchableOpacity onPress={() => setRatingsModal(null)}>
|
||||||
<TouchableOpacity onPress={() => setRatingsModal(null)}>
|
<Ionicons name="close" size={22} color={colors.textMuted} />
|
||||||
<Ionicons name="close" size={22} color={colors.textMuted} />
|
</TouchableOpacity>
|
||||||
</TouchableOpacity>
|
|
||||||
</View>
|
|
||||||
{ratingsLoading ? (
|
|
||||||
<Text style={styles.ratingsEmpty}>Chargement...</Text>
|
|
||||||
) : ratingsModal && ratingsModal.count > 0 ? (
|
|
||||||
<>
|
|
||||||
<View style={styles.ratingsAvg}>
|
|
||||||
{[1,2,3,4,5].map((s) => (
|
|
||||||
<Ionicons
|
|
||||||
key={s}
|
|
||||||
name={s <= Math.round(ratingsModal.average) ? "star" : "star-outline"}
|
|
||||||
size={20}
|
|
||||||
color="#f59e0b"
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
<Text style={styles.ratingsAvgText}>
|
|
||||||
{ratingsModal.average.toFixed(1)}
|
|
||||||
</Text>
|
|
||||||
<Text style={styles.ratingsCount}>
|
|
||||||
({ratingsModal.count} avis)
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
<ScrollView style={{ flex: 1 }} showsVerticalScrollIndicator={false}>
|
|
||||||
{ratingsModal.ratings.map((r) => (
|
|
||||||
<View key={r.id} style={styles.ratingItem}>
|
|
||||||
<View style={styles.ratingItemHeader}>
|
|
||||||
<Text style={styles.ratingItemClient}>{r.client_username}</Text>
|
|
||||||
<Text style={styles.ratingItemDate}>
|
|
||||||
{new Date(r.created_at).toLocaleDateString("fr-FR")}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
<View style={styles.ratingStarsRow}>
|
|
||||||
{[1,2,3,4,5].map((s) => (
|
|
||||||
<Ionicons
|
|
||||||
key={s}
|
|
||||||
name={s <= r.rating ? "star" : "star-outline"}
|
|
||||||
size={14}
|
|
||||||
color="#f59e0b"
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</View>
|
|
||||||
{r.comment !== "" && (
|
|
||||||
<Text style={styles.ratingItemComment}>"{r.comment}"</Text>
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
))}
|
|
||||||
</ScrollView>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<Text style={styles.ratingsEmpty}>Aucun avis pour ce livreur</Text>
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
</Pressable>
|
{ratingsLoading ? (
|
||||||
</Pressable>
|
<Text style={styles.ratingsEmpty}>Chargement...</Text>
|
||||||
|
) : ratingsModal && ratingsModal.count > 0 ? (
|
||||||
|
<>
|
||||||
|
<View style={styles.ratingsAvg}>
|
||||||
|
{[1,2,3,4,5].map((s) => (
|
||||||
|
<Ionicons
|
||||||
|
key={s}
|
||||||
|
name={s <= Math.round(ratingsModal.average) ? "star" : "star-outline"}
|
||||||
|
size={20}
|
||||||
|
color="#f59e0b"
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
<Text style={styles.ratingsAvgText}>
|
||||||
|
{ratingsModal.average.toFixed(1)}
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.ratingsCount}>
|
||||||
|
({ratingsModal.count} avis)
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<ScrollView style={styles.ratingsList}>
|
||||||
|
{ratingsModal.ratings.map((r) => (
|
||||||
|
<View key={r.id} style={styles.ratingItem}>
|
||||||
|
<View style={styles.ratingItemHeader}>
|
||||||
|
<Text style={styles.ratingItemClient}>{r.client_username}</Text>
|
||||||
|
<Text style={styles.ratingItemDate}>
|
||||||
|
{new Date(r.created_at).toLocaleDateString("fr-FR")}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View style={styles.ratingStarsRow}>
|
||||||
|
{[1,2,3,4,5].map((s) => (
|
||||||
|
<Ionicons
|
||||||
|
key={s}
|
||||||
|
name={s <= r.rating ? "star" : "star-outline"}
|
||||||
|
size={14}
|
||||||
|
color="#f59e0b"
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
{r.comment !== "" && (
|
||||||
|
<Text style={styles.ratingItemComment}>"{r.comment}"</Text>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
</ScrollView>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<Text style={styles.ratingsEmpty}>Aucun avis pour ce livreur</Text>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
{/* ── Modal historique de connexion livreur ── */}
|
{/* ── Modal historique de connexion livreur ── */}
|
||||||
@@ -1155,12 +1148,8 @@ export default function DeliveryScreen() {
|
|||||||
animationType="slide"
|
animationType="slide"
|
||||||
onRequestClose={() => setLoginHistoryModal(null)}
|
onRequestClose={() => setLoginHistoryModal(null)}
|
||||||
>
|
>
|
||||||
<Pressable
|
<View style={styles.ratingsOverlay}>
|
||||||
style={styles.ratingsOverlay}
|
<View style={styles.ratingsSheet}>
|
||||||
onPress={() => setLoginHistoryModal(null)}
|
|
||||||
>
|
|
||||||
<Pressable onPress={() => {}}>
|
|
||||||
<View style={styles.ratingsSheet}>
|
|
||||||
<View style={styles.ratingsHeader}>
|
<View style={styles.ratingsHeader}>
|
||||||
<Text style={styles.ratingsTitle}>
|
<Text style={styles.ratingsTitle}>
|
||||||
Connexions — {loginHistoryModal?.username}
|
Connexions — {loginHistoryModal?.username}
|
||||||
@@ -1265,7 +1254,7 @@ export default function DeliveryScreen() {
|
|||||||
</Text>
|
</Text>
|
||||||
) : loginHistoryModal &&
|
) : loginHistoryModal &&
|
||||||
loginHistoryModal.weeks.length > 0 ? (
|
loginHistoryModal.weeks.length > 0 ? (
|
||||||
<ScrollView style={{ flex: 1 }} showsVerticalScrollIndicator={false}>
|
<ScrollView style={styles.ratingsList}>
|
||||||
{loginHistoryModal.weeks.map((week) => (
|
{loginHistoryModal.weeks.map((week) => (
|
||||||
<View key={week.week}>
|
<View key={week.week}>
|
||||||
<Text style={styles.historyWeekLabel}>
|
<Text style={styles.historyWeekLabel}>
|
||||||
@@ -1317,9 +1306,8 @@ export default function DeliveryScreen() {
|
|||||||
Aucune connexion ce mois-ci
|
Aucune connexion ce mois-ci
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</Pressable>
|
</View>
|
||||||
</Pressable>
|
|
||||||
</Modal>
|
</Modal>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user