diff --git a/package-lock.json b/package-lock.json index 6c9cc64c..21979367 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,11 +18,9 @@ "react-string-replace": "^1.1.1", "react-toastify": "^9.1.3", "tributejs": "^5.1.3", - "tw-elements": "^1.0.0-beta2" + "tw-elements": "^1.0.0" }, "devDependencies": { - "@rollup/plugin-commonjs": "^25.0.4", - "@rollup/plugin-dynamic-import-vars": "^2.0.5", "@types/leaflet": "^1.7.11", "@types/react": "^18.0.14", "@types/react-dom": "^18.0.5", @@ -255,117 +253,6 @@ "node": ">=14.0.0" } }, - "node_modules/@rollup/plugin-commonjs": { - "version": "25.0.4", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.4.tgz", - "integrity": "sha512-L92Vz9WUZXDnlQQl3EwbypJR4+DM2EbsO+/KOcEkP4Mc6Ct453EeDB2uH9lgRwj4w5yflgNpq9pHOiY8aoUXBQ==", - "dev": true, - "dependencies": { - "@rollup/pluginutils": "^5.0.1", - "commondir": "^1.0.1", - "estree-walker": "^2.0.2", - "glob": "^8.0.3", - "is-reference": "1.2.1", - "magic-string": "^0.27.0" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^2.68.0||^3.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/plugin-commonjs/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@rollup/plugin-commonjs/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@rollup/plugin-commonjs/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@rollup/plugin-dynamic-import-vars": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@rollup/plugin-dynamic-import-vars/-/plugin-dynamic-import-vars-2.0.5.tgz", - "integrity": "sha512-YNKbZ5Y08DwWHbcqcn5BOxf/X9lVV2fYiL0247k76rL/XNx6xQX0Tti6cCoA2jXhBQdBcDjsFTFoT3nl4QJmWg==", - "dev": true, - "dependencies": { - "@rollup/pluginutils": "^5.0.1", - "astring": "^1.8.5", - "estree-walker": "^2.0.2", - "fast-glob": "^3.2.12", - "magic-string": "^0.27.0" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/pluginutils": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.4.tgz", - "integrity": "sha512-0KJnIoRI8A+a1dqOYLxH8vBf8bphDmty5QvIm2hqm7oFCFYKCAZWWd2hXgMibaPsNDhI0AtpYfQZJG47pt/k4g==", - "dev": true, - "dependencies": { - "@types/estree": "^1.0.0", - "estree-walker": "^2.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, "node_modules/@trysound/sax": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", @@ -375,12 +262,6 @@ "node": ">=10.13.0" } }, - "node_modules/@types/estree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", - "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==", - "dev": true - }, "node_modules/@types/geojson": { "version": "7946.0.8", "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.8.tgz", @@ -787,15 +668,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/astring": { - "version": "1.8.6", - "resolved": "https://registry.npmjs.org/astring/-/astring-1.8.6.tgz", - "integrity": "sha512-ISvCdHdlTDlH5IpxQJIex7BWBywFWgjJSVdwst+/iQCoEYnyOaQ95+X1JGshuBjGp6nxKUy1jMgE3zPqN7fQdg==", - "dev": true, - "bin": { - "astring": "bin/astring" - } - }, "node_modules/autoprefixer": { "version": "10.4.14", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.14.tgz", @@ -939,9 +811,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001478", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001478.tgz", - "integrity": "sha512-gMhDyXGItTHipJj2ApIvR+iVB5hd0KP3svMWWXDvZOmjzJJassGLMfxRkQCSYgGd2gtdL/ReeiyvMSFD1Ss6Mw==", + "version": "1.0.30001547", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001547.tgz", + "integrity": "sha512-W7CrtIModMAxobGhz8iXmDfuJiiKg1WADMO/9x7/CLNin5cpSbuBjooyoIUVB5eyCc36QuTVlkVa1iB2S5+/eA==", "dev": true, "funding": [ { @@ -2525,15 +2397,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-reference": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", - "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", - "dev": true, - "dependencies": { - "@types/estree": "*" - } - }, "node_modules/is-regex": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", @@ -2785,18 +2648,6 @@ "node": ">=10" } }, - "node_modules/magic-string": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", - "integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==", - "dev": true, - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.13" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -4683,9 +4534,9 @@ "dev": true }, "node_modules/tw-elements": { - "version": "1.0.0-beta2", - "resolved": "https://registry.npmjs.org/tw-elements/-/tw-elements-1.0.0-beta2.tgz", - "integrity": "sha512-0DAm5i7OSk1NCW9i/JotHZOWG0NIuCBr5S0t1h66rDgH1M2fxCQvvQw3AxK0fVaCJG0jk82UhAsI7PCEMoq6Xw==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/tw-elements/-/tw-elements-1.0.0.tgz", + "integrity": "sha512-pD2bA1bTGzvigU79dz4pGvO207CCOpzhwlxzb7hswx40SMMkJISOkoDxU2ot3OQ7LTZM5GwuLDkZ+dquK0wdYQ==", "dependencies": { "@popperjs/core": "^2.6.0", "chart.js": "^3.7.1", diff --git a/src/Components/AppShell/AppShell.tsx b/src/Components/AppShell/AppShell.tsx index ec6a63b6..809a2d56 100644 --- a/src/Components/AppShell/AppShell.tsx +++ b/src/Components/AppShell/AppShell.tsx @@ -2,24 +2,27 @@ import * as React from 'react' import NavBar from './NavBar' import { BrowserRouter } from 'react-router-dom' import { ToastContainer } from 'react-toastify' +import { QuestsProvider } from '../Gaming/hooks/useQuests' export function AppShell({ appName, children }) { return ( - - -
- {children} -
+ + + +
+ {children} +
+
) } diff --git a/src/Components/Gaming/Modal.tsx b/src/Components/Gaming/Modal.tsx index 035a74fa..4687f8d6 100644 --- a/src/Components/Gaming/Modal.tsx +++ b/src/Components/Gaming/Modal.tsx @@ -1,5 +1,6 @@ import { useState } from "react" import * as React from "react" +import { useSetQuestOpen } from "./hooks/useQuests" type ChapterProps = { clickAction?: () => void @@ -10,15 +11,17 @@ export function Welcome1({ clickAction }: ChapterProps) { return ( <>

Welcome, glad you are here!

-

- Let's play a game together where we explore ourselves and our dreams and come together to make them come true. -

- Would you like to join us?

+ +

+ In the 21st century, humanity is at a special point in its history. +

+

+ On the one hand, the people of Planet Earth are facing a multitude of fundamental crises. +

+

+ On the other hand, we have all the knowledge and technology to heal the planet and live in harmony with Mother Earth.

- - - - +
@@ -28,12 +31,21 @@ export function Welcome1({ clickAction }: ChapterProps) { export function Welcome2({ clickAction }: ChapterProps) { return ( <> -

Imagine ...

-

- you wake up sometime in the early twenties of the 21st century on planet Earth from a hypnosis that has somehow kept you and all other people under some kind of external control all your life. +

Hypnosis and Disillusion

+ +

+ Most people are still stuck in old ways of thinking and living.

+ + +

+ Hypnotised, they sit in front of screens in concrete blocks, flooded and disillusioned by irrelevant information.

+ +

+ From an early age, they are trained to do alienated work and consume unhealthy and meaningless products. +

- +
) @@ -42,11 +54,19 @@ export function Welcome2({ clickAction }: ChapterProps) { export function Welcome3({ clickAction }: ChapterProps) { return ( <> -

Many people ...

-

- are still trapped in old and dysfunctional structures. But magically, a new consciousness is suddenly rising. More and more people are awakening from hypnosis.

+

But Consciousness is rising

+

+ More and more people are waking up to what's really happening.

+

+ They are in the process of understanding the potential that is within themselves and within true community. +

+ + +

+ Starting to reconnect with our Mother Earth and beginning to question things that have been taken for granted. +

- +
) @@ -78,6 +98,7 @@ const close = () => { export function Modal() { const [chapter, setChapter] = useState(1); + const setQuestsOpen = useSetQuestOpen(); @@ -91,6 +112,10 @@ export function Modal() { return { setChapter(1); close(); + setTimeout(() => { + setQuestsOpen(true); + }, 1000); + }} /> default: return <> }; diff --git a/src/Components/Gaming/Quests.tsx b/src/Components/Gaming/Quests.tsx index fb7d7d02..f0a6604d 100644 --- a/src/Components/Gaming/Quests.tsx +++ b/src/Components/Gaming/Quests.tsx @@ -1,32 +1,42 @@ import * as React from 'react' +import { useQuestsOpen, useSetQuestOpen } from './hooks/useQuests'; +import { useEffect } from 'react'; import { useAuth } from '../Auth'; export function Quests() { - const [open, setOpen] = React.useState(true); - + const questsOpen = useQuestsOpen(); + const setQuestsOpen = useSetQuestOpen(); const { isAuthenticated, user } = useAuth(); - if (open) return ( - <> + + + useEffect(() => { + console.log(questsOpen); + + }, [questsOpen]) + + + return ( + <>{questsOpen?
- +

Level 1

    -
  • -
  • +
  • -
  • +
-
+{ /** */ +}
+ : "" + } ) - else return ( - <> - ) + } diff --git a/src/Components/Gaming/hooks/useQuests.tsx b/src/Components/Gaming/hooks/useQuests.tsx new file mode 100644 index 00000000..6d845bd4 --- /dev/null +++ b/src/Components/Gaming/hooks/useQuests.tsx @@ -0,0 +1,50 @@ +import { useCallback, useState } from 'react'; + + +import { createContext, useContext } from "react"; +import * as React from "react"; + + + +type UseQuestManagerResult = ReturnType; + +const QuestContext = createContext({ + open: false, + setQuestsOpen: () => { } +}); + +function useQuestsManager(initialOpen: boolean): { + open: boolean; + setQuestsOpen: (open: boolean) => void; +} { + const [open, setOpen] = useState(initialOpen); + + + + const setQuestsOpen = useCallback((questOpen: boolean) => { + setOpen(questOpen); + console.log(open); + + }, []); + + return { open, setQuestsOpen }; +} + +export const QuestsProvider: React.FunctionComponent<{ + initialOpen: boolean, children?: React.ReactNode +}> = ({ initialOpen, children }) => ( + + {children} + +); + +export const useQuestsOpen = (): boolean => { + const { open } = useContext(QuestContext); + return open; +}; + + +export const useSetQuestOpen = (): UseQuestManagerResult["setQuestsOpen"] => { + const { setQuestsOpen } = useContext(QuestContext); + return setQuestsOpen; +} diff --git a/src/Components/Map/Subcomponents/Control.tsx b/src/Components/Map/Subcomponents/Control.tsx new file mode 100644 index 00000000..d6d564a6 --- /dev/null +++ b/src/Components/Map/Subcomponents/Control.tsx @@ -0,0 +1,7 @@ +import * as React from 'react' + +export const Control = ({children}) => { + return ( +
{children}
+ ) +} diff --git a/src/Components/Map/Subcomponents/LayerControl.tsx b/src/Components/Map/Subcomponents/LayerControl.tsx index 2ec5f7e4..10df9a16 100644 --- a/src/Components/Map/Subcomponents/LayerControl.tsx +++ b/src/Components/Map/Subcomponents/LayerControl.tsx @@ -21,11 +21,11 @@ export function LayerControl() { const addVisibleLayer = useAddVisibleLayer(); return ( -
e.stopPropagation()}> +
e.stopPropagation()}> { open ? -
e.stopPropagation()}> - +
e.stopPropagation()}> +
    { @@ -38,9 +38,10 @@ export function LayerControl() {
: -
setOpen(true)}> - - +
setOpen(true)}> + + +
diff --git a/src/Components/Map/Subcomponents/QuestControl.tsx b/src/Components/Map/Subcomponents/QuestControl.tsx new file mode 100644 index 00000000..9b676c2b --- /dev/null +++ b/src/Components/Map/Subcomponents/QuestControl.tsx @@ -0,0 +1,23 @@ +import * as React from 'react' +import { useQuestsOpen, useSetQuestOpen } from '../../Gaming/hooks/useQuests'; + + +export function QuestControl() { + + const questsOpen = useQuestsOpen(); + const setQuestsOpen = useSetQuestOpen(); + + return ( + <> + {questsOpen ? "" : +
e.stopPropagation()}> + +
setQuestsOpen(true)}> + +
+ +
+ } + + ) +} diff --git a/src/Components/Map/UtopiaMap.tsx b/src/Components/Map/UtopiaMap.tsx index 6cdeb19b..12be0bd6 100644 --- a/src/Components/Map/UtopiaMap.tsx +++ b/src/Components/Map/UtopiaMap.tsx @@ -16,6 +16,9 @@ import { FilterControl } from "./Subcomponents/FilterControl"; import { PermissionsProvider } from "./hooks/usePermissions"; import { LeafletRefsProvider } from "./hooks/useLeafletRefs"; import { LayerControl } from "./Subcomponents/LayerControl"; +import { QuestControl } from "./Subcomponents/QuestControl"; +import { Quests } from "../Gaming"; +import { Control } from "./Subcomponents/Control"; export interface MapEventListenerProps { @@ -75,35 +78,37 @@ function UtopiaMap({ -
- - - - - - - { - React.Children.toArray(children).map((child) => - React.isValidElement<{ setItemFormPopup: React.Dispatch>, itemFormPopup: ItemFormPopupProps | null, clusterRef: React.MutableRefObject }>(child) ? - React.cloneElement(child, { setItemFormPopup: setItemFormPopup, itemFormPopup: itemFormPopup, clusterRef: clusterRef }) : child - ) - } - - - - - {selectNewItemPosition != null && -
-
-
- Select {selectNewItemPosition.name} position! +
+ + + + + + + + + { + React.Children.toArray(children).map((child) => + React.isValidElement<{ setItemFormPopup: React.Dispatch>, itemFormPopup: ItemFormPopupProps | null, clusterRef: React.MutableRefObject }>(child) ? + React.cloneElement(child, { setItemFormPopup: setItemFormPopup, itemFormPopup: itemFormPopup, clusterRef: clusterRef }) : child + ) + } + + + + + {selectNewItemPosition != null && +
+
+
+ Select {selectNewItemPosition.name} position! +
-
- } -
+ } +