Skip to content

Commit

Permalink
4287 - FRA Kiosk: Map empty space & Back button (#4299)
Browse files Browse the repository at this point in the history
* 4287 - Restrict map bounds

* 4287 - Add Kiosk back button
  • Loading branch information
yaguzmang authored Jan 30, 2025
1 parent fd1d3bd commit 776fc9b
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/client/pages/Geo/Map/hooks/useGeoMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const baseMapOptions = {
disableDefaultUI: true,
fullscreenControl: false,
mapTypeControl: false,
restriction: {
latLngBounds: { east: 180, north: 85, south: -85, west: -180 },
strictBounds: true,
},
rotateControl: false,
styles,
}
Expand Down
21 changes: 19 additions & 2 deletions src/client/pages/Kiosk/KioskLayout/SidePanel/SidePanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,38 @@ $title: #ef7a2d;
}
}

.kiosk-side-panel__back-button,
.kiosk-side-panel__home-button {
all: unset;
aspect-ratio: 1 / 1;
cursor: pointer;
height: auto;
width: 35%;

.icon {
color: $title;
height: 100%;
margin-top: -10px;
width: 100%;
}
}

.kiosk-side-panel__back-button {
margin-left: auto;
visibility: hidden;
width: 20%;

&.visible {
visibility: visible;
}
}

.kiosk-side-panel__home-button {
width: 35%;

.icon {
margin-top: -10px;
}
}

.kiosk-side-panel {
background-color: $side-panel-bg;
display: flex;
Expand Down
20 changes: 19 additions & 1 deletion src/client/pages/Kiosk/KioskLayout/SidePanel/SidePanel.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import './SidePanel.scss'
import React, { useTransition } from 'react'
import React, { useCallback, useTransition } from 'react'
import { useNavigate } from 'react-router-dom'

import classNames from 'classnames'

import { Routes } from 'meta/routes'

import { useIsRoute } from 'client/hooks/useIsRoute'
import Icon from 'client/components/Icon'

const SidePanel: React.FC = () => {
const navigate = useNavigate()
const [, startTransition] = useTransition()

const isKioskHomeRoute = useIsRoute({ path: Routes.Kiosk.path.absolute, exact: true })

const goBack = useCallback(() => {
navigate(-1)
}, [navigate])

return (
<div className="kiosk-side-panel">
<div className="kiosk-side-panel__header">
Expand All @@ -36,6 +45,15 @@ const SidePanel: React.FC = () => {
<div className="kiosk-side-panel__partners">
<img alt="EU" className="kiosk-side-panel__partners-eu" src="/img/partners/EU.jpg" />
<img alt="NICFI" className="kiosk-side-panel__partners-nicfi" src="/img/partners/NICFI.png" />

{/* No conditional rendering here to avoid layout shifting in certain screen sizes */}
<button
className={classNames('kiosk-side-panel__back-button', { visible: !isKioskHomeRoute })}
onClick={() => startTransition(() => goBack())}
type="button"
>
<Icon name="arrow-back" />
</button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ const baseMapOptions = {
mapTypeId: 'satellite',
maxZoom: 15,
minZoom: 3,
restriction: {
latLngBounds: { east: 180, north: 85, south: -85, west: -180 },
strictBounds: true,
},
rotateControl: false,
zoom: 3,
}
Expand Down
7 changes: 7 additions & 0 deletions web-resources/img/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 776fc9b

Please sign in to comment.