Skip to content

Commit

Permalink
Change rerun buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonsf committed Jul 2, 2024
1 parent 04572f0 commit 448de97
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@ const Centered = styled.div`
display: flex;
align-content: center;
align-items: center;
justify-content: center;
`

interface MissionProps {
mission: Mission
hasFailedTasks: boolean
smallButton: boolean
}

enum ReRunOptions {
ReRun,
ReRunFailed,
}

export const MissionRestartButton = ({ mission, hasFailedTasks }: MissionProps) => {
export const MissionRestartButton = ({ mission, hasFailedTasks, smallButton }: MissionProps) => {
const { TranslateText } = useLanguageContext()
const { setAlert } = useAlertContext()
const [isOpen, setIsOpen] = useState<boolean>(false)
Expand Down Expand Up @@ -58,7 +60,7 @@ export const MissionRestartButton = ({ mission, hasFailedTasks }: MissionProps)
return (
<Centered>
<Button
variant="outlined"
variant={smallButton ? 'ghost_icon' : 'outlined'}
ref={anchorRef}
id="anchor-default"
aria-haspopup="true"
Expand All @@ -69,8 +71,8 @@ export const MissionRestartButton = ({ mission, hasFailedTasks }: MissionProps)
!hasFailedTasks && setIsLocationVerificationOpen(true)
}}
>
<Icon name={Icons.Replay} size={24} />
{TranslateText('Rerun mission')}
<Icon name={smallButton ? Icons.AddOutlined : Icons.Add} size={24} />
{!smallButton && TranslateText('Queue mission')}
</Button>
<EdsProvider density="compact">
<Menu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const HistoricMissionCard = ({ index, mission }: IndexedMissionProps) =>
</Table.Cell>
<Table.Cell id={InspectionTableColumns.Rerun}>
{mission.tasks[0]?.type !== TaskType.ReturnHome && mission.tasks[0]?.type !== TaskType.Localization && (
<MissionRestartButton mission={mission} hasFailedTasks={missionHasFailedTasks} />
<MissionRestartButton mission={mission} hasFailedTasks={missionHasFailedTasks} smallButton={true} />
)}
</Table.Cell>
</Table.Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export const MissionHistoryView = ({ refreshInterval }: RefreshProps) => {
{TranslateText('Completion Time')}
</Table.Cell>
<Table.Cell id={InspectionTableColumns.Rerun}>
{TranslateText('Rerun mission')}
{TranslateText('Add to queue')}
</Table.Cell>
</Table.Row>
</Table.Head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ export const MissionHeader = ({ mission }: { mission: Mission }) => {
{mission.endTime &&
mission.tasks[0]?.type !== TaskType.ReturnHome &&
mission.tasks[0]?.type !== TaskType.Localization && (
<MissionRestartButton mission={mission} hasFailedTasks={missionHasFailedTasks} />
<MissionRestartButton
mission={mission}
hasFailedTasks={missionHasFailedTasks}
smallButton={false}
/>
)}
</TitleSection>
<Typography
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@
"maxStartTime": "Max start time",
"minEndTime": "Min end time",
"maxEndTime": "Max end time",
"Re-run the mission": "Re-run the mission",
"Re-run full mission": "Re-run full mission",
"Re-run failed and cancelled tasks in the mission": "Re-run failed and cancelled tasks in the mission",
"Rerun the mission": "Rerun the mission",
"Rerun full mission": "Rerun full mission",
"Rerun failed and cancelled tasks in the mission": "Rerun failed and cancelled tasks in the mission",
"inspectionTypes": "Inspection types",
"missionName": "Mission name",
"None": "None",
Expand Down Expand Up @@ -239,5 +239,6 @@
"LowLow": "LowLow",
"Recommended pressure": "Recommended pressure is 67 mBar.",
"Pressure": "Pressure",
"Pressure limit": "Pressure limits [mBar]"
"Pressure limit": "Pressure limits [mBar]",
"Add to queue": "Add to queue"
}
11 changes: 6 additions & 5 deletions frontend/src/language/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@
"maxStartTime": "Maks starttid",
"minEndTime": "Min sluttid",
"maxEndTime": "Maks sluttid",
"Re-run the mission": "Kjør oppdraget på nytt",
"Re-run full mission": "Kjør hele oppdraget på nytt",
"Re-run failed and cancelled tasks in the mission": "Kjør feilet og kansellerte oppgaver i oppdraget på nytt",
"Rerun the mission": "Kjør oppdraget på nytt",
"Rerun full mission": "Kjør hele oppdraget på nytt",
"Rerun failed and cancelled tasks in the mission": "Kjør feilet og kansellerte oppgaver i oppdraget på nytt",
"inspectionTypes": "Inspeksjonstyper",
"missionName": "Oppdragsnavn",
"None": "Ingen",
Expand All @@ -130,7 +130,7 @@
"Up to date": "Oppdatert",
"Due within two weeks": "Frist innen to uker",
"No deck inspections available": "Ingen tilgjengelige dekkinspeksjoner",
"Queue mission": "Legg til oppdrag i køen",
"Queue mission": "Legg oppdraget i kø",
"Inspection Missions": "Inspeksjonsoppdrag",
"for": "for",
"Edit": "Rediger",
Expand Down Expand Up @@ -239,5 +239,6 @@
"LowLow": "LavLav",
"Recommended pressure": "Anbefalt trykk er 67 mBar.",
"Pressure": "Trykk",
"Pressure limit": "Trykkgrenser [mBar]"
"Pressure limit": "Trykkgrenser [mBar]",
"Add to queue": "Legg til i kø"
}

0 comments on commit 448de97

Please sign in to comment.