Skip to content
Closed
Show file tree
Hide file tree
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
26 changes: 20 additions & 6 deletions app/game/post-match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { CommonActions } from "@react-navigation/native";
import BodyMedium from "../../lib/components/text/BodyMedium";
import { useTrainingModeStore } from "../../lib/storage/userStores";
import React from "react";
import { Checkbox } from "../../lib/components/Checkbox";

export default function PostMatch() {
const reportState = useReportStateStore();
Expand Down Expand Up @@ -78,7 +79,6 @@ export default function PostMatch() {
]}
selected={reportState.robotRole}
/>

<PostMatchSelector
title="Driver Ability"
updateStore={reportState.setDriverAbility}
Expand All @@ -91,6 +91,25 @@ export default function PostMatch() {
selected={reportState.driverAbility}
direction={ButtonGroupDirection.Horizontal}
/>
<View style={{ marginVertical: 18 }}>
<Checkbox
label="Robot broke"
checked={reportState.robotBrokeDescription != null}
onChange={(checked) => {
reportState.setRobotBrokeDescription(checked ? "" : null);
}}
/>
{reportState.robotBrokeDescription != null && (
<View style={{ gap: 7, marginTop: 7 }}>
<TextField
onChangeText={reportState.setRobotBrokeDescription}
multiline={true}
returnKeyType="done"
placeholder="How did it break?"
/>
</View>
)}
</View>

<PostMatchSelector
title="Endgame Barge Result"
Expand All @@ -103,7 +122,6 @@ export default function PostMatch() {
)}
selected={reportState.bargeResult}
/>

<PostMatchSelector
title="Coral Pick Up"
updateStore={reportState.setCoralPickUp}
Expand All @@ -115,7 +133,6 @@ export default function PostMatch() {
)}
selected={reportState.coralPickUp}
/>

<PostMatchSelector
title="Algae Pick Up"
updateStore={reportState.setAlgaePickUp}
Expand All @@ -127,7 +144,6 @@ export default function PostMatch() {
)}
selected={reportState.algaePickUp}
/>

<PostMatchSelector
title="Clears Algae from Reef"
updateStore={(value) => reportState.setKnocksAlgae(value)}
Expand All @@ -149,7 +165,6 @@ export default function PostMatch() {
direction={ButtonGroupDirection.Horizontal}
selected={reportState.traversesUnderCage}
/>

<View style={{ gap: 7, marginBottom: 18 }}>
<LabelSmall>Notes</LabelSmall>
<TextField
Expand All @@ -168,7 +183,6 @@ export default function PostMatch() {
</BodyMedium>
</View>
</View>

<View style={{ gap: 10 }}>
<Button
disabled={trainingModeEnabled}
Expand Down
2 changes: 2 additions & 0 deletions lib/collection/ReportState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export type ReportState = {
gamePhase: GamePhase;
robotRole: RobotRole;
driverAbility: DriverAbility;
robotBrokeDescription: string | null;
bargeResult: BargeResult;
coralPickUp: CoralPickUp;
algaePickUp: AlgaePickUp;
Expand All @@ -52,6 +53,7 @@ export type ReportState = {
setGamePhase: (value: GamePhase) => void;
setRobotRole: (value: RobotRole) => void;
setDriverAbility: (value: DriverAbility) => void;
setRobotBrokeDescription: (value: string | null) => void;
setBargeResult: (value: BargeResult) => void;
setCoralPickUp: (value: CoralPickUp) => void;
setAlgaePickUp: (value: AlgaePickUp) => void;
Expand Down
6 changes: 6 additions & 0 deletions lib/collection/reportStateStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const useReportStateStore = create<ReportState>((set, get) => ({
gamePhase: GamePhase.Auto,
robotRole: RobotRole.Offense,
driverAbility: DriverAbility.Average,
robotBrokeDescription: null,
bargeResult: BargeResult.NotAttempted,
coralPickUp: CoralPickUp.None,
algaePickUp: AlgaePickUp.None,
Expand All @@ -77,6 +78,7 @@ export const useReportStateStore = create<ReportState>((set, get) => ({
gamePhase: GamePhase.Auto,
robotRole: RobotRole.Offense,
driverAbility: DriverAbility.Average,
robotBrokeDescription: null,
bargeResult: BargeResult.NotAttempted,
coralPickUp: CoralPickUp.None,
algaePickUp: AlgaePickUp.None,
Expand All @@ -92,6 +94,7 @@ export const useReportStateStore = create<ReportState>((set, get) => ({
gamePhase: GamePhase.Auto,
robotRole: RobotRole.Offense,
driverAbility: DriverAbility.Average,
robotBrokeDescription: null,
bargeResult: BargeResult.NotAttempted,
coralPickUp: CoralPickUp.None,
algaePickUp: AlgaePickUp.None,
Expand All @@ -108,6 +111,7 @@ export const useReportStateStore = create<ReportState>((set, get) => ({
setGamePhase: (value) => set({ gamePhase: value }),
setRobotRole: (value) => set({ robotRole: value }),
setDriverAbility: (value) => set({ driverAbility: value }),
setRobotBrokeDescription: (value) => set({ robotBrokeDescription: value }),
setBargeResult: (value) => set({ bargeResult: value }),
setCoralPickUp: (value) => set({ coralPickUp: value }),
setAlgaePickUp: (value) => set({ algaePickUp: value }),
Expand Down Expand Up @@ -231,6 +235,7 @@ export const useReportStateStore = create<ReportState>((set, get) => ({
startTime: reportState.startTimestamp?.getTime() ?? 0,
notes: reportState.notes,
robotRole: reportState.robotRole,
robotBrokeDescription: reportState.robotBrokeDescription,
barge: bargeResultDescriptions[reportState.bargeResult].num,
coralPickUp: coralPickUpDescriptions[reportState.coralPickUp].num,
algaePickUp: algaePickUpDescriptions[reportState.algaePickUp].num,
Expand Down Expand Up @@ -290,6 +295,7 @@ export const useReportStateStore = create<ReportState>((set, get) => ({
gamePhase: GamePhase.Auto,
robotRole: RobotRole.Offense,
driverAbility: DriverAbility.Average,
robotBrokeDescription: null,
bargeResult: BargeResult.NotAttempted,
coralPickUp: CoralPickUp.None,
algaePickUp: AlgaePickUp.None,
Expand Down
2 changes: 1 addition & 1 deletion lib/components/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const TextField: ForwardRefRenderFunction<TextInput, TextInputProps> = (
: "#252525",
borderRadius: 7,
paddingVertical: density === "comfortable" ? 10 : 6,
textAlignVertical: "center",
paddingHorizontal: density === "comfortable" ? 14 : 10,
borderWidth: 2,
borderColor: error
Expand All @@ -64,7 +65,6 @@ const TextField: ForwardRefRenderFunction<TextInput, TextInputProps> = (
? colors.gray.hover
: colors.gray.default
: "#2F2F2F",
minHeight: density === "comfortable" ? 44 : 33,
}}
placeholder={placeholder}
placeholderTextColor={editable ? "#626262" : "#3D3D3D"}
Expand Down