Skip to content

Commit

Permalink
feat: first try for user-profile
Browse files Browse the repository at this point in the history
  • Loading branch information
dadiorchen committed May 3, 2023
1 parent 696f72a commit bc268d4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Expand Down Expand Up @@ -136,6 +136,13 @@ function TreetrackerApp({ Component, pageProps, device, config }) {
nextExtraLoading,
};

const isDemo = !!router.asPath.match(/demo/);
if (isDemo) {
return (
<Component {...pageProps} {...extraProps} />
);
}

const isAdmin = !!router.asPath.match(/admin/);
if (isAdmin) {
return (
Expand Down
32 changes: 32 additions & 0 deletions src/pages/demo.js
Original file line number Diff line number Diff line change
@@ -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 (
<div>
<h1>demo</h1>
<iframe
id="treetracker-iframe"
title="treetracker"
ref={iframeRef}
src="http://localhost:3000/"
width="800px"
height="600px"
/>
</div>
);
}
Demo.isCLayout = true;
export default Demo;

0 comments on commit bc268d4

Please sign in to comment.