From 6dbda9d927c5cbb62611b987b53190d9781b791f Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Fri, 13 Dec 2024 00:06:01 +0100 Subject: [PATCH] Le menu de carte est dans un ficher map.tsx --- client/app/(tabs)/index.tsx | 59 ++----------------------------------- client/app/(tabs)/map.tsx | 58 ++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 57 deletions(-) create mode 100644 client/app/(tabs)/map.tsx diff --git a/client/app/(tabs)/index.tsx b/client/app/(tabs)/index.tsx index 7960bc4..d8fd3af 100644 --- a/client/app/(tabs)/index.tsx +++ b/client/app/(tabs)/index.tsx @@ -1,58 +1,3 @@ -import { StyleSheet } from 'react-native' -import "maplibre-gl/dist/maplibre-gl.css" -import { useBackgroundPermissions } from 'expo-location' -import Map from '@/components/Map' -import { FAB, Surface, Text } from 'react-native-paper' -import { useGame } from '@/hooks/useGame' -import { FontAwesome6 } from '@expo/vector-icons' +import MapScreen from './map' -export default function MapScreen() { - const [backgroundStatus, requestBackgroundPermission] = useBackgroundPermissions() - if (!backgroundStatus?.granted && backgroundStatus?.canAskAgain) - requestBackgroundPermission() - - const game = useGame() - - return ( - - {backgroundStatus?.granted ? : La géolocalisation est requise pour utiliser la carte.} - 0} - icon={(props) => } - color='black' - label={`${game.money}`} /> - 0} - size='small' - color='black' - icon={game.currentRunner ? 'run-fast' : () => } - label={game.currentRunner ? "Coureuse" : "Poursuiveuse"} /> - - ) -} - -const styles = StyleSheet.create({ - page: { - flex: 1, - justifyContent: 'center', - alignItems: 'center' - }, - map: { - flex: 1, - alignSelf: 'stretch', - }, - moneyBadge: { - position: 'absolute', - top: 40, - right: 20, - backgroundColor: 'orange', - }, - statusBadge: { - position: 'absolute', - top: 40, - left: 20, - backgroundColor: 'pink', - }, -}) +export default MapScreen diff --git a/client/app/(tabs)/map.tsx b/client/app/(tabs)/map.tsx new file mode 100644 index 0000000..7960bc4 --- /dev/null +++ b/client/app/(tabs)/map.tsx @@ -0,0 +1,58 @@ +import { StyleSheet } from 'react-native' +import "maplibre-gl/dist/maplibre-gl.css" +import { useBackgroundPermissions } from 'expo-location' +import Map from '@/components/Map' +import { FAB, Surface, Text } from 'react-native-paper' +import { useGame } from '@/hooks/useGame' +import { FontAwesome6 } from '@expo/vector-icons' + +export default function MapScreen() { + const [backgroundStatus, requestBackgroundPermission] = useBackgroundPermissions() + if (!backgroundStatus?.granted && backgroundStatus?.canAskAgain) + requestBackgroundPermission() + + const game = useGame() + + return ( + + {backgroundStatus?.granted ? : La géolocalisation est requise pour utiliser la carte.} + 0} + icon={(props) => } + color='black' + label={`${game.money}`} /> + 0} + size='small' + color='black' + icon={game.currentRunner ? 'run-fast' : () => } + label={game.currentRunner ? "Coureuse" : "Poursuiveuse"} /> + + ) +} + +const styles = StyleSheet.create({ + page: { + flex: 1, + justifyContent: 'center', + alignItems: 'center' + }, + map: { + flex: 1, + alignSelf: 'stretch', + }, + moneyBadge: { + position: 'absolute', + top: 40, + right: 20, + backgroundColor: 'orange', + }, + statusBadge: { + position: 'absolute', + top: 40, + left: 20, + backgroundColor: 'pink', + }, +})