Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix release button #166

Merged
merged 3 commits into from
Sep 26, 2024
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
20 changes: 14 additions & 6 deletions front-end/src/seasons/fgc-2024/nexus-sheets/nexus-scoresheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ const NexusScoresheet: React.FC<NexusScoresheetProps> = ({
alliance: Alliance,
goal: keyof AllianceNexusGoalState
) => {
console.log(allowForceRelease);
if (!allowForceRelease) return;
// create packet to send to FCS
const packetOn: FieldControlUpdatePacket = { hubs: {}, wleds: {} };
Expand Down Expand Up @@ -145,10 +144,17 @@ const NexusScoresheet: React.FC<NexusScoresheetProps> = ({
// send on packet to FCS
sendFCSPacket(packetOn);

// filter out any previous requests for this goal
cancelQueue.current = cancelQueue.current.filter(
(c) => !(c.alliance === alliance && c.goal === goal)
);

// add packetoff socket request to cancel queue
cancelQueue.current.push({
time: Date.now() + 3000,
callback: () => sendFCSPacket(packetOff)
callback: () => sendFCSPacket(packetOff),
alliance,
goal
});
};

Expand Down Expand Up @@ -506,18 +512,20 @@ const GoalToggle: React.FC<GoalToggleProps> = ({
{NexusGoalState.Produced === state &&
allowForceRelease &&
matchState < MatchState.MATCH_COMPLETE && (
<Box sx={{ position: 'relative', top: '45%', height: 0, px: 1 }}>
<Box sx={{ position: 'relative', top: '35%', height: 0, px: 1 }}>
<Button
variant='contained'
fullWidth
sx={{
backgroundColor: 'orange',
':hover': { backgroundColor: 'darkred' },
zIndex: 40
zIndex: 40,
minWidth: 0
}}
onClick={onForceReleaseLocal}
onTouchStart={onForceReleaseLocal}
>
Force Release
&nbsp;
</Button>
</Box>
)}
Expand All @@ -527,7 +535,7 @@ const GoalToggle: React.FC<GoalToggleProps> = ({
width: '100%',
border:
matchState === MatchState.MATCH_IN_PROGRESS &&
state === NexusGoalState.Produced
state === NexusGoalState.Produced
? '5px dashed orange'
: undefined
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const TeleScoreSheet: FC<Props> = ({
textAlign='center'
sx={{ textTransform: 'capitalize' }}
>
{alliance} Resevoir Scored
{alliance === 'red' ? 'Blue' : 'Red'} Resevoir Scored
</Typography>
<NumberInput
value={
Expand Down
Loading