diff --git a/src/ModalContent.tsx b/src/ModalContent.tsx
new file mode 100644
index 00000000..f07f544b
--- /dev/null
+++ b/src/ModalContent.tsx
@@ -0,0 +1,125 @@
+import { useEffect, useState } from 'react'
+
+type ChapterProps = {
+ clickAction?: () => void
+}
+
+
+export function Welcome1({ clickAction }: ChapterProps) {
+ return (
+ <>
+ Welcome, glad you are here!
+
+
+ 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.
+
+
+
+
+ >
+ )
+}
+
+export function Welcome2({ clickAction }: ChapterProps) {
+ return (
+ <>
+ 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.
+
+
+
+
+ >
+ )
+}
+
+export function Welcome3({ clickAction }: ChapterProps) {
+ return (
+ <>
+ 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 the whole mankind.
+
+
+
+
+ Starting to reconnect with our Mother Earth and beginning to question things that long times have been taken for granted.
+
+
+
+
+ >
+ )
+}
+
+export function Welcome4({ clickAction }: ChapterProps) {
+ return (
+ <>
+ Gemeinsam erschaffen wir Strukturen
+
+ - 🥕 Essen & Trinken
+ - 🏡 Wohn- & Lebensraum
+ - 💬 Kommunikation
+ - 💡 Energie
+ - 🚐 Mobilität
+
+
+
+
+ >
+ )
+}
+
+const close = () => {
+ window.my_modal_3.close();
+}
+
+export const ModalContent = () => {
+
+ const [chapter, setChapter] = useState(1);
+ //const setQuestsOpen = useSetQuestOpen()
+
+
+
+ const ActiveChapter = () => {
+ switch (chapter) {
+ case 1:
+ return { setChapter(2) }} />
+ case 2:
+ return { setChapter(3) }} />
+ case 3:
+ return {
+
+ close();
+ setTimeout(() => {
+ // setQuestsOpen(true);
+ setChapter(1);
+ }, 1000);
+
+ }} />
+ default: return <>>
+ };
+ };
+
+ return (
+
+ )
+}
diff --git a/src/api/directus.ts b/src/api/directus.ts
index 1d63f44c..56c43be0 100644
--- a/src/api/directus.ts
+++ b/src/api/directus.ts
@@ -1,8 +1,6 @@
import { createDirectus, rest, authentication, AuthenticationData, AuthenticationStorage } from '@directus/sdk';
import { Point } from 'geojson'
-
-
export type Place = {
id: string;
name: string;
@@ -33,9 +31,27 @@ export type Place = {
end: Date;
};
+ export type Update = {
+ id: string;
+ text: string;
+ position?: Point;
+ user_created: string;
+ date_created: string;
+ }
+
+ type CustomUserFields = {
+ position: Point;
+ };
+
+
export type MyCollections = {
- places: Place;
- events: Event;
+ places: Place[];
+ events: Event[];
+ updates: Update[];
+ tags: Tag[];
+ projects: Project[];
+ directus_users: CustomUserFields[];
+
};
@@ -64,7 +80,6 @@ export type Place = {
}
export const directusClient = createDirectus("https://api.utopia-lab.org/")
- .with(authentication())
.with(rest())
.with(authentication('json', { // add this if you want to use authentication, json is important, it's type of your authentication usage, here JWT
storage: authLocalStorage(), // here set the storage previously created
diff --git a/src/api/itemsApi.ts b/src/api/itemsApi.ts
index c6a10770..33864eee 100644
--- a/src/api/itemsApi.ts
+++ b/src/api/itemsApi.ts
@@ -14,7 +14,7 @@ export class itemsApi implements ItemsApi{
async getItems() {
try {
- return await directusClient.request(readItems(this.collectionName as never, { limit: 500 }));
+ return await directusClient.request(readItems(this.collectionName as never, { fields: ['*', { user_created: ['*'] }], limit: 500 }));
} catch (error: any) {
console.log(error);
if (error.errors[0]?.message)
diff --git a/src/api/updatesApi.ts b/src/api/updatesApi.ts
new file mode 100644
index 00000000..3928d0b1
--- /dev/null
+++ b/src/api/updatesApi.ts
@@ -0,0 +1,53 @@
+import { readItems,updateItem} from '@directus/sdk';
+import { directusClient } from './directus';
+import { Point } from 'geojson';
+
+
+export class updatesApi{
+
+ collectionName: string;
+
+ constructor(collectionName: string) {
+ this.collectionName = collectionName;
+ }
+
+ async getItems() {
+ try {
+ return await directusClient.request(readItems("updates",{
+ fields: ['*', { user_created: ['*'] }],
+ }));
+ } catch (error: any) {
+ console.log(error);
+ if (error.errors[0]?.message)
+ throw error.errors[0].message;
+ else throw error;
+ }
+ }
+
+
+
+ //setting geoposition
+ async createItem(item: T & { id?: string, position?: Point }) {
+ try {
+ return await directusClient.request(updateItem("updates",item.id!,{position: item.position}))
+ } catch (error: any) {
+ console.log(error);
+ if (error.errors[0]?.message)
+ throw error.errors[0].message;
+ else throw error;
+ }
+ }
+
+
+ //setting geoposition to null
+ async deleteItem(id: string) {
+ try {
+ return await directusClient.request(updateItem("updates",id,{position: undefined}))
+ } catch (error: any) {
+ console.log(error);
+ if (error.errors[0].message)
+ throw error.errors[0].message;
+ else throw error;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/pages/MapContainer.tsx b/src/pages/MapContainer.tsx
index e7628ce0..6077e73c 100644
--- a/src/pages/MapContainer.tsx
+++ b/src/pages/MapContainer.tsx
@@ -1,5 +1,5 @@
-import { UtopiaMap, Tags, Layer, ItemForm, ItemView, PopupTextAreaInput, PopupStartEndInput, TextView, StartEndView, Permissions } from 'utopia-ui'
-import { itemsApi } from '../api/itemsApi'
+import { UtopiaMap, Tags, Layer, ItemForm, ItemView, PopupTextAreaInput, PopupTextInput, PopupStartEndInput, TextView, StartEndView, Permissions } from 'utopia-ui'
+import { itemsApi } from '../api/itemsApi';
import { permissionsApi } from '../api/permissionsApi';
import { Place, Event, Tag } from '../api/directus';
import { useEffect, useState } from 'react';
@@ -11,6 +11,7 @@ function MapContainer() {
const [eventsApi, setEventsApi] = useState>();
const [tagsApi, setTagsApi] = useState>();
const [permissionsApiInstance, setPermissionsApiInstance] = useState();
+ const [updatesApiInstance, setUpdatesApiInstance] = useState>();
@@ -21,15 +22,9 @@ function MapContainer() {
setEventsApi(new itemsApi('events'));
setTagsApi(new itemsApi('tags'));
setPermissionsApiInstance(new permissionsApi());
-
-
-
+ setUpdatesApiInstance(new itemsApi('updates'));
}, []);
-
-
-
-
return (
@@ -42,9 +37,9 @@ function MapContainer() {
markerShape='square'
markerDefaultColor='#777'
// data={events}
- api={eventsApi}
- >
+ api={eventsApi}>
+
@@ -52,7 +47,6 @@ function MapContainer() {
-
+ api={placesApi} />
+
+
+
+
+
+
+
+
diff --git a/src/pages/ProfileView.tsx b/src/pages/ProfileView.tsx
new file mode 100644
index 00000000..170d2c65
--- /dev/null
+++ b/src/pages/ProfileView.tsx
@@ -0,0 +1,42 @@
+import { useState, useEffect } from "react";
+import { itemsApi } from "../api/itemsApi";
+import { Project } from '../api/directus'
+import { useLocation } from "react-router-dom";
+import { CardPage } from "utopia-ui";
+
+export const ProjectView = () => {
+
+ const [projectsApi, setProjectsApi] = useState>();
+ const [project, setProject] = useState();
+
+ let location = useLocation();
+
+
+ const loadProject = async () => {
+ const project: unknown = await projectsApi?.getItem(location.pathname.split("/")[2]);
+ setProject(project as Project);
+
+ }
+
+ useEffect(() => {
+ setProjectsApi(new itemsApi('projects'));
+ }, [])
+
+ useEffect(() => {
+ loadProject();
+ }, [projectsApi])
+
+ return (
+
+ {project &&
+ <>
+
+ {project?.subname}
+ {project?.text}
+ >
+
+ }
+
+
+ )
+}
diff --git a/src/pages/Projects.tsx b/src/pages/Projects.tsx
index 650c41df..6763d14b 100644
--- a/src/pages/Projects.tsx
+++ b/src/pages/Projects.tsx
@@ -1,4 +1,4 @@
-import { TitleCard, useAuth } from 'utopia-ui'
+import { TitleCard } from 'utopia-ui'
import { useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import { itemsApi } from '../api/itemsApi'
@@ -16,7 +16,6 @@ export default function Projects() {
const loadProjects = async () => {
const projects = await projectsApi?.getItems();
setProjects(projects as Project[]);
-
}
useEffect(() => {
@@ -28,8 +27,6 @@ export default function Projects() {
loadProjects();
}, [projectsApi])
-const {token,isAuthenticated} = useAuth();
-
return (
@@ -56,7 +53,7 @@ const {token,isAuthenticated} = useAuth();
return (
-
+
{i.subname}
{i.text}