diff --git a/src/components/sidebar/defibrillatorDetails.tsx b/src/components/sidebar/defibrillatorDetails.tsx index 5e30283..3ab1ebe 100644 --- a/src/components/sidebar/defibrillatorDetails.tsx +++ b/src/components/sidebar/defibrillatorDetails.tsx @@ -8,7 +8,7 @@ import { mdiPhoneOutline, } from "@mdi/js"; import Icon from "@mdi/react"; -import React, { FC, useState } from "react"; +import React, { FC, Suspense, useState } from "react"; import { Button, Card, Columns, Image } from "react-bulma-components"; import { useTranslation } from "react-i18next"; import ImageGallery, { ReactImageGalleryItem } from "react-image-gallery"; @@ -29,9 +29,10 @@ import { ViewButton, } from "./buttons"; import DetailTextRow from "./detailTextRow"; -import { OpeningHoursField } from "./openingHours"; import { CheckDateField } from "./verificationDate"; +const OpeningHoursField = React.lazy(() => import("./openingHours")); + const PhotoGallery: FC = ({ data, closeSidebar, @@ -208,10 +209,12 @@ const DefibrillatorDetails: FC = (props) => { /> - + Loading...}> + + diff --git a/src/components/sidebar/openingHours.tsx b/src/components/sidebar/openingHours.tsx index cb61e3b..1bb911b 100644 --- a/src/components/sidebar/openingHours.tsx +++ b/src/components/sidebar/openingHours.tsx @@ -1,4 +1,5 @@ -import OpeningHours, { argument_hash } from "opening_hours"; +import OpeningHours from "opening_hours"; +import type { argument_hash } from "opening_hours"; import React, { FC } from "react"; import { useTranslation } from "react-i18next"; @@ -74,7 +75,7 @@ function isCurrentlyOpen( } } -export const CurrentlyOpenStatus: FC = ({ +const CurrentlyOpenStatus: FC = ({ openingHours, timezoneOffsetUTCMinutes, }) => { @@ -97,7 +98,7 @@ export const CurrentlyOpenStatus: FC = ({ ); }; -export const OpeningHoursDescription: FC = ({ +const OpeningHoursDescription: FC = ({ openingHours, timezoneOffsetUTCMinutes, }) => { @@ -123,7 +124,7 @@ export const OpeningHoursDescription: FC = ({ ); }; -export const OpeningHoursField: FC = ({ +const OpeningHoursField: FC = ({ openingHours, timezoneOffsetUTCMinutes, }) => { @@ -141,3 +142,5 @@ export const OpeningHoursField: FC = ({ ); }; + +export default OpeningHoursField;