Skip to content

Commit

Permalink
Simplify and rename create mission button
Browse files Browse the repository at this point in the history
  • Loading branch information
andchiind committed Jan 4, 2024
1 parent f91bc1f commit 77a29ba
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 78 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Button, Icon } from '@equinor/eds-core-react'
import { useLanguageContext } from 'components/Contexts/LanguageContext'
import { Icons } from 'utils/icons'
import { useRef } from 'react'
import { useInstallationContext } from 'components/Contexts/InstallationContext'
import styled from 'styled-components'

const StyledButton = styled(Button)`
display: flex;
align-items: center;
gap: 8px;
border-radius: 4px;
`

export const CreateEchoMissionButton = (): JSX.Element => {
const { TranslateText } = useLanguageContext()
const { installationCode } = useInstallationContext()
const anchorRef = useRef<HTMLButtonElement>(null)
const echoURL = 'https://echo.equinor.com/missionplanner?instCode='

return (
<StyledButton
variant="outlined"
onClick={() => {
window.open(echoURL + installationCode)
}}
disabled={installationCode === ''}
ref={anchorRef}
>
<Icon name={Icons.ExternalLink} size={16}></Icon>
{TranslateText('Create new Echo mission')}
</StyledButton>
)
}
74 changes: 0 additions & 74 deletions frontend/src/components/Displays/MissionButtons/MissionButton.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button, Typography } from '@equinor/eds-core-react'
import styled from 'styled-components'
import { useLanguageContext } from 'components/Contexts/LanguageContext'
import { MissionButton } from 'components/Displays/MissionButtons/MissionButton'
import { CreateEchoMissionButton } from 'components/Displays/MissionButtons/CreateEchoMissionButton'
import { StyledDialog } from 'components/Styles/StyledComponents'

const StyledMissionSection = styled.div`
Expand All @@ -26,7 +26,7 @@ export const NoMissionsDialog = ({ closeDialog }: { closeDialog: () => void }):
<Button onClick={closeDialog} variant="outlined">
{TranslateText('Cancel')}
</Button>
<MissionButton />
<CreateEchoMissionButton />
</StyledMissionSection>
</StyledDialog>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getInspectionDeadline } from 'utils/StringFormatting'
import { Inspection } from './InspectionSection'
import styled from 'styled-components'
import { ScheduleMissionDialog } from '../FrontPage/MissionOverview/ScheduleMissionDialog/ScheduleMissionDialog'
import { MissionButton } from 'components/Displays/MissionButtons/MissionButton'
import { CreateEchoMissionButton } from 'components/Displays/MissionButtons/CreateEchoMissionButton'
import { useInstallationContext } from 'components/Contexts/InstallationContext'
import { useRobotContext } from 'components/Contexts/RobotContext'
import { AlertType, useAlertContext } from 'components/Contexts/AlertContext'
Expand Down Expand Up @@ -121,7 +121,7 @@ export const InspectionOverviewSection = () => {
/>
)}
<AddPredefinedMissionsButton />
<MissionButton />
<CreateEchoMissionButton />
</StyledButtons>
{allMissions && <AllInspectionsTable inspections={allMissions} />}
</StyledContent>
Expand Down

0 comments on commit 77a29ba

Please sign in to comment.