Skip to content

Commit

Permalink
Merge pull request aws-geospatial#253 from aws-geospatial/ALS-1853_re…
Browse files Browse the repository at this point in the history
…sponsiveness-issues

[ALS-1853] Responsive drawer issues
  • Loading branch information
mbalfour-amzn authored Aug 26, 2024
2 parents d5b9a61 + 447374d commit 501bb84
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {

import { Flex, Loader, Text } from "@aws-amplify/ui-react";
import { IconClose, IconNotificationBell } from "@demo/assets/svgs";
import { ConfirmationModal } from "@demo/atomicui/molecules";
import appConfig from "@demo/core/constants/appConfig";
import BottomSheetHeights from "@demo/core/constants/bottomSheetHeights";
import { useGeofence, useMap, usePersistedData, useRoute, useTracker } from "@demo/hooks";
Expand All @@ -37,9 +38,6 @@ const Explore = lazy(() => import("../Explore").then(module => ({ default: modul
const UnauthSimulation = lazy(() =>
import("../UnauthSimulation").then(module => ({ default: module.UnauthSimulation }))
);
const ConfirmationModal = lazy(() =>
import("@demo/atomicui/molecules/ConfirmationModal").then(module => ({ default: module.ConfirmationModal }))
);

const {
ROUTES: { DEMO }
Expand Down
20 changes: 18 additions & 2 deletions src/atomicui/pages/DemoPage/DemoPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ const UnauthSimulationExitModal = lazy(() =>

const {
MAP_RESOURCES: { MAX_BOUNDS },
LINKS: { AMAZON_LOCATION_TERMS_AND_CONDITIONS, AWS_LOCATION }
LINKS: { AMAZON_LOCATION_TERMS_AND_CONDITIONS, AWS_LOCATION },
ROUTES: { DEMO }
} = appConfig;
const initShow = {
sidebar: false,
Expand Down Expand Up @@ -192,7 +193,7 @@ const DemoPage: FC = () => {
const { resetStore: resetGeofenceStore } = useGeofence();
const { isEditingRoute, resetStore: resetTrackerStore } = useTracker();
const { showWelcomeModal, setShowWelcomeModal, setSettingsOptions } = usePersistedData();
const { isDesktop, isMobile, isTablet } = useDeviceMediaQuery();
const { isDesktop, isMobile, isTablet, isMax766 } = useDeviceMediaQuery();
const { setUI, ui, bottomSheetCurrentHeight = 0, setBottomSheetHeight, setBottomSheetMinHeight } = useBottomSheet();
const { clearCredsAndClients } = useCredsManager();
const {
Expand Down Expand Up @@ -237,6 +238,21 @@ const DemoPage: FC = () => {
const isLtr = langDir === "ltr";
const geoLocateTopValue = `${bottomSheetCurrentHeight / 13 + 0.59}rem`;

const handlePopState = () => {
if (isMax766 && window.location.pathname === DEMO) {
history.go();
}
};

useEffect(() => {
window.addEventListener("popstate", handlePopState);

return () => {
window.removeEventListener("popstate", handlePopState);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
let previousWidth = document.body.clientWidth;

Expand Down

0 comments on commit 501bb84

Please sign in to comment.