utopia-ui 3.0.1 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -20
- package/dist/Components/AppShell/SideBar.d.ts +1 -0
- package/dist/Components/AppShell/SidebarSubmenu.d.ts +1 -0
- package/dist/Components/Auth/useAuth.d.ts +2 -2
- package/dist/Components/Map/hooks/useClusterRef.d.ts +1 -1
- package/dist/Components/Map/hooks/useSelectPosition.d.ts +1 -1
- package/dist/Components/Profile/Templates/OnepagerForm.d.ts +1 -0
- package/dist/Components/Profile/Templates/OnepagerView.d.ts +1 -1
- package/dist/Components/Profile/Templates/TabsView.d.ts +1 -1
- package/dist/Components/Profile/itemFunctions.d.ts +1 -0
- package/dist/Components/Templates/TagView.d.ts +1 -1
- package/dist/Utils/Moon.d.ts +1 -1
- package/dist/index.js +140 -30
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +5 -2
package/README.md
CHANGED
@@ -10,7 +10,7 @@ Utopia UIs mission is to provide open source building blocks to create beautiful
|
|
10
10
|
|
11
11
|
The building blocks are designed to allow different networks and communities to assemble their map and app for their specific needs and purpose.
|
12
12
|
|
13
|
-
Utopia Game is the
|
13
|
+
Utopia Game is one of the apps made with Utopia UI. It is an attempt to use gamification to get users to take action and make the map even more alive. Check it out at [utopia-game.org](https://utopia-game.org/) or see the code in the [repository](https://github.com/utopia-os/utopia-game)
|
14
14
|
|
15
15
|
## Features
|
16
16
|
|
@@ -23,44 +23,108 @@ Utopia Game is the first app made with Utopia UI. It is an attempt to use gamifi
|
|
23
23
|
|
24
24
|
## Getting Started
|
25
25
|
|
26
|
+
### Basic Map
|
27
|
+
In this tutorial we learn how we create a basic React app with a Map component using [utopia-ui](https://github.com/utopia-os/utopia-ui) library.
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
For this tutorial we use Vite to create an empty React app called "utopia-static-map"
|
30
|
+
|
31
|
+
```shell
|
32
|
+
npm create vite@latest utopia-static-map -- --template react
|
30
33
|
```
|
31
34
|
|
32
|
-
|
33
|
-
The map shows various Layers (like places, events, profiles ...) of Items at their respective position whith nice and informative Popup and Profiles.
|
35
|
+
We open our new app in the terminal and install the [utopia-ui](https://github.com/utopia-os/utopia-ui) package
|
34
36
|
|
35
|
-
|
37
|
+
```shell
|
38
|
+
cd utopia-static-map
|
39
|
+
npm install utopia-ui
|
40
|
+
```
|
41
|
+
|
42
|
+
We open our `src/App.jsx` and we replace the content with
|
36
43
|
|
37
|
-
use the Map UI Component
|
38
44
|
```jsx
|
39
|
-
import { UtopiaMap
|
45
|
+
import { UtopiaMap } from "utopia-ui"
|
46
|
+
|
47
|
+
function App() {
|
48
|
+
return (
|
49
|
+
<UtopiaMap center={[50.6, 9.5]} zoom={5} height='100dvh' width="100dvw">
|
50
|
+
</UtopiaMap>
|
51
|
+
)
|
52
|
+
}
|
53
|
+
|
54
|
+
export default App
|
55
|
+
|
56
|
+
```
|
57
|
+
|
58
|
+
Then we start the development server to check out the result in our browser:
|
59
|
+
|
60
|
+
```shell
|
61
|
+
npm run dev
|
62
|
+
```
|
63
|
+
|
64
|
+
And can open our first map app in the browser 🙂
|
65
|
+
|
66
|
+
### Static Layers
|
67
|
+
|
68
|
+
Now we add some static layer.
|
69
|
+
|
70
|
+
First we put some sample data in a new file called `src/sample-data.js`
|
71
|
+
|
72
|
+
```javascript
|
73
|
+
export const places = [{
|
74
|
+
"id": 51,
|
75
|
+
"name": "Stadtgemüse",
|
76
|
+
"text": "Stadtgemüse Fulda ist eine Gemüsegärtnerei in Maberzell, die es sich zur Aufgabe gemacht hat, die Stadt und seine Bewohner:innen mit regionalem, frischem und natürlich angebautem Gemüse mittels Gemüsekisten zu versorgen. Es gibt also jede Woche, von Frühjahr bis Herbst, angepasst an die Saison eine Kiste mit schmackhaftem und frischem Gemüse für euch, welche ihr direkt vor Ort abholen könnt. \r\n\r\nhttps://stadtgemuese-fulda.de",
|
77
|
+
"position": { "type": "Point", "coordinates": [9.632435, 50.560342] },
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"id": 166,
|
81
|
+
"name": "Weidendom",
|
82
|
+
"text": "free camping",
|
83
|
+
"position": { "type": "Point", "coordinates": [9.438793, 50.560112] },
|
84
|
+
}];
|
85
|
+
|
86
|
+
export const events = [
|
87
|
+
{
|
88
|
+
"id": 423,
|
89
|
+
"name": "Hackathon",
|
90
|
+
"text": "still in progress",
|
91
|
+
"position": { "type": "Point", "coordinates": [10.5, 51.62] },
|
92
|
+
"start": "2022-03-25T12:00:00",
|
93
|
+
"end": "2022-05-12T12:00:00",
|
94
|
+
}
|
95
|
+
]
|
96
|
+
```
|
97
|
+
|
98
|
+
We want to create two Layers. One we want to call *Places* and the other *Events*
|
40
99
|
|
41
|
-
|
100
|
+
we import our sample data to the `src/App.jsx`
|
101
|
+
|
102
|
+
```jsx
|
103
|
+
import { events, places } from "./sample-data"
|
104
|
+
```
|
105
|
+
and than we create our two `<Layer>` inside of our `<UtopiaMap>` component
|
106
|
+
```jsx
|
107
|
+
<UtopiaMap center={[50.6, 15.5]} zoom={5} height='100dvh' width="100dvw">
|
42
108
|
<Layer
|
43
109
|
name='events'
|
44
|
-
menuIcon='CalendarIcon'
|
45
|
-
menuText='add new event'
|
46
|
-
menuColor='#f9a825'
|
47
110
|
markerIcon='calendar'
|
48
111
|
markerShape='square'
|
49
|
-
markerDefaultColor='#
|
112
|
+
markerDefaultColor='#700'
|
50
113
|
data={events} />
|
51
114
|
<Layer
|
52
115
|
name='places'
|
53
|
-
menuIcon='MapPinIcon'
|
54
|
-
menuText='add new place'
|
55
|
-
menuColor='#2E7D32'
|
56
116
|
markerIcon='point'
|
57
117
|
markerShape='circle'
|
58
|
-
markerDefaultColor='#
|
118
|
+
markerDefaultColor='#007'
|
59
119
|
data={places} />
|
60
120
|
</UtopiaMap>
|
121
|
+
|
61
122
|
```
|
62
|
-
You can find some Sample Data (places, events, tags) for test in the `SamleData/` folder
|
63
123
|
|
124
|
+
## Map Component
|
125
|
+
The map shows various Layers (like places, events, profiles ...) of Items at their respective position whith nice and informative Popup and Profiles.
|
126
|
+
|
127
|
+
Tags, colors and clusters help to retain the overview.
|
64
128
|
|
65
129
|
|
66
130
|
### Map Options
|
@@ -90,4 +154,4 @@ You can find some Sample Data (places, events, tags) for test in the `SamleData/
|
|
90
154
|
|
91
155
|
<a href="https://opencollective.com/utopia-project">
|
92
156
|
<img width="300" src="https://opencollective.com/utopia-project/donate/button@2x.png?color=blue" />
|
93
|
-
</a>
|
157
|
+
</a>
|
@@ -14,10 +14,10 @@ declare type AuthContextProps = {
|
|
14
14
|
user: UserItem | null;
|
15
15
|
login: (credentials: AuthCredentials) => Promise<UserItem | undefined>;
|
16
16
|
register: (credentials: AuthCredentials, userName: string) => Promise<UserItem | undefined>;
|
17
|
-
loading:
|
17
|
+
loading: boolean;
|
18
18
|
logout: () => Promise<any>;
|
19
19
|
updateUser: (user: UserItem) => any;
|
20
|
-
token:
|
20
|
+
token: string | null;
|
21
21
|
requestPasswordReset: (email: string, reset_url: string) => Promise<any>;
|
22
22
|
passwordReset: (token: string, new_password: string) => Promise<any>;
|
23
23
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Item, Tag } from '
|
1
|
+
import { Item, Tag } from '../../../types';
|
2
2
|
export declare const TabsView: ({ attestations, userType, item, offers, needs, relations, updatePermission, loading, linkItem, unlinkItem, setUrlParams }: {
|
3
3
|
attestations: Array<any>;
|
4
4
|
userType: string;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import * as React from 'react';
|
1
2
|
export declare const submitNewItem: (evt: any, type: string, item: any, user: any, setLoading: any, tags: any, addTag: any, addItem: any, linkItem: any, resetFilterTags: any, layers: any, addItemPopupType: any, setAddItemPopupType: any) => Promise<void>;
|
2
3
|
export declare const linkItem: (id: string, item: any, updateItem: any) => Promise<void>;
|
3
4
|
export declare const unlinkItem: (id: string, item: any, updateItem: any) => Promise<void>;
|
@@ -2,6 +2,6 @@ import { Tag } from '../../types';
|
|
2
2
|
export declare const TagView: ({ tag, heighlight, onClick, count }: {
|
3
3
|
tag: Tag;
|
4
4
|
heighlight?: boolean | undefined;
|
5
|
-
onClick?: ((
|
5
|
+
onClick?: (() => void) | undefined;
|
6
6
|
count?: number | undefined;
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/dist/Utils/Moon.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export declare const LUNAR_MONTH
|
1
|
+
export declare const LUNAR_MONTH = 29.530588853;
|
2
2
|
export declare const getJulianDate: (date?: Date) => number;
|
3
3
|
export declare const normalize: (value: number) => number;
|
4
4
|
export declare const getLunarAgePercent: (date?: Date) => number;
|