Skip to content

Commit

Permalink
Show only areas on selected installation
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddasol committed Nov 9, 2023
1 parent 82289b4 commit d194a54
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Pose } from 'models/Pose'
import { Orientation } from 'models/Orientation'
import { Mission, MissionStatus } from 'models/Mission'
import { tokens } from '@equinor/eds-tokens'
import { useInstallationContext } from 'components/Contexts/InstallationContext'

const StyledDialog = styled(Card)`
display: flex;
Expand Down Expand Up @@ -50,6 +51,7 @@ interface RobotProps {

export const LocalizationDialog = ({ robot }: RobotProps): JSX.Element => {
const { TranslateText } = useLanguageContext()
const { installationCode } = useInstallationContext()
const [isLocalizationDialogOpen, setIsLocalizationDialogOpen] = useState<boolean>(false)
const [missionLocalizationStatus, setMissionLocalizationInfo] = useState<string>()
const [selectedArea, setSelectedArea] = useState<Area>()
Expand All @@ -70,7 +72,10 @@ export const LocalizationDialog = ({ robot }: RobotProps): JSX.Element => {

useEffect(() => {
BackendAPICaller.getAreas().then((response: Area[]) => {
setAreas(response)
const relevantAreas = response.filter(
(area) => area.installationCode.toLowerCase() === installationCode.toLowerCase()
)
setAreas(relevantAreas)
})
}, [])

Expand Down

0 comments on commit d194a54

Please sign in to comment.