Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion frontend/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ import { Icons } from 'utils/icons'
import { useAlertContext } from 'components/Contexts/AlertContext'
import { AlertBanner } from 'components/Alerts/AlertsBanner'
import { FrontPageSectionId } from 'models/FrontPageSectionId'
import { NavigationMenu } from './NavigationMenu'

const StyledTopBar = styled(TopBar)`
align-items: center;
display: flex;
box-shadow: none;
padding: 8px 24px 0px 24px;
justify-content: space-between;
align-items: center;
align-self: stretch;
`
const StyledWrapper = styled.div`
display: flex;
Expand Down Expand Up @@ -64,6 +69,7 @@ export const Header = ({ page }: { page: string }) => {
</StyledTopBarHeader>
</TopBar.Header>
</StyledWrapper>
<NavigationMenu />
<TopBar.Actions>
<Button
variant="ghost_icon"
Expand Down
62 changes: 62 additions & 0 deletions frontend/src/components/Header/NavigationMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Button, Icon, Menu } from '@equinor/eds-core-react'
import { useLanguageContext } from 'components/Contexts/LanguageContext'
import { config } from 'config'
import { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { styled } from 'styled-components'
import { Icons } from 'utils/icons'

const StyledButton = styled(Button)`
width: 100px;
border-radius: 4px;
`

export const NavigationMenu = () => {
const { TranslateText } = useLanguageContext()
const [isOpen, setIsOpen] = useState(false)
const [anchorEl, setAnchorEl] = useState(null)
const openMenu = () => {
setIsOpen(true)
}
const closeMenu = () => {
setIsOpen(false)
}

const paths = [
{ path: 'frontPage', label: 'Front page' },
{ path: 'missionControl', label: 'Mission control' },
{ path: 'history', label: 'Mission history' },
{ path: 'inspectionPage', label: 'Deck overview' },
{ path: 'robotsPage', label: 'Robots' },
]

let navigate = useNavigate()
const routeChange = (routePath: string) => {
const path = `${config.FRONTEND_BASE_ROUTE}/${routePath}`
navigate(path)
return
}

return (
<>
<StyledButton
id="menu"
variant="ghost"
ref={setAnchorEl}
aria-label="Menu"
aria-haspopup="true"
aria-expanded={isOpen}
aria-controls="menu"
onClick={() => (isOpen ? closeMenu() : openMenu())}
>
<Icon name={Icons.Menu}></Icon>
{TranslateText('Menu')}
</StyledButton>
<Menu open={isOpen} id="menu" aria-labelledby="menu" onClose={closeMenu} anchorEl={anchorEl}>
{paths.map((page) => (
<Menu.Item onClick={() => routeChange(page.path)}>{TranslateText(page.label)}</Menu.Item>
))}
</Menu>
</>
)
}
6 changes: 6 additions & 0 deletions frontend/src/components/Pages/FlotillaSite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { RobotPage } from './RobotPage/RobotPage'
import { APIUpdater } from 'components/Contexts/APIUpdater'
import { MissionDefinitionPage } from './MissionDefinitionPage/MissionDefinitionPage'
import { AssetSelectionPage } from './AssetSelectionPage/AssetSelectionPage'
import { MissionControlPage } from './FrontPage/MissionControlPage'
import { InspectionPage } from './InspectionPage/InspectionPage'
import { RobotsPage } from './RobotPage/RobotsPage'

export const FlotillaSite = () => {
return (
Expand All @@ -23,6 +26,9 @@ export const FlotillaSite = () => {
/>
<Route path={`${config.FRONTEND_BASE_ROUTE}/history`} element={<MissionHistoryPage />} />
<Route path={`${config.FRONTEND_BASE_ROUTE}/robot/:robotId`} element={<RobotPage />} />
<Route path={`${config.FRONTEND_BASE_ROUTE}/missionControl`} element={<MissionControlPage />} />
<Route path={`${config.FRONTEND_BASE_ROUTE}/inspectionPage`} element={<InspectionPage />} />
<Route path={`${config.FRONTEND_BASE_ROUTE}/robotsPage`} element={<RobotsPage />} />
</Routes>
</BrowserRouter>
</APIUpdater>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Pages/FrontPage/FrontPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const StyledFrontPage = styled.div`
gap: 3rem;
padding: 15px 15px;
background-color: ${tokens.colors.ui.background__light.hex};
min-height: calc(100vh - 65px);
`

const HorizontalContent = styled.div`
Expand Down
46 changes: 46 additions & 0 deletions frontend/src/components/Pages/FrontPage/MissionControlPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { MissionQueueView } from 'components/Pages/FrontPage/MissionOverview/MissionQueueView'
import { OngoingMissionView } from 'components/Pages/FrontPage/MissionOverview/OngoingMissionView'
import { Header } from 'components/Header/Header'
import styled from 'styled-components'
import { StopRobotDialog } from './MissionOverview/StopDialogs'
import { tokens } from '@equinor/eds-tokens'

const StyledFrontPage = styled.div`
display: flex;
flex-direction: column;
gap: 1rem;
padding: 15px 15px;
background-color: ${tokens.colors.ui.background__light.hex};
min-height: calc(100vh - 65px);
`

const HorizontalContent = styled.div`
display: flex;
flex-wrap: wrap;
grid-template-columns: auto auto;
gap: 2rem;
`

const MissionsContent = styled.div`
display: flex;
flex-wrap: wrap;
flex-direction: row;
gap: 2rem;
`

export const MissionControlPage = () => {
return (
<>
<Header page={'missionControlPage'} />
<StyledFrontPage>
<StopRobotDialog />
<HorizontalContent>
<MissionsContent>
<OngoingMissionView />
<MissionQueueView />
</MissionsContent>
</HorizontalContent>
</StyledFrontPage>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const StyledCard = styled(Card)`
const HoverableStyledCard = styled(Card)`
display: flex;
flex-direction: column;
height: 300px;
width: 280px;
gap: 0px;
background-color: ${tokens.colors.ui.background__default.hex};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ const RobotCardSection = styled.div`
gap: 2rem;
`
const RobotView = styled.div`
display: grid;
grid-column: 1/ -1;
gap: 1rem;
display: flex;
padding-top: 1rem;
flex-direction: column;
gap: 1.5rem;
`

export const RobotStatusSection = () => {
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/components/Pages/InspectionPage/InspectionPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Header } from 'components/Header/Header'
import styled from 'styled-components'
import { InspectionOverviewSection } from 'components/Pages/InspectionPage/InspectionOverview'
import { tokens } from '@equinor/eds-tokens'

const StyledFrontPage = styled.div`
display: grid;
grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
gap: 3rem;
padding: 15px 15px;
background-color: ${tokens.colors.ui.background__light.hex};
min-height: calc(100vh - 65px);
`

export const InspectionPage = () => {
return (
<>
<Header page={'inspectionPage'} />
<StyledFrontPage>
<InspectionOverviewSection />
</StyledFrontPage>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const StyledHeader = styled.div`
}
`

const StyledSerach = styled(Search)`
const StyledSearch = styled(Search)`
display: flex;
width: 288px;
height: 36px;
Expand All @@ -35,6 +35,9 @@ const StyledSerach = styled(Search)`
border-bottom: none;
border: 1px solid ${tokens.colors.ui.background__medium.hex};
--eds-input-background: white;
> div {
box-shadow: unset;
}
`

const StyledButtonDiv = styled.div`
Expand Down Expand Up @@ -85,7 +88,7 @@ export const FilterSection = () => {
return (
<>
<StyledHeader>
<StyledSerach
<StyledSearch
value={filterState.missionName ?? ''}
placeholder={TranslateText('Search for missions')}
onChange={(changes: ChangeEvent<HTMLInputElement>) => {
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/components/Pages/RobotPage/RobotsPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RobotStatusSection } from 'components/Pages/FrontPage/RobotCards/RobotStatusSection'
import { Header } from 'components/Header/Header'
import styled from 'styled-components'
import { tokens } from '@equinor/eds-tokens'

const StyledFrontPage = styled.div`
display: grid;
grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
gap: 3rem;
padding: 15px 15px;
background-color: ${tokens.colors.ui.background__light.hex};
min-height: calc(100vh - 65px);
`

export const RobotsPage = () => {
return (
<>
<Header page={'robotsPage'} />
<StyledFrontPage>
<RobotStatusSection />
</StyledFrontPage>
</>
)
}
8 changes: 7 additions & 1 deletion frontend/src/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,11 @@
"Failed to update inspection": "Failed to update inspection",
"Battery": "Battery",
"Recharging": "Recharging",
"Active Filters": "Active Filters"
"Active Filters": "Active Filters",
"Menu": "Menu",
"Front page": "Front page",
"Mission control": "Mission control",
"Mission history": "Mission history",
"Deck overview": "Deck overview",
"Robots": "Robots"
}
8 changes: 7 additions & 1 deletion frontend/src/language/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,11 @@
"Failed to update inspection": "Kunne ikke oppdatere inspeksjon",
"Battery": "Batteri",
"Recharging": "Lader",
"Active Filters": "Aktive filtre"
"Active Filters": "Aktive filtre",
"Menu": "Meny",
"Front page": "Front page",
"Mission control": "Mission control",
"Mission history": "Historikk",
"Deck overview": "Dekkoversikt",
"Robots": "Roboter"
}
3 changes: 3 additions & 0 deletions frontend/src/utils/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
info_circle,
blocked,
close_circle_outlined,
menu,
} from '@equinor/eds-icons'

Icon.add({
Expand Down Expand Up @@ -87,6 +88,7 @@ Icon.add({
info_circle,
blocked,
close_circle_outlined,
menu,
})

export enum Icons {
Expand Down Expand Up @@ -132,4 +134,5 @@ export enum Icons {
Info = 'info_circle',
Blocked = 'blocked',
ClosedCircleOutlined = 'close_circle_outlined',
Menu = 'menu',
}