Skip to content

Commit

Permalink
Merge pull request #166 from the-orange-alliance/fix-release-button
Browse files Browse the repository at this point in the history
Fix release button
  • Loading branch information
kyle-flynn authored Sep 26, 2024
2 parents 0f32951 + 61a71c3 commit 138cc02
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
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

0 comments on commit 138cc02

Please sign in to comment.