Skip to content
Merged
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
93 changes: 93 additions & 0 deletions app/common/track/seq/PMVALoadShootSeqPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import type {TrackScreenProps} from "~/routes/track/track-home-page.tsx";
import TrackNav from "~/common/track/TrackNav.tsx";
import {useState} from "react";

const PMVALoadShootSeqPage = ({}: TrackScreenProps) => {
const [hopperFilled, setHopperFilled] = useState<boolean | undefined>(undefined);
const [loadNotes, setLoadNotes] = useState<string | undefined>(undefined);
const [scoreCount, setScoreCount] = useState<number>(0);
const [missCount, setMissCount] = useState<number>(0);
const [unloadSeconds, setUnloadSeconds] = useState<number>(-1);
const [stuckFuelCount, setStuckFuelCount] = useState<number>(-1);
const [unloadComments, setUnloadComments] = useState<string | undefined>(undefined);

enum ShootPosition { close, mid, far };
const [shootPosition, setShootPosition] = useState<ShootPosition | undefined>(undefined);
const [movingWhileShooting, setMovingWhileShooting] = useState<boolean | undefined>(undefined);
const [shootingWhileIntaking, setShootingWhileIntaking] = useState<boolean | undefined>(undefined);

const isIncomplete: () => boolean = () => {
if (hopperFilled === undefined) return true;
if (unloadSeconds === -1) return true;
if (stuckFuelCount === -1) return true;
if (shootPosition === undefined) return true;
if (movingWhileShooting === undefined) return true;
if (shootingWhileIntaking === undefined) return true;
return false
}

const handleSubmit = (e: React.MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
// hopper filled --> stores pmva-hopper-full / pmva-hopper-not-full
// loadNotes --> stores pmva-load-comments
// pmva-unload-comments
}
return <main className="track pmva">
<div>
<TrackNav/>
<h2>Post-Match Video Analysis - Pickup, Score & Shoot Sequence</h2>
<p>Was the hopper filled?
<button onClick={() => setHopperFilled(true)}
disabled={hopperFilled}>Yes</button>
<button onClick={() => setHopperFilled(false)}
disabled={!(hopperFilled === undefined) && !hopperFilled}>No
</button>
</p>
<p>
Anything noteworthy about this load?
<textarea onChange={(e) => setLoadNotes(e.target.value)}></textarea>
</p>
<p>Click on the buttons below to add to the count for this sequence. Play the video back slowly and get an
accurate count for the sequence. The count is shown so that you can verify the amout if you're not sure
what you saw.</p>
<button onClick={() => setScoreCount(scoreCount + 1)}>Score One</button>
({scoreCount})
<button onClick={() => setMissCount(missCount + 1)}>Miss One</button> ({missCount})
({Math.round(100 * scoreCount / Math.max(1, scoreCount + missCount))}%)
<p>How long did it take to unload (rewind the video and play the sequence back. Use
either the video time or a stopwatch)
<input type="number" min={0} max={155}
onClick={(e) => setUnloadSeconds(Number((e.target as HTMLInputElement).value))}/> seconds.
</p>
<p>How much fuel was stuck after the end of the sequence?
<input type="number" min={0} max={50}
onClick={(e) => setStuckFuelCount(Number((e.target as HTMLInputElement).value))}/> pieces.
</p>
<p>Anything noteworthy about this shooting session?
<textarea onChange={(e) => setUnloadComments(e.target.value)}></textarea>
</p>
<p>Where was the robot while shooting? (select one)
<button disabled={shootPosition === ShootPosition.close}
onClick={() => setShootPosition(ShootPosition.close)}>Close</button>
<button disabled={shootPosition === ShootPosition.mid}
onClick={() => setShootPosition(ShootPosition.mid)}>Mid
</button>
<button disabled={shootPosition === ShootPosition.far}
onClick={() => setShootPosition(ShootPosition.far)}>Far
</button>
</p>
<p>Was the robot moving while shooting?
<button disabled={movingWhileShooting} onClick={() => setMovingWhileShooting(true)}>Moving</button>
<button disabled={!(movingWhileShooting === undefined) && !movingWhileShooting} onClick={() => setMovingWhileShooting(false)}>Still</button>
</p>
<p>Was the robot shooting while intaking during this sequence?
<button disabled={shootingWhileIntaking} onClick={() => setShootingWhileIntaking(true)}>Yes</button>
<button disabled={!(shootingWhileIntaking === undefined) && !shootingWhileIntaking} onClick={() => setShootingWhileIntaking(false)}>No</button>
</p>
<button disabled={isIncomplete()} onClick={e => handleSubmit(e)}>Save Sequence</button>
</div>
</main>

}

export default PMVALoadShootSeqPage;
2 changes: 1 addition & 1 deletion app/common/track/strat-area/AreaPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const AreaPage = ({ areaCode }: TrackScreenProps) => {

function startSequence(seq: SequenceType) {
console.log("Starting sequence "+seq.name);
const firstSeqEvent = seq.events[0];
const firstSeqEvent = seq.events && seq.events[0];
if (firstSeqEvent) {
const firstEvent = firstSeqEvent.eventtype;
recordEvent(firstEvent.eventtype, 0, "")
Expand Down
2 changes: 2 additions & 0 deletions app/common/track/trackPageRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import MatchForm from "~/common/track/MatchForm.tsx";
import CompTeams from "~/common/track/CompTeams.tsx";
import SequencePage from "~/common/track/seq/SequencePage.tsx";
import AreaPage from "~/common/track/strat-area/AreaPage.tsx";
import PMVALoadShootSeqPage from "~/common/track/seq/PMVALoadShootSeqPage.tsx";

/**
* Maps navigation strings to custom components. This is effectively
Expand Down Expand Up @@ -42,6 +43,7 @@ const trackPageRegistry: Record<string, ComponentType<TrackScreenProps>> = {

// sequence pages
"seq:default": SequencePage,
"seq:pmva-score": PMVALoadShootSeqPage,
// custom sequence pages
// "seq:auto": AutoPage,
// "seq:defense": DefensePage,
Expand Down
22 changes: 11 additions & 11 deletions app/routes/report/report-home-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,11 @@ const ReportHomePage = () => {
<section className="card">
<h2>Standard Reports</h2>
<ul className="nav-list">
<li>
<NavLink to="/report/schedule" className="btn-secondary">
Tournament Report
</NavLink>
<span className="nav-note">formerly Team Schedule</span>
</li>
<li>
<NavLink to="/report/summary" className="btn-secondary">
Team Summary Report
</NavLink>
</li>
<li>
<NavLink to="/report/pmva" className="btn-secondary">
Post-Match Video Analysis (PMVA) Report
</NavLink>
</li>
<li>
<NavLink to="/report/mega" className="btn-secondary">
Mega Report
Expand All @@ -52,6 +41,17 @@ const ReportHomePage = () => {
Chronological Event Report
</NavLink>
</li>
<li>
<NavLink to="/report/schedule" className="btn-secondary">
Tournament Report
</NavLink>
<span className="nav-note">formerly Team Schedule</span>
</li>
<li>
<NavLink to="/report/pmva" className="btn-secondary">
Post-Match Video Analysis (PMVA) Report
</NavLink>
</li>
</ul>
</section>

Expand Down
Loading