import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
-import { TouchableOpacity, View } from "react-native";
+import { TouchableOpacity } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import DashboardScreen from "./src/screens/DashboardScreen";
import StrategyScreen from "./src/screens/StrategyScreen";
import WalletScreen from "./src/screens/WalletScreen";
+// Types des routes (pour éviter les erreurs de navigation)
export type RootStackParamList = {
Dashboard: undefined;
Settings: undefined;
options={({ navigation }) => ({
title: "Dashboard",
headerRight: () => (
- <View style={{ flexDirection: "row", gap: 12 }}>
- <TouchableOpacity onPress={() => navigation.navigate("Alerts")}>
- <Ionicons name="notifications-outline" size={22} color="#0f172a" />
- </TouchableOpacity>
-
- <TouchableOpacity onPress={() => navigation.navigate("History")}>
- <Ionicons name="time-outline" size={22} color="#0f172a" />
- </TouchableOpacity>
-
- <TouchableOpacity onPress={() => navigation.navigate("Settings")}>
- <Ionicons name="settings-outline" size={22} color="#0f172a" />
- </TouchableOpacity>
- </View>
+ <TouchableOpacity onPress={() => navigation.navigate("Settings")}>
+ <Ionicons name="settings-outline" size={22} color="#0f172a" />
+ </TouchableOpacity>
),
})}
/>
- <Stack.Screen name="Wallet" component={WalletScreen} options={{ title: "Portefeuille" }} />
- <Stack.Screen name="Strategy" component={StrategyScreen} options={{ title: "Stratégie" }} />
- <Stack.Screen name="Alerts" component={AlertsScreen} options={{ title: "Alertes" }} />
- <Stack.Screen name="History" component={HistoryScreen} options={{ title: "Historique" }} />
- <Stack.Screen name="Settings" component={SettingsScreen} options={{ title: "Paramètres" }} />
+ <Stack.Screen
+ name="Wallet"
+ component={WalletScreen}
+ options={{ title: "Portefeuille" }}
+ />
+
+ <Stack.Screen
+ name="Strategy"
+ component={StrategyScreen}
+ options={{ title: "Stratégie" }}
+ />
+
+ <Stack.Screen
+ name="Alerts"
+ component={AlertsScreen}
+ options={{ title: "Alertes" }}
+ />
+
+ <Stack.Screen
+ name="History"
+ component={HistoryScreen}
+ options={{ title: "Historique" }}
+ />
+
+ <Stack.Screen
+ name="Settings"
+ component={SettingsScreen}
+ options={{ title: "Paramètres" }}
+ />
</Stack.Navigator>
</NavigationContainer>
);
+++ /dev/null
-import { View, Text, TouchableOpacity } from "react-native";
-import { ui } from "./ui/uiStyles";
-
-type Props = {
- onGoSettings: () => void;
- onGoHistory: () => void;
- onGoAlerts: () => void;
-};
-
-/**
- * ActionsCard
- * -----------
- * Regroupe les actions rapides de l'utilisateur.
- * Pour l'instant :
- * - Voir stratégie (placeholder)
- * - Historique (placeholder)
- * - Paramètres (navigation réelle via callback)
- * - Alertes (navigation réelle via callback)
- */
-export default function ActionsCard({ onGoSettings, onGoHistory, onGoAlerts }: Props) {
- return (
- <View style={ui.card}>
- <Text style={ui.title}>Actions</Text>
-
- <View style={[ui.rowBetween, { flexWrap: "wrap", gap: 8 }]}>
- <TouchableOpacity style={ui.button} onPress={onGoAlerts}>
- <Text style={ui.buttonText}>Alertes</Text>
- </TouchableOpacity>
-
- <TouchableOpacity style={ui.button} onPress={onGoHistory}>
- <Text style={ui.buttonText}>Historique</Text>
- </TouchableOpacity>
-
- <TouchableOpacity style={ui.button} onPress={onGoSettings}>
- <Text style={ui.buttonText}>Paramètres</Text>
- </TouchableOpacity>
- </View>
- </View>
- );
-}
\ No newline at end of file
import { useState, useCallback, useEffect, useMemo } from "react";
import { SafeAreaView } from "react-native-safe-area-context";
import { useFocusEffect, useNavigation } from "@react-navigation/native";
+import { Ionicons } from "@expo/vector-icons";
import type { DashboardSummary } from "../types/DashboardSummary";
import { fetchDashboardSummary } from "../services/dashboardService";
/**
* DashboardScreen (WF-01) — Responsive + No-scroll goal
* ----------------------------------------------------
- * - Navigation via header icons (Alerts / History / Settings) dans App.tsx
- * - Cartes cliquables :
+ * - Cartes cliquables (chevron subtil) :
* * Portefeuille -> Wallet
* * Urgence -> Alertes
* * Prix BTC -> Historique
* - Conseiller : bouton -> Stratégie
* - Socket.IO non bloquant + notifications locales
- *
- * Portefeuille (Step 1):
- * - Quantité BTC stockée localement (AsyncStorage)
- * - Valeur totale = quantity * prix BTC
- * - Ligne info: "BTC @ prix actuel"
*/
export default function DashboardScreen() {
const { height } = useWindowDimensions();
);
}
+ const Chevron = () => (
+ <Ionicons name="chevron-forward-outline" size={18} color="#0f172a" style={{ opacity: 0.35 }} />
+ );
+
return (
<SafeAreaView style={styles.safeArea}>
<ScrollView
{/* 2) PORTEFEUILLE — cliquable => Wallet */}
<TouchableOpacity activeOpacity={0.85} onPress={() => navigation.navigate("Wallet" as never)}>
<View style={[ui.card, compact && styles.cardCompact]}>
- <Text style={[ui.title, compact && styles.titleCompact]}>Portefeuille</Text>
+ <View style={styles.headerRow}>
+ <Text style={[ui.title, compact && styles.titleCompact]}>Portefeuille</Text>
+ <Chevron />
+ </View>
<View style={ui.rowBetween}>
<Text style={ui.value}>Quantité BTC :</Text>
</Text>
</View>
- {/* ✅ Ligne informative : BTC @ prix actuel */}
<Text style={[ui.muted, { marginTop: 6 }]} numberOfLines={1}>
BTC @ {summary.price.toFixed(2)} {settings.currency}
</Text>
{/* 3) URGENCE — cliquable => Alertes */}
<TouchableOpacity activeOpacity={0.85} onPress={() => navigation.navigate("Alerts" as never)}>
<View style={[ui.card, compact && styles.cardCompact]}>
- <Text style={[ui.title, compact && styles.titleCompact]}>Urgence</Text>
+ <View style={styles.headerRow}>
+ <Text style={[ui.title, compact && styles.titleCompact]}>Urgence</Text>
+ <Chevron />
+ </View>
{urgentAlert ? (
<View style={[styles.urgentBox, compact && styles.urgentBoxCompact]}>
Socket : {socketConnected ? "connecté ✅" : "déconnecté ⚠️"}
{socketError ? ` — ${socketError}` : ""}
</Text>
-
- <Text style={[ui.muted, { marginTop: 6 }]} numberOfLines={1}>
- Appuie pour ouvrir “Alertes”
- </Text>
</View>
</TouchableOpacity>
<TouchableOpacity activeOpacity={0.85} onPress={() => navigation.navigate("History" as never)}>
<View style={[ui.card, compact && styles.cardCompact]}>
<View style={styles.priceHeaderRow}>
- <Text style={[ui.title, compact && styles.titleCompact]}>Prix BTC</Text>
+ <View style={styles.headerRow}>
+ <Text style={[ui.title, compact && styles.titleCompact]}>Prix BTC</Text>
+ <Chevron />
+ </View>
<TouchableOpacity
style={[styles.refreshBtn, refreshing && styles.refreshBtnDisabled, compact && styles.refreshBtnCompact]}
</Text>
</View>
</View>
-
- <Text style={[ui.muted, { marginTop: 6 }]} numberOfLines={1}>
- Appuie pour ouvrir “Historique”
- </Text>
</View>
</TouchableOpacity>
</ScrollView>
marginTop: 10,
},
+ // ✅ header row + chevron icon
+ headerRow: {
+ flexDirection: "row",
+ justifyContent: "space-between",
+ alignItems: "center",
+ },
+
urgentBox: {
borderWidth: 1,
borderColor: "#e5e7eb",
alignItems: "center",
marginBottom: 8,
},
+
refreshBtn: {
paddingHorizontal: 12,
paddingVertical: 8,