chore: fix
This commit is contained in:
@@ -710,7 +710,9 @@ export const markNotificationsRead = async (): Promise<{
|
||||
|
||||
export interface PublicSettings {
|
||||
penalties_enabled: boolean;
|
||||
show_amende_score: boolean;
|
||||
points_enabled: boolean;
|
||||
points_separated: boolean;
|
||||
}
|
||||
|
||||
export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||
@@ -718,10 +720,12 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||
const { data } = await apiClient.get(`${V1}/app-settings`);
|
||||
return {
|
||||
penalties_enabled: data.penalties_enabled ?? true,
|
||||
show_amende_score: data.show_amende_score ?? true,
|
||||
points_enabled: data.points_enabled ?? true,
|
||||
points_separated: data.points_separated ?? true,
|
||||
};
|
||||
} catch {
|
||||
return { penalties_enabled: true, points_enabled: true };
|
||||
return { penalties_enabled: true, show_amende_score: true, points_enabled: true, points_separated: true };
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ export default function OrderHistoryScreen() {
|
||||
const [orders, setOrders] = useState<CompletedOrder[]>([]);
|
||||
const [stats, setStats] = useState<ClientStats | null>(null);
|
||||
const [penalties, setPenalties] = useState<PenaltyInfo | null>(null);
|
||||
const [appSettings, setAppSettings] = useState<PublicSettings>({ penalties_enabled: true, points_enabled: true });
|
||||
const [appSettings, setAppSettings] = useState<PublicSettings>({ penalties_enabled: true, show_amende_score: true, points_enabled: true, points_separated: true });
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
|
||||
@@ -245,33 +245,49 @@ export default function OrderHistoryScreen() {
|
||||
<Text style={styles.statLabel}>Commandes</Text>
|
||||
</View>
|
||||
{appSettings.points_enabled && (
|
||||
<>
|
||||
<View style={[styles.statCard, shadows.sm]}>
|
||||
<Ionicons
|
||||
name="leaf-outline"
|
||||
size={24}
|
||||
color={colors.categoryWeedHash}
|
||||
/>
|
||||
<Text style={styles.statValue}>
|
||||
{stats?.points || 0}
|
||||
</Text>
|
||||
<Text style={styles.statLabel}>
|
||||
Pts Weed/Hash
|
||||
</Text>
|
||||
</View>
|
||||
<View style={[styles.statCard, shadows.sm]}>
|
||||
<Ionicons
|
||||
name="flash-outline"
|
||||
size={24}
|
||||
color={colors.info}
|
||||
/>
|
||||
<Text style={styles.statValue}>
|
||||
{stats?.points_zipette || 0}
|
||||
</Text>
|
||||
<Text style={styles.statLabel}>
|
||||
Pts Zipette
|
||||
</Text>
|
||||
</View>
|
||||
appSettings.points_separated ? (
|
||||
<>
|
||||
<View style={[styles.statCard, shadows.sm]}>
|
||||
<Ionicons
|
||||
name="leaf-outline"
|
||||
size={24}
|
||||
color={colors.categoryWeedHash}
|
||||
/>
|
||||
<Text style={styles.statValue}>
|
||||
{stats?.points || 0}
|
||||
</Text>
|
||||
<Text style={styles.statLabel}>
|
||||
Pts Weed/Hash
|
||||
</Text>
|
||||
</View>
|
||||
<View style={[styles.statCard, shadows.sm]}>
|
||||
<Ionicons
|
||||
name="flash-outline"
|
||||
size={24}
|
||||
color={colors.info}
|
||||
/>
|
||||
<Text style={styles.statValue}>
|
||||
{stats?.points_zipette || 0}
|
||||
</Text>
|
||||
<Text style={styles.statLabel}>
|
||||
Pts Zipette
|
||||
</Text>
|
||||
</View>
|
||||
<View style={[styles.statCard, shadows.sm]}>
|
||||
<Ionicons
|
||||
name="trophy-outline"
|
||||
size={24}
|
||||
color={colors.warning}
|
||||
/>
|
||||
<Text style={styles.statValue}>
|
||||
{totalPoints}
|
||||
</Text>
|
||||
<Text style={styles.statLabel}>
|
||||
Total Points
|
||||
</Text>
|
||||
</View>
|
||||
</>
|
||||
) : (
|
||||
<View style={[styles.statCard, shadows.sm]}>
|
||||
<Ionicons
|
||||
name="trophy-outline"
|
||||
@@ -279,17 +295,17 @@ export default function OrderHistoryScreen() {
|
||||
color={colors.warning}
|
||||
/>
|
||||
<Text style={styles.statValue}>
|
||||
{totalPoints}
|
||||
{stats?.points || 0}
|
||||
</Text>
|
||||
<Text style={styles.statLabel}>
|
||||
Total Points
|
||||
Points
|
||||
</Text>
|
||||
</View>
|
||||
</>
|
||||
)
|
||||
)}
|
||||
</View>
|
||||
|
||||
{appSettings.penalties_enabled && penaltyCount > 0 && (
|
||||
{appSettings.show_amende_score && penaltyCount > 0 && (
|
||||
<View
|
||||
style={[
|
||||
styles.penaltyBanner,
|
||||
|
||||
Reference in New Issue
Block a user