Skip to content

Commit d5ad49c

Browse files
committed
Introduce global phone width
1 parent b7da16b commit d5ad49c

21 files changed

Lines changed: 57 additions & 37 deletions

File tree

frontend/src/components/Alerts/AlertsBanner.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { tokens } from '@equinor/eds-tokens'
33
import { ReactNode, useState } from 'react'
44
import styled from 'styled-components'
55
import { Icons } from 'utils/icons'
6+
import { phone_width } from 'utils/constants'
67

78
const StyledCard = styled.div`
89
display: flex;
@@ -14,7 +15,7 @@ const StyledCard = styled.div`
1415
align-items: center;
1516
overflow: hidden;
1617
17-
@media (max-width: 600px) {
18+
@media (max-width: ${phone_width}) {
1819
padding: 6px 8px 2px 10px;
1920
}
2021
`

frontend/src/components/Header/Header.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import { NavigationMenu } from 'components/NavigationMenu/NavigationMenu'
1111
import { findNavigationPage } from 'components/Pages/AssetSelectionPage/AssetSelectionPage'
1212
import { AlertIcon } from 'components/Header/AlertIcon'
1313
import { useNavigate } from 'react-router-dom'
14+
import { phone_width } from 'utils/constants'
1415

1516
const StyledTopBar = styled(TopBar)`
1617
align-items: center;
1718
box-shadow: none;
18-
@media (max-width: 600px) {
19+
@media (max-width: ${phone_width}) {
1920
grid-column-gap: 12px;
2021
}
2122
height: fit-content;
@@ -50,7 +51,7 @@ const StyledTopBarHeader = styled.div`
5051
`
5152
const StyledNavigationMenu = styled.div`
5253
display: none;
53-
@media (max-width: 600px) {
54+
@media (max-width: ${phone_width}) {
5455
display: block;
5556
}
5657
`

frontend/src/components/NavigationMenu/NavigationMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const NavigationMenu = () => {
2929
? [
3030
{ path: 'mission-control', label: 'Mission Control' },
3131
{ path: 'history', label: 'Mission History' },
32-
{ path: 'area-overview', label: 'Area Overview' },
32+
{ path: 'inspection-overview', label: 'Area Overview' },
3333
{ path: 'predefined-missions', label: 'Predefined Missions' },
3434
{ path: 'auto-schedule', label: 'Auto Scheduling' },
3535
{ path: 'robots', label: 'Robots' },

frontend/src/components/Pages/AssetSelectionPage/AssetSelectionPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'compon
1616
import { AlertCategory } from 'components/Alerts/AlertsBanner'
1717
import assetImage from 'mediaAssets/assetPage.jpg'
1818
import { useNavigate } from 'react-router-dom'
19+
import { phone_width } from '../../../utils/constants'
1920

2021
const Centered = styled.div`
2122
display: flex;
@@ -39,7 +40,7 @@ const StyledImage = styled.img`
3940
object-fit: cover;
4041
height: 500px;
4142
42-
@media (max-width: 500px) {
43+
@media (max-width: ${phone_width}) {
4344
height: 400px;
4445
}
4546
`

frontend/src/components/Pages/FrontPage/AutoScheduleSection/AutoScheduleSection.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ import { MissionDefinitionEditDialogContent } from 'components/Pages/MissionDefi
1212
import { MissionDefinition } from 'models/MissionDefinition'
1313
import { AutoScheduleMissionTableRow } from './AutoScheduleMissionTableRow'
1414
import { CalendarPro } from './AutoScheduleCalendar'
15+
import { phone_width } from 'utils/constants'
1516

1617
const StyledSection = styled.div`
1718
display: flex;
1819
flex-direction: column;
1920
max-width: 960px;
2021
gap: 1rem;
2122
22-
@media (min-width: 600px) {
23+
@media (min-width: ${phone_width}) ) {
2324
min-width: 90vw;
2425
}
2526
`
@@ -36,20 +37,20 @@ const StyledContent = styled.div`
3637
flex-direction: column;
3738
gap: 30px;
3839
align-items: end;
39-
@media (max-width: 600px) {
40+
@media (max-width: ${phone_width}) {
4041
align-items: start;
4142
}
4243
max-width: 95%;
4344
`
4445

4546
const StyledDesktopView = styled.div`
46-
@media (max-width: 600px) {
47+
@media (max-width: ${phone_width}) {
4748
display: none;
4849
}
4950
`
5051

5152
const StyledPhoneView = styled.div`
52-
@media (min-width: 600px) {
53+
@media (min-width: ${phone_width}) ) {
5354
display: none;
5455
}
5556
`

frontend/src/components/Pages/FrontPage/FrontPage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { useMissionsContext } from 'components/Contexts/MissionRunsContext'
1717
import { useNavigate } from 'react-router-dom'
1818
import { config } from 'config'
1919
import { useInstallationContext } from 'components/Contexts/InstallationContext'
20+
import { phone_width } from 'utils/constants'
2021

2122
const StyledFrontPage = styled.div`
2223
display: flex;
@@ -26,7 +27,7 @@ const StyledFrontPage = styled.div`
2627
background-color: ${tokens.colors.ui.background__light.hex};
2728
min-height: calc(100vh - 65px);
2829
29-
@media (max-width: 600px) {
30+
@media (max-width: ${phone_width}) {
3031
display: none;
3132
}
3233
`
@@ -81,7 +82,7 @@ const OngoingMissionsInfo = ({ goToOngoingTab }: { goToOngoingTab: () => void })
8182

8283
export enum TabNames {
8384
MissionControl = 'mission-control',
84-
InspectionPlan = 'inspection-plan',
85+
InspectionPlan = 'inspection-overview',
8586
PredefinedMissions = 'predefined-missions',
8687
MissionHistory = 'mission-history',
8788
AutoScheduling = 'auto-scheduling',

frontend/src/components/Pages/FrontPage/MissionOverview/ScheduleMissionDialog/SelectMissionsToScheduleDialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useMissionsContext } from 'components/Contexts/MissionRunsContext'
1111
import { AlertType, useAlertContext } from 'components/Contexts/AlertContext'
1212
import { FailedRequestAlertContent, FailedRequestAlertListContent } from 'components/Alerts/FailedRequestAlert'
1313
import { AlertCategory } from 'components/Alerts/AlertsBanner'
14+
import { phone_width } from 'utils/constants'
1415

1516
const StyledMissionDialog = styled.div`
1617
display: flex;
@@ -34,7 +35,7 @@ const StyledDialog = styled(Dialog)`
3435
padding: 1rem;
3536
width: 580px;
3637
37-
@media (max-width: 600px) {
38+
@media (max-width: ${phone_width}) {
3839
width: 80vw;
3940
}
4041
`

frontend/src/components/Pages/InfoPage.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Header } from 'components/Header/Header'
55
import { StyledPage } from 'components/Styles/StyledComponents'
66
import styled from 'styled-components'
77
import infoPageImage from 'mediaAssets/taurob-about-us.png'
8+
import { phone_width } from 'utils/constants'
89

910
const StyledInfoPAge = styled(StyledPage)`
1011
width: 100%;
@@ -29,7 +30,7 @@ const StyledAboutSection = styled.div`
2930
const StyledTypography = styled(Typography)`
3031
text-align: center;
3132
width: 600px;
32-
@media (max-width: 600px) {
33+
@media (max-width: ${phone_width}) {
3334
width: 350px;
3435
}
3536
`
@@ -39,7 +40,7 @@ const StyledImage = styled.img`
3940
max-width: 45%;
4041
padding-left: 20px;
4142
42-
@media (max-width: 600px) {
43+
@media (max-width: ${phone_width}) {
4344
max-width: 100vw;
4445
padding: 0px;
4546
}
@@ -54,7 +55,7 @@ const StyledInfoSection = styled.div`
5455
align-items: top;
5556
gap: 20px;
5657
57-
@media (max-width: 500px) {
58+
@media (max-width: ${phone_width}) {
5859
flex-direction: column;
5960
gap: 2rem;
6061
padding-top: 20px;
@@ -68,7 +69,7 @@ const StyledInfo = styled.div`
6869
gap: 2rem;
6970
padding-top: 50px;
7071
71-
@media (max-width: 500px) {
72+
@media (max-width: ${phone_width}) {
7273
width: 90%;
7374
padding-left: 15px;
7475
}

frontend/src/components/Pages/InspectionPage/InspectionOverview.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ import { StyledButton } from 'components/Styles/StyledComponents'
1616
import { useMissionDefinitionsContext } from 'components/Contexts/MissionDefinitionsContext'
1717
import { AlertCategory } from 'components/Alerts/AlertsBanner'
1818
import { Placeholder } from './InspectionUtilities'
19+
import { phone_width } from 'utils/constants'
1920

2021
const StyledContent = styled.div`
2122
display: flex;
2223
flex-direction: column;
2324
align-items: end;
24-
@media (max-width: 600px) {
25+
@media (max-width: ${phone_width}) {
2526
align-items: start;
2627
}
2728
`

frontend/src/components/Pages/InspectionPage/InspectionTable.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { useMissionsContext } from 'components/Contexts/MissionRunsContext'
1616
import { useRobotContext } from 'components/Contexts/RobotContext'
1717
import { FrontPageSectionId } from 'models/FrontPageSectionId'
1818
import { SmallScreenInfoText } from 'utils/InfoText'
19+
import { phone_width } from 'utils/constants'
1920

2021
const StyledIcon = styled(Icon)`
2122
display: flex;
@@ -26,7 +27,7 @@ const StyledIcon = styled(Icon)`
2627
const StyledTable = styled.div`
2728
display: grid;
2829
overflow-x: auto;
29-
@media (max-width: 700px) {
30+
@media (max-width: ${phone_width}) {
3031
width: calc(100vw - 30px);
3132
}
3233
max-width: fit-content;
@@ -56,7 +57,7 @@ const HideColumnsOnSmallScreen = styled.div`
5657
#SmallScreenInfoText {
5758
display: none;
5859
}
59-
@media (max-width: 500px) {
60+
@media (max-width: ${phone_width}) {
6061
#${InspectionTableColumns.Description} {
6162
display: none;
6263
}

0 commit comments

Comments
 (0)