diff --git a/package-lock.json b/package-lock.json index 0a993b13c..71423d79f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3149,9 +3149,9 @@ } }, "node_modules/@linzjs/lui": { - "version": "21.15.1", - "resolved": "https://registry.npmjs.org/@linzjs/lui/-/lui-21.15.1.tgz", - "integrity": "sha512-O4d7NtP6QU6UkYCjDiGS3aGbyPiUCtmZmrYtBaF5HfcC3z+ndZEyHPDW7f0QbT93NTeQ7s58OSulZbFBspr3rA==", + "version": "21.46.0", + "resolved": "https://registry.npmjs.org/@linzjs/lui/-/lui-21.46.0.tgz", + "integrity": "sha512-8ZuXx556OInxJIvOyYiE9/Bn/o1kN/7L4bCfeiV17MZRjA3nkdsPWGBISWCppSPUJsnkBnRrVxohIqCwdH8/2Q==", "dev": true, "dependencies": { "@fontsource/open-sans": "^4.5.1", @@ -5316,6 +5316,15 @@ "csstype": "^3.0.2" } }, + "node_modules/@types/react-modal": { + "version": "3.16.3", + "resolved": "https://registry.npmjs.org/@types/react-modal/-/react-modal-3.16.3.tgz", + "integrity": "sha512-xXuGavyEGaFQDgBv4UVm8/ZsG+qxeQ7f77yNrW3n+1J6XAstUy5rYHeIHPh1KzsGc6IkCIdu6lQ2xWzu1jBTLg==", + "dev": true, + "dependencies": { + "@types/react": "*" + } + }, "node_modules/@types/react-transition-group": { "version": "4.4.10", "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.10.tgz", @@ -19571,15 +19580,17 @@ "@basemaps/geo": "^7.11.0", "@basemaps/infra": "^7.11.0", "@basemaps/shared": "^7.11.0", - "@linzjs/lui": "^21.12.1", + "@linzjs/lui": "^21.46.0", "@servie/events": "^3.0.0", "@types/proj4": "^2.5.2", "@types/react-dom": "^18.0.6", + "@types/react-modal": "^3.16.3", "maplibre-gl": "^4.5.0", "mime-types": "^2.1.35", "proj4": "^2.8.0", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-modal": "^3.16.1", "ulid": "^2.3.0" }, "engines": { diff --git a/packages/landing/package.json b/packages/landing/package.json index 05f21dcf5..b07017ce4 100644 --- a/packages/landing/package.json +++ b/packages/landing/package.json @@ -33,15 +33,17 @@ "@basemaps/geo": "^7.11.0", "@basemaps/infra": "^7.11.0", "@basemaps/shared": "^7.11.0", - "@linzjs/lui": "^21.12.1", + "@linzjs/lui": "^21.46.0", "@servie/events": "^3.0.0", "@types/proj4": "^2.5.2", "@types/react-dom": "^18.0.6", + "@types/react-modal": "^3.16.3", "maplibre-gl": "^4.5.0", "mime-types": "^2.1.35", "proj4": "^2.8.0", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-modal": "^3.16.1", "ulid": "^2.3.0" }, "publishConfig": { diff --git a/packages/landing/src/components/feature.updates.tsx b/packages/landing/src/components/feature.updates.tsx new file mode 100644 index 000000000..b7a72350d --- /dev/null +++ b/packages/landing/src/components/feature.updates.tsx @@ -0,0 +1,110 @@ +import { clsx } from 'clsx'; +import { Component, ReactNode } from 'react'; +import ReactModal from 'react-modal'; + +interface IFrameConfig { + url: string; + width: number; + height: number; + title: string; + iframeWrapperClass?: string; + iFrameProps?: Partial; +} + +type FeatureUpdatesProps = { + header: string; + wrapperClass?: string; + id: string; + releaseVersion: string; + enabled: boolean; + children?: ReactNode; +} & ( + | { bigImage: string; smallImage: string; iframe?: never } + | { bigImage?: never; smallImage?: never; iframe: IFrameConfig } +); + +type FeatureUpdatesState = { + showModal: boolean; +}; + +export class FeatureUpdates extends Component { + constructor(props: FeatureUpdatesProps) { + super(props); + const currentVersion = window.localStorage.getItem(this.props.id); + this.state = { + showModal: this.props.enabled && this.props.releaseVersion.trim() !== currentVersion, + }; + } + + handleClose = (): void => { + this.setState({ showModal: false }); + window.localStorage.setItem(this.props.id, this.props.releaseVersion); + }; + + renderFeatureMedia(): ReactNode { + const { bigImage, smallImage, iframe } = this.props; + if (iframe) { + return ; + } + if (bigImage && smallImage) { + return ; + } + return null; // Return null if no media is available + } + + override render(): ReactNode { + const { header, wrapperClass, children } = this.props; + const { showModal } = this.state; + + if (!showModal) return null; + + return ( + +
+
+
+ {/* */} +

{header}

+
+ +
+ {this.renderFeatureMedia()} +
{children}
+
+
+ ); + } +} + +const FeatureImages = ({ bigImage, smallImage }: { bigImage: string; smallImage: string }): ReactNode => ( +
+ {"What's + {"What's +
+); + +const FeatureIFrame = ({ iframeConfig }: { iframeConfig: IFrameConfig }): ReactNode => { + const wrapperClass = iframeConfig.iframeWrapperClass || 'iframe-wrapper'; + const iFrameProps = iframeConfig.iFrameProps || {}; + return ( +
+ +
+ ); +}; diff --git a/packages/landing/src/components/features/lg_3d_maps_splash.gif b/packages/landing/src/components/features/lg_3d_maps_splash.gif new file mode 100644 index 000000000..0a0852fc7 Binary files /dev/null and b/packages/landing/src/components/features/lg_3d_maps_splash.gif differ diff --git a/packages/landing/src/components/features/new.feature.tsx b/packages/landing/src/components/features/new.feature.tsx new file mode 100644 index 000000000..fa2226b67 --- /dev/null +++ b/packages/landing/src/components/features/new.feature.tsx @@ -0,0 +1,48 @@ +import { FeatureUpdates } from '../feature.updates.js'; + +// Make sure you turn off the toggle before making any changes... someone who has not dismissed it might log in... +const bigImage = 'https://dev.basemaps.linz.govt.nz/assets/Lg+3D+Maps+splash.gif'; +const smallImage = 'https://dev.basemaps.linz.govt.nz/assets/Lg+3D+Maps+splash.gif'; +const link = 'https://www.linz.govt.nz/products-services/data/linz-basemaps'; + +const recentUpdates = { + children: ( + <> +
LINZ Basemaps 3D map is available now!
+

You can now view 3d Basemaps now.

+

+ For more information see  + + What's new in Basemaps + +

+ + ), + bigImage, + smallImage, +}; + +export const dismissedKey = `Basemaps_Recent_Updates_Dismissed`; +export const releaseVersion = 'V7'; +/* + ***************** PLEASE READ BEFORE CHANGING!!! ***************** + Make sure you delete lines 55 to 58 and uncomment line 54 before merging your changes. + Those lines were only added for OCTN release. + */ +export const NewFeature = (): JSX.Element => { + const resentUpdatesModalEnabled = true; + return ( + <> + + {recentUpdates.children} + + + ); +}; diff --git a/packages/landing/src/components/features/sml_3d_map_splash.gif b/packages/landing/src/components/features/sml_3d_map_splash.gif new file mode 100644 index 000000000..244d527ab Binary files /dev/null and b/packages/landing/src/components/features/sml_3d_map_splash.gif differ diff --git a/packages/landing/src/index.tsx b/packages/landing/src/index.tsx index f9fbf5883..8473bb979 100644 --- a/packages/landing/src/index.tsx +++ b/packages/landing/src/index.tsx @@ -1,6 +1,7 @@ import { Component, Fragment, ReactNode } from 'react'; import { createRoot } from 'react-dom/client'; +import { NewFeature } from './components/features/new.feature.js'; import { Footer } from './components/layout.footer.js'; import { Header } from './components/layout.header.js'; import { Basemaps } from './components/map.js'; @@ -13,6 +14,7 @@ class Page extends Component { return (
+