From bc268d47c1f040e4d1369fd46bca63e8e6eafc41 Mon Sep 17 00:00:00 2001 From: deanchen Date: Wed, 3 May 2023 16:53:39 +0800 Subject: [PATCH] feat: first try for user-profile --- src/pages/_app.js | 29 ++++++++++++++++++----------- src/pages/demo.js | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 11 deletions(-) create mode 100644 src/pages/demo.js diff --git a/src/pages/_app.js b/src/pages/_app.js index f6b423509..7df826c59 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -8,18 +8,18 @@ import { useRouter } from 'next/router'; import Script from 'next/script'; import { userAgentFromString } from 'next/server'; import React from 'react'; +import Layout from 'components/Layout'; +import LayoutDashboard from 'components/LayoutDashboard'; +import LayoutEmbed from 'components/LayoutEmbed'; +import LayoutMobile from 'components/LayoutMobile'; +import LayoutMobileB from 'components/LayoutMobileB'; +import LayoutMobileC from 'components/LayoutMobileC'; +import { DrawerProvider } from 'context/DrawerContext'; +import { ConfigProvider, defaultConfig } from 'context/configContext'; +import { CustomThemeProvider } from 'context/themeContext'; +import { useLocalStorage, useEmbed } from 'hooks/globalHooks'; +import { MapContextProvider } from 'mapContext'; import packageJson from '../../package.json'; -import Layout from '../components/Layout'; -import LayoutDashboard from '../components/LayoutDashboard'; -import LayoutEmbed from '../components/LayoutEmbed'; -import LayoutMobile from '../components/LayoutMobile'; -import LayoutMobileB from '../components/LayoutMobileB'; -import LayoutMobileC from '../components/LayoutMobileC'; -import { DrawerProvider } from '../context/DrawerContext'; -import { ConfigProvider, defaultConfig } from '../context/configContext'; -import { CustomThemeProvider } from '../context/themeContext'; -import { useLocalStorage, useEmbed } from '../hooks/globalHooks'; -import { MapContextProvider } from '../mapContext'; log.warn(`Web Map Client version ${packageJson.version}`); @@ -136,6 +136,13 @@ function TreetrackerApp({ Component, pageProps, device, config }) { nextExtraLoading, }; + const isDemo = !!router.asPath.match(/demo/); + if (isDemo) { + return ( + + ); + } + const isAdmin = !!router.asPath.match(/admin/); if (isAdmin) { return ( diff --git a/src/pages/demo.js b/src/pages/demo.js new file mode 100644 index 000000000..def74263e --- /dev/null +++ b/src/pages/demo.js @@ -0,0 +1,32 @@ +import React from 'react'; + +function Demo() { + const iframeRef = React.useRef(); + + React.useEffect(() => { + // jjiframeRef.current.contentWindow.alert("OK"); + setTimeout(() => { + const {map} = iframeRef.current.contentDocument.querySelector('#map-canvas'); + console.log('map:', map); + map.onClickTree((data) => { + console.log('onClickTree:', data); + }); + }, 5000); + }, []); + + return ( +
+

demo

+