Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/app/scout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import AsyncStorage from '@react-native-async-storage/async-storage';
import { useLocalSearchParams } from 'expo-router';
import { useEffect, useMemo, useState } from 'react';
import { useEffect, useMemo, useRef, useState } from 'react';
import {
Pressable,
ScrollView,
Expand Down Expand Up @@ -287,6 +287,7 @@ export default function ScoutScreen() {
const [hasLoadedRecentPicks, setHasLoadedRecentPicks] = useState(false);
const [appliedRouteGameId, setAppliedRouteGameId] = useState<string | null>(null);
const [appliedRouteVenueId, setAppliedRouteVenueId] = useState<string | null>(null);
const gameSearchInputRef = useRef<TextInput>(null);

const filteredVenues = useMemo(() => {
const normalizedQuery = venueQuery.trim().toLowerCase();
Expand Down Expand Up @@ -728,11 +729,20 @@ export default function ScoutScreen() {
function resetReportDetails() {
setSelectedGame(null);
setGameQuery('');
setSelectedReportType('confirmed_present');
setQuantity('1');
setMachineLabel('');
setNotes('');
}

function prepareNextCabinetReport() {
resetReportDetails();

setTimeout(() => {
gameSearchInputRef.current?.focus();
}, 50);
}

function addQuickNote(note: string) {
setNotes((currentNotes) => {
const trimmedNotes = currentNotes.trim();
Expand Down Expand Up @@ -951,9 +961,9 @@ export default function ScoutScreen() {
...currentSubmissions,
].slice(0, 20));
setSubmitMessage(
`Submitted ${submittedGameTitle}. ${submittedVenueName} is still selected for the next cabinet.`,
`Added ${submittedGameTitle}. Pick the next game at ${submittedVenueName}.`,
);
resetReportDetails();
prepareNextCabinetReport();
await refreshMyPendingItems();

if (sessionRole === 'admin') {
Expand Down Expand Up @@ -1542,6 +1552,7 @@ export default function ScoutScreen() {

<Text style={styles.sectionTitle}>2. Pick a game</Text>
<TextInput
ref={gameSearchInputRef}
onChangeText={(value) => {
setGameQuery(value);
setSelectedGame(null);
Expand Down
Loading