From 8008a9b6fe304d89d61448b69b2e39ca9350f89d Mon Sep 17 00:00:00 2001 From: mudabbir-ahmad Date: Mon, 6 Apr 2026 23:59:52 +0100 Subject: [PATCH] Add GameSettings and Players screens; implement cache management features in MapScreen --- App.js | 10 +- app.json | 20 +- src/components/API/API.js | 4 +- src/components/UI/Card.js | 26 ++ .../gameplay/AdminCacheEditorView.js | 7 +- src/components/gameplay/CacheCardItem.js | 86 +++++ src/components/gameplay/PlayerMapView.js | 7 +- src/components/layout/BottomNavbar.js | 35 +- src/components/layout/Screen.js | 5 +- src/components/screens/AdminHubScreen.js | 2 +- src/components/screens/CreateGameScreen.js | 2 +- src/components/screens/GameLobbyScreen.js | 2 +- src/components/screens/GameSettingsScreen.js | 174 ++++++++++ src/components/screens/GameTypeScreen.js | 2 +- .../screens/JoinPrivateGameScreen.js | 2 +- src/components/screens/ManageGameScreen.js | 10 +- .../screens/ManagePrivateGameScreen.js | 2 +- .../screens/ManageSubgroupsScreen.js | 2 +- src/components/screens/MapScreen.js | 328 +++++++++++++++--- src/components/screens/PlayersScreen.js | 244 +++++++++++++ src/components/screens/TeamScreen.js | 26 +- src/hooks/useGameHook.js | 31 ++ 22 files changed, 926 insertions(+), 101 deletions(-) create mode 100644 src/components/UI/Card.js create mode 100644 src/components/gameplay/CacheCardItem.js create mode 100644 src/components/screens/GameSettingsScreen.js create mode 100644 src/components/screens/PlayersScreen.js diff --git a/App.js b/App.js index 22bab44..15a3bbc 100644 --- a/App.js +++ b/App.js @@ -14,6 +14,8 @@ import MapScreen from "./src/components/screens/MapScreen"; import LeaderboardScreen from "./src/components/screens/LeaderboardScreen"; import AdminHubScreen from "./src/components/screens/AdminHubScreen"; import ManageSubgroupsScreen from "./src/components/screens/ManageSubgroupsScreen"; +import GameSettingsScreen from "./src/components/screens/GameSettingsScreen"; +import PlayersScreen from "./src/components/screens/PlayersScreen"; const RootStack = createNativeStackNavigator(); const AuthStackNav = createNativeStackNavigator(); @@ -43,6 +45,8 @@ const GameStack = () => ( + + @@ -59,10 +63,12 @@ const AdminStack = () => ( contentStyle: { backgroundColor: '#ffffff' }, }} > + + + + - - diff --git a/app.json b/app.json index 4a8162a..fa76814 100644 --- a/app.json +++ b/app.json @@ -2,7 +2,7 @@ "expo": { "name": "MAD_Treasure_Hunt_App", "slug": "MAD_Treasure_Hunt_App", - "version": "1.0.0", + "version": "1.0.0", "orientation": "portrait", "icon": "./assets/images/icon.png", "userInterfaceStyle": "light", @@ -13,14 +13,28 @@ "backgroundColor": "#ffffff" }, "ios": { - "supportsTablet": true + "supportsTablet": true, + "infoPlist": { + "NSLocationWhenInUseUsageDescription": "This app needs your location for the treasure hunt." + } }, "android": { "adaptiveIcon": { "foregroundImage": "./assets/images/android-icon-monochrome.png", "backgroundColor": "#ffffff" }, - "edgeToEdgeEnabled": false + "config": { + "googleMaps": { + "apiKey": "AIzaSyA-G0tSzzcM5z6HyI23s8dzKDLCOrekhbw" + } + }, + "permissions": [ + "ACCESS_FINE_LOCATION", + "ACCESS_COARSE_LOCATION", + "ACCESS_FINE_LOCATION", + "ACCESS_COARSE_LOCATION" + ], + "package": "com.bobthebob.MAD_Treasure_Hunt_App" }, "web": { "favicon": "./assets/favicon.png" diff --git a/src/components/API/API.js b/src/components/API/API.js index 7b10cc3..fa6cf6e 100644 --- a/src/components/API/API.js +++ b/src/components/API/API.js @@ -1,5 +1,5 @@ -export const API_BASE_URL = 'http://api.bobby.ip-ddns.com'; //For outside Home network -//export const API_BASE_URL = 'http://192.168.8.100:3000'; //For when im home (API Endpoint is on my home server...) +//export const API_BASE_URL = 'http://api.bobby.ip-ddns.com'; //For outside Home network +export const API_BASE_URL = 'http://192.168.8.100:3000'; //For when im home (API Endpoint is on my home server...) const API = {}; API.get = (endpoint) => callFetch(endpoint, 'GET'); diff --git a/src/components/UI/Card.js b/src/components/UI/Card.js new file mode 100644 index 0000000..22d6d3f --- /dev/null +++ b/src/components/UI/Card.js @@ -0,0 +1,26 @@ +import {StyleSheet, View} from 'react-native'; + +const Card = ({children, style}) => { +// Initialisation ------------- +// State ---------------------- +// Handlers ------------------- +// View ----------------------- + + return ( + {children} + ); +}; + +const styles = StyleSheet.create({ + card: { + backgroundColor: '#ffffff', + borderRadius: 8, + padding: 12, + marginBottom: 8, + borderWidth: 1, + borderColor: '#e5e7eb', + }, +}); + +export default Card; + diff --git a/src/components/gameplay/AdminCacheEditorView.js b/src/components/gameplay/AdminCacheEditorView.js index 1880224..944106d 100644 --- a/src/components/gameplay/AdminCacheEditorView.js +++ b/src/components/gameplay/AdminCacheEditorView.js @@ -19,12 +19,9 @@ const AdminCacheEditorView = ({ userLocation, caches, onAddCache, onMoveCache }) latitudeDelta: 0.01, longitudeDelta: 0.01, }} - region={{ - ...userLocation, - latitudeDelta: 0.01, - longitudeDelta: 0.01, - }} onLongPress={(event) => onAddCache(event.nativeEvent.coordinate)} + scrollEnabled={true} + zoomEnabled={true} showsUserLocation > {(caches || []).map((cache) => ( diff --git a/src/components/gameplay/CacheCardItem.js b/src/components/gameplay/CacheCardItem.js new file mode 100644 index 0000000..7838843 --- /dev/null +++ b/src/components/gameplay/CacheCardItem.js @@ -0,0 +1,86 @@ +import {StyleSheet, Text, View} from 'react-native'; +import Card from '../UI/Card'; +import {Button} from '../UI/Button'; + +const CacheCardItem = ({cache, isAdmin, onEdit, onDelete, onSelect}) => { +// Initialisation ------------- + + const isClaimed = Boolean(cache.ClaimedByUid); + const statusText = isClaimed ? 'Claimed' : 'Available'; + const statusColor = isClaimed ? '#9ca3af' : '#16a34a'; + +// State ---------------------- +// Handlers ------------------- +// View ----------------------- + + return ( + + + {cache.clue} + {statusText} + + + {isAdmin ? ( + <> +