diff --git a/src/components/UI/CodeJoinRow.js b/src/components/UI/CodeJoinRow.js index 1f94daf..d2772c5 100644 --- a/src/components/UI/CodeJoinRow.js +++ b/src/components/UI/CodeJoinRow.js @@ -1,11 +1,11 @@ -import {StyleSheet, TextInput, View} from 'react-native'; -import {Button} from './Button'; +import { StyleSheet, TextInput, View } from "react-native"; +import { Button } from "./Button"; const CodeJoinRow = ({ value, onChange, placeholder, - buttonLabel = 'Join', + buttonLabel = "Join", onSubmit, disabled = false, style, @@ -39,37 +39,36 @@ const CodeJoinRow = ({ const styles = StyleSheet.create({ inputRow: { - flexDirection: 'row', + flexDirection: "row", gap: 10, marginBottom: 15, - width: '100%', + width: "100%", paddingHorizontal: 20, }, codeInput: { flex: 1, borderWidth: 1, - borderColor: '#45475a', + borderColor: "#45475a", borderRadius: 8, paddingHorizontal: 12, paddingVertical: 10, fontSize: 16, - color: '#cdd6f4', - backgroundColor: '#313244', + color: "#cdd6f4", + backgroundColor: "#313244", }, inputDisabled: { opacity: 0.5, }, joinButton: { - backgroundColor: '#bd93f9', - borderColor: '#bd93f9', + backgroundColor: "#bd93f9", + borderColor: "#bd93f9", flex: 0, paddingHorizontal: 20, }, joinLabel: { - color: '#1e1e2e', - fontWeight: '600', + color: "#1e1e2e", + fontWeight: "600", }, }); export default CodeJoinRow; - diff --git a/src/components/gameplay/ClaimTimerView.js b/src/components/gameplay/ClaimTimerView.js index 1c52826..b9d2c59 100644 --- a/src/components/gameplay/ClaimTimerView.js +++ b/src/components/gameplay/ClaimTimerView.js @@ -1,6 +1,6 @@ -import React, {useEffect, useRef, useState} from 'react'; -import {StyleSheet, Text, View} from 'react-native'; -import {CACHE_CLAIM_TIMER} from '../../utils/geoMath'; +import { useEffect, useRef, useState } from "react"; +import { StyleSheet, Text, View } from "react-native"; +import { CACHE_CLAIM_TIMER } from "../../utils/geoMath"; const ClaimTimerView = ({ cache, @@ -8,7 +8,7 @@ const ClaimTimerView = ({ isClaiming, showClaimedPopup, claimDurationSeconds = CACHE_CLAIM_TIMER, - claimedPopupMessage = 'Cache Claimed!', + claimedPopupMessage = "Cache Claimed!", autoClaim = true, }) => { const [timeLeft, setTimeLeft] = useState(claimDurationSeconds); @@ -75,30 +75,30 @@ const ClaimTimerView = ({ const styles = StyleSheet.create({ overlay: { - alignSelf: 'center', - backgroundColor: 'rgba(0, 0, 0, 0.75)', + alignSelf: "center", + backgroundColor: "rgba(0, 0, 0, 0.75)", paddingHorizontal: 16, paddingVertical: 12, borderRadius: 10, marginTop: 8, }, text: { - color: '#cdd6f4', + color: "#cdd6f4", fontSize: 16, - fontWeight: '700', + fontWeight: "700", }, claimedOverlay: { - alignSelf: 'center', - backgroundColor: '#a6e3a1', + alignSelf: "center", + backgroundColor: "#a6e3a1", paddingHorizontal: 20, paddingVertical: 14, borderRadius: 10, marginTop: 8, }, claimedText: { - color: '#1e1e2e', + color: "#1e1e2e", fontSize: 18, - fontWeight: '700', + fontWeight: "700", }, }); diff --git a/src/components/gameplay/PlayerMapView.js b/src/components/gameplay/PlayerMapView.js index 5ff1f4b..6cff766 100644 --- a/src/components/gameplay/PlayerMapView.js +++ b/src/components/gameplay/PlayerMapView.js @@ -1,45 +1,47 @@ -import React from 'react'; -import MapView, {Marker, Polygon} from 'react-native-maps'; -import {getFovCone} from '../../utils/geoMath'; +import MapView, { Marker, Polygon } from "react-native-maps"; +import { getFovCone } from "../../utils/geoMath"; -const PlayerMapView = ({userLocation, visibleCaches, heading}) => { - if (!userLocation) return null; +const PlayerMapView = ({ userLocation, visibleCaches, heading }) => { + if (!userLocation) return null; - const coneCoords = (heading !== null && heading !== undefined) - ? getFovCone(userLocation, heading) - : null; + const coneCoords = + heading !== null && heading !== undefined + ? getFovCone(userLocation, heading) + : null; - return ( - - {(visibleCaches || []).map((cache) => ( - - ))} - {coneCoords && ( - - )} - - ); + return ( + + {(visibleCaches || []).map((cache) => ( + + ))} + {coneCoords && ( + + )} + + ); }; export default PlayerMapView; - - diff --git a/src/components/screens/DepartmentSettingsScreen.js b/src/components/screens/DepartmentSettingsScreen.js index 1d6824a..8b43102 100644 --- a/src/components/screens/DepartmentSettingsScreen.js +++ b/src/components/screens/DepartmentSettingsScreen.js @@ -1,29 +1,38 @@ -import React, {useEffect, useState} from 'react'; -import {ActivityIndicator, Alert, ScrollView, StyleSheet, Switch, Text, TextInput, View} from 'react-native'; -import Screen from '../layout/Screen'; -import {Button, ButtonTray} from '../UI/Button'; -import useGameHook from '../../hooks/useGameHook'; +import { useEffect, useState } from "react"; +import { + ActivityIndicator, + Alert, + ScrollView, + StyleSheet, + Switch, + Text, + TextInput, + View, +} from "react-native"; +import Screen from "../layout/Screen"; +import { Button, ButtonTray } from "../UI/Button"; +import useGameHook from "../../hooks/useGameHook"; -const DepartmentSettingsScreen = ({route, navigation}) => { - const {SGid, Gid} = route.params; - const {getSubgroup, updateSubgroup, getCaches, resetGame} = useGameHook(); +const DepartmentSettingsScreen = ({ route, navigation }) => { + const { SGid, Gid } = route.params; + const { getSubgroup, updateSubgroup, getCaches, resetGame } = useGameHook(); const [loading, setLoading] = useState(true); const [saving, setSaving] = useState(false); - const [deptName, setDeptName] = useState(''); - const [joinCode, setJoinCode] = useState(''); + const [deptName, setDeptName] = useState(""); + const [joinCode, setJoinCode] = useState(""); const [teamsEnabled, setTeamsEnabled] = useState(false); - const [cacheTriggerMeters, setCacheTriggerMeters] = useState('20'); + const [cacheTriggerMeters, setCacheTriggerMeters] = useState("20"); const [cacheCount, setCacheCount] = useState(0); -// Handlers ------------------- + // Handlers ------------------- useEffect(() => { const load = async () => { const sg = await getSubgroup(SGid); if (sg) { - setDeptName(sg.SubGroupName || ''); - setJoinCode(sg.JoinCode || ''); + setDeptName(sg.SubGroupName || ""); + setJoinCode(sg.JoinCode || ""); setTeamsEnabled(Boolean(sg.TeamsEnabled)); setCacheTriggerMeters(String(sg.CacheTriggerMeters || 20)); } @@ -35,190 +44,208 @@ const DepartmentSettingsScreen = ({route, navigation}) => { load(); }, []); - const handleSave = async () => { - setSaving(true); - await updateSubgroup(SGid, { - SubGroupName: deptName.trim(), - TeamsEnabled: teamsEnabled, - CacheTriggerMeters: parseInt(cacheTriggerMeters) || 20, - }); - setSaving(false); - Alert.alert('Saved', 'Department settings updated.'); - }; + const handleSave = async () => { + setSaving(true); + await updateSubgroup(SGid, { + SubGroupName: deptName.trim(), + TeamsEnabled: teamsEnabled, + CacheTriggerMeters: parseInt(cacheTriggerMeters) || 20, + }); + setSaving(false); + Alert.alert("Saved", "Department settings updated."); + }; - const handleResetDepartment = () => { - Alert.alert( - 'Reset Department', - 'This will reset all cache claims for this department. Are you sure?', - [ - {text: 'Cancel', style: 'cancel'}, - { - text: 'Reset', - style: 'destructive', - onPress: async () => { - await resetGame(Gid, SGid); - Alert.alert('Done', 'Department progress has been reset.'); - }, - }, - ], - ); - }; - - const handleManageCaches = () => { - navigation.navigate('MapScreen', { - selectedDepartmentSGid: SGid, - selectedDepartmentName: deptName || null, - }); - }; - -// View ----------------------- - - if (loading) { - return ( - - - - ); - } - - return ( - - - Department Settings - - Department Name - - - - Department Join Code - {joinCode || '—'} - - - - Teams Enabled - - - - Cache Claim Distance (metres) - - - - Total Caches - {cacheCount} - - - - -