@eventvisor/catalog 0.0.2 → 0.21.1
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/CHANGELOG.md +122 -0
- package/LICENSE +21 -0
- package/README.md +9 -0
- package/components.json +22 -0
- package/dist/assets/index-B8NMB5dQ.js +24 -0
- package/dist/assets/index-DdncAyM-.css +1 -0
- package/dist/catalog.json +297 -0
- package/dist/img/logo-text.png +0 -0
- package/dist/img/logo.png +0 -0
- package/dist/index.html +13 -0
- package/index.html +12 -0
- package/package.json +37 -16
- package/public/catalog.json +297 -0
- package/public/img/logo-text.png +0 -0
- package/public/img/logo.png +0 -0
- package/src/blocks/alert.tsx +30 -0
- package/src/blocks/content.tsx +43 -0
- package/src/blocks/last-modified.tsx +26 -0
- package/src/blocks/links.tsx +42 -0
- package/src/blocks/markdown.tsx +10 -0
- package/src/blocks/navbar.tsx +46 -0
- package/src/blocks/page-attributes-view.tsx +127 -0
- package/src/blocks/page-attributes.tsx +80 -0
- package/src/blocks/page-destinations-view.tsx +134 -0
- package/src/blocks/page-destinations.tsx +80 -0
- package/src/blocks/page-effects-view.tsx +139 -0
- package/src/blocks/page-effects.tsx +80 -0
- package/src/blocks/page-events-view.tsx +147 -0
- package/src/blocks/page-events.tsx +80 -0
- package/src/blocks/pretty-date.tsx +52 -0
- package/src/blocks/properties.tsx +170 -0
- package/src/blocks/root.tsx +116 -0
- package/src/blocks/search-input.tsx +32 -0
- package/src/blocks/tabs.tsx +47 -0
- package/src/blocks/tag.tsx +13 -0
- package/src/contexts/index.ts +4 -0
- package/src/hooks/index.ts +98 -0
- package/src/main.tsx +13 -0
- package/src/styles.css +126 -0
- package/src/utils/index.ts +171 -0
- package/tsconfig.json +30 -0
- package/tsconfig.node.json +11 -0
- package/vite.config.ts +15 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
{
|
|
2
|
+
"links": {
|
|
3
|
+
"attribute": "https://github.com/eventvisor/eventvisor/blob/catalog-attributes/projects/project-1/attributes/{{name}}.yml",
|
|
4
|
+
"event": "https://github.com/eventvisor/eventvisor/blob/catalog-attributes/projects/project-1/events/{{name}}.yml",
|
|
5
|
+
"destination": "https://github.com/eventvisor/eventvisor/blob/catalog-attributes/projects/project-1/destinations/{{name}}.yml",
|
|
6
|
+
"effect": "https://github.com/eventvisor/eventvisor/blob/catalog-attributes/projects/project-1/effects/{{name}}.yml",
|
|
7
|
+
"commit": "https://github.com/eventvisor/eventvisor/commit/{{hash}}"
|
|
8
|
+
},
|
|
9
|
+
"projectConfig": { "tags": ["web", "mobile"] },
|
|
10
|
+
"entities": {
|
|
11
|
+
"attributes": {
|
|
12
|
+
"country": {
|
|
13
|
+
"description": "Country attribute",
|
|
14
|
+
"tags": ["web"],
|
|
15
|
+
"type": "string",
|
|
16
|
+
"lastModified": {
|
|
17
|
+
"commit": "2e90890",
|
|
18
|
+
"timestamp": "2025-09-29T23:00:33+02:00",
|
|
19
|
+
"author": "Fahad Heylaal"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"testDefaultValue": {
|
|
23
|
+
"description": "User attribute",
|
|
24
|
+
"tags": ["web"],
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"id": { "type": "string", "description": "The user's ID" },
|
|
28
|
+
"country": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "The user's country in ISO 3166-1 alpha-2 format, like \"NL\" or \"DE\""
|
|
31
|
+
},
|
|
32
|
+
"isHuman": { "type": "boolean", "default": true },
|
|
33
|
+
"consentToMarketing": { "type": "boolean", "default": false },
|
|
34
|
+
"isSubscribed": { "type": "boolean", "default": false }
|
|
35
|
+
},
|
|
36
|
+
"required": ["id", "country"],
|
|
37
|
+
"lastModified": {
|
|
38
|
+
"commit": "2e90890",
|
|
39
|
+
"timestamp": "2025-09-29T23:00:33+02:00",
|
|
40
|
+
"author": "Fahad Heylaal"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"testNested": {
|
|
44
|
+
"description": "Test nested attribute",
|
|
45
|
+
"tags": ["web"],
|
|
46
|
+
"type": "object",
|
|
47
|
+
"properties": {
|
|
48
|
+
"foo": { "type": "string" },
|
|
49
|
+
"user": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"properties": {
|
|
52
|
+
"id": { "type": "string", "description": "The user's ID" },
|
|
53
|
+
"name": { "type": "string", "description": "User's name" },
|
|
54
|
+
"address": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"street": { "type": "string", "description": "User's street" },
|
|
58
|
+
"city": { "type": "string", "description": "User's city" },
|
|
59
|
+
"zip": { "type": "string", "description": "User's zip" },
|
|
60
|
+
"country": { "type": "string", "description": "User's country" }
|
|
61
|
+
},
|
|
62
|
+
"required": ["street", "city", "country"]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": ["user"],
|
|
68
|
+
"lastModified": {
|
|
69
|
+
"commit": "b97d430",
|
|
70
|
+
"timestamp": "2025-10-28T22:40:20+01:00",
|
|
71
|
+
"author": "Fahad Heylaal"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"testRequired": {
|
|
75
|
+
"description": "Test required attribute",
|
|
76
|
+
"tags": ["web"],
|
|
77
|
+
"type": "object",
|
|
78
|
+
"properties": {
|
|
79
|
+
"id": { "type": "string", "description": "The user's ID" },
|
|
80
|
+
"country": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "The user's country in ISO 3166-1 alpha-2 format, like \"NL\" or \"DE\""
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"required": ["id", "country"],
|
|
86
|
+
"lastModified": {
|
|
87
|
+
"commit": "2e90890",
|
|
88
|
+
"timestamp": "2025-09-29T23:00:33+02:00",
|
|
89
|
+
"author": "Fahad Heylaal"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"testTransformConcat": {
|
|
93
|
+
"description": "Test transformed attribute",
|
|
94
|
+
"tags": ["web"],
|
|
95
|
+
"type": "object",
|
|
96
|
+
"properties": {
|
|
97
|
+
"id": { "type": "string", "description": "The user's ID" },
|
|
98
|
+
"firstName": { "type": "string" },
|
|
99
|
+
"lastName": { "type": "string" }
|
|
100
|
+
},
|
|
101
|
+
"required": ["id", "firstName", "lastName"],
|
|
102
|
+
"transforms": [
|
|
103
|
+
{
|
|
104
|
+
"payload": ["firstName", "lastName"],
|
|
105
|
+
"type": "concat",
|
|
106
|
+
"separator": " ",
|
|
107
|
+
"target": "fullName"
|
|
108
|
+
},
|
|
109
|
+
{ "type": "remove", "target": "firstName" },
|
|
110
|
+
{ "type": "remove", "target": "lastName" }
|
|
111
|
+
],
|
|
112
|
+
"lastModified": {
|
|
113
|
+
"commit": "2e90890",
|
|
114
|
+
"timestamp": "2025-09-29T23:00:33+02:00",
|
|
115
|
+
"author": "Fahad Heylaal"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"testTransformRename": {
|
|
119
|
+
"description": "Test transformed attribute",
|
|
120
|
+
"tags": ["web"],
|
|
121
|
+
"type": "object",
|
|
122
|
+
"properties": {
|
|
123
|
+
"id": { "type": "string", "description": "The user's ID" },
|
|
124
|
+
"name": { "type": "string" }
|
|
125
|
+
},
|
|
126
|
+
"required": ["id", "name"],
|
|
127
|
+
"transforms": [{ "type": "rename", "targetMap": { "name": "fullName" } }],
|
|
128
|
+
"lastModified": {
|
|
129
|
+
"commit": "2e90890",
|
|
130
|
+
"timestamp": "2025-09-29T23:00:33+02:00",
|
|
131
|
+
"author": "Fahad Heylaal"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"testTransformTo": {
|
|
135
|
+
"description": "Test transformed attribute",
|
|
136
|
+
"tags": ["web"],
|
|
137
|
+
"type": "object",
|
|
138
|
+
"properties": {
|
|
139
|
+
"id": { "type": "string", "description": "The user's ID" },
|
|
140
|
+
"firstName": { "type": "string" },
|
|
141
|
+
"lastName": { "type": "string" },
|
|
142
|
+
"age": { "type": "string" },
|
|
143
|
+
"isHuman": { "type": "string" },
|
|
144
|
+
"balance": { "type": "string" },
|
|
145
|
+
"itemsCount": { "type": "number" }
|
|
146
|
+
},
|
|
147
|
+
"required": ["id", "firstName", "lastName"],
|
|
148
|
+
"transforms": [
|
|
149
|
+
{ "type": "toInteger", "target": "age" },
|
|
150
|
+
{ "type": "toBoolean", "target": "isHuman" },
|
|
151
|
+
{ "type": "toDouble", "target": "balance" },
|
|
152
|
+
{ "type": "toString", "target": "itemsCount" }
|
|
153
|
+
],
|
|
154
|
+
"lastModified": {
|
|
155
|
+
"commit": "2e90890",
|
|
156
|
+
"timestamp": "2025-09-29T23:00:33+02:00",
|
|
157
|
+
"author": "Fahad Heylaal"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"testTransformTrim": {
|
|
161
|
+
"description": "Test transformed attribute",
|
|
162
|
+
"tags": ["web"],
|
|
163
|
+
"type": "object",
|
|
164
|
+
"properties": {
|
|
165
|
+
"id": { "type": "string", "description": "The user's ID" },
|
|
166
|
+
"firstName": { "type": "string" },
|
|
167
|
+
"lastName": { "type": "string" }
|
|
168
|
+
},
|
|
169
|
+
"required": ["id", "firstName", "lastName"],
|
|
170
|
+
"transforms": [
|
|
171
|
+
{ "type": "trim", "target": "firstName" },
|
|
172
|
+
{ "payload": "lastName", "type": "trim", "target": "lastName" }
|
|
173
|
+
],
|
|
174
|
+
"lastModified": {
|
|
175
|
+
"commit": "2e90890",
|
|
176
|
+
"timestamp": "2025-09-29T23:00:33+02:00",
|
|
177
|
+
"author": "Fahad Heylaal"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"userId": {
|
|
181
|
+
"description": "User ID attribute",
|
|
182
|
+
"tags": ["web"],
|
|
183
|
+
"type": "string",
|
|
184
|
+
"lastModified": {
|
|
185
|
+
"commit": "2e90890",
|
|
186
|
+
"timestamp": "2025-09-29T23:00:33+02:00",
|
|
187
|
+
"author": "Fahad Heylaal"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"events": {
|
|
192
|
+
"banner_click": {
|
|
193
|
+
"description": "Banner click description here",
|
|
194
|
+
"tags": ["web"],
|
|
195
|
+
"type": "object",
|
|
196
|
+
"properties": {
|
|
197
|
+
"bannerId": { "type": "string", "description": "The ID of the banner that was clicked" },
|
|
198
|
+
"screenWidth": { "type": "number", "description": "The width of the screen" }
|
|
199
|
+
},
|
|
200
|
+
"required": ["bannerId"],
|
|
201
|
+
"transforms": [
|
|
202
|
+
{
|
|
203
|
+
"lookup": "browser.screen.width",
|
|
204
|
+
"type": "set",
|
|
205
|
+
"target": "screenWidth",
|
|
206
|
+
"conditions": [{ "payload": "screenWidth", "operator": "notExists" }]
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"lastModified": {
|
|
210
|
+
"commit": "30690e7",
|
|
211
|
+
"timestamp": "2025-10-19T23:42:22+02:00",
|
|
212
|
+
"author": "Fahad Heylaal"
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"button_click": {
|
|
216
|
+
"description": "Button click",
|
|
217
|
+
"tags": ["web"],
|
|
218
|
+
"type": "object",
|
|
219
|
+
"properties": {
|
|
220
|
+
"buttonId": { "type": "string", "description": "The ID of the button that was clicked" },
|
|
221
|
+
"buttonType": { "type": "string", "description": "The type of button that was clicked" },
|
|
222
|
+
"buttonText": {
|
|
223
|
+
"type": "string",
|
|
224
|
+
"description": "The text of the button that was clicked"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"required": ["buttonId"],
|
|
228
|
+
"lastModified": {
|
|
229
|
+
"commit": "2e90890",
|
|
230
|
+
"timestamp": "2025-09-29T23:00:33+02:00",
|
|
231
|
+
"author": "Fahad Heylaal"
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
"page_view": {
|
|
235
|
+
"description": "Page view",
|
|
236
|
+
"tags": ["web"],
|
|
237
|
+
"type": "object",
|
|
238
|
+
"properties": {
|
|
239
|
+
"url": { "type": "string", "description": "The URL of the page that was viewed" },
|
|
240
|
+
"referrer": {
|
|
241
|
+
"type": "string",
|
|
242
|
+
"description": "The URL of the page that referred the user to the current page"
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"required": ["url"],
|
|
246
|
+
"lastModified": {
|
|
247
|
+
"commit": "2e90890",
|
|
248
|
+
"timestamp": "2025-09-29T23:00:33+02:00",
|
|
249
|
+
"author": "Fahad Heylaal"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
"destinations": {
|
|
254
|
+
"consoleSimple": {
|
|
255
|
+
"description": "Console destination",
|
|
256
|
+
"tags": ["web"],
|
|
257
|
+
"transport": "console",
|
|
258
|
+
"transforms": [
|
|
259
|
+
{ "type": "set", "value": {} },
|
|
260
|
+
{ "source": "attributes", "type": "set", "target": "attributes" },
|
|
261
|
+
{ "source": "payload", "type": "set", "target": "payload" },
|
|
262
|
+
{ "source": "eventName", "type": "set", "target": "payload.eventName" }
|
|
263
|
+
],
|
|
264
|
+
"lastModified": {
|
|
265
|
+
"commit": "2e90890",
|
|
266
|
+
"timestamp": "2025-09-29T23:00:33+02:00",
|
|
267
|
+
"author": "Fahad Heylaal"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"effects": {
|
|
272
|
+
"inject_cookie_banner": {
|
|
273
|
+
"description": "Inject cookie banner",
|
|
274
|
+
"tags": ["web"],
|
|
275
|
+
"on": { "event_tracked": ["page_view"] },
|
|
276
|
+
"state": { "injected": false },
|
|
277
|
+
"conditions": [{ "state": "injected", "operator": "equals", "value": false }],
|
|
278
|
+
"steps": [
|
|
279
|
+
{
|
|
280
|
+
"handler": "pixel",
|
|
281
|
+
"params": {
|
|
282
|
+
"snippet": "<div>\n <h1>Cookie Banner</h1>\n <p>This is a cookie banner</p>\n</div>\n",
|
|
283
|
+
"selector": "body"
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
{ "transforms": [{ "type": "set", "target": "injected", "value": true }] }
|
|
287
|
+
],
|
|
288
|
+
"persist": "localstorage",
|
|
289
|
+
"lastModified": {
|
|
290
|
+
"commit": "2e90890",
|
|
291
|
+
"timestamp": "2025-09-29T23:00:33+02:00",
|
|
292
|
+
"author": "Fahad Heylaal"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
interface AlertProps {
|
|
4
|
+
type: "success" | "warning" | "info";
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function Alert(props: AlertProps) {
|
|
9
|
+
if (props.type === "success") {
|
|
10
|
+
return (
|
|
11
|
+
<p className="mx-6 block rounded border-2 border-green-300 bg-green-200 p-3 text-sm text-gray-600">
|
|
12
|
+
{props.children}
|
|
13
|
+
</p>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (props.type === "info") {
|
|
18
|
+
return (
|
|
19
|
+
<p className="mx-6 block rounded border-2 border-blue-300 bg-blue-200 p-3 text-sm text-gray-600">
|
|
20
|
+
{props.children}
|
|
21
|
+
</p>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<p className="mx-6 block rounded border-2 border-orange-300 bg-orange-200 p-3 text-sm text-gray-600">
|
|
27
|
+
{props.children}
|
|
28
|
+
</p>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { ArrowTopRightOnSquareIcon } from "@heroicons/react/20/solid";
|
|
4
|
+
|
|
5
|
+
import { useEntityEditLink } from "../hooks";
|
|
6
|
+
|
|
7
|
+
export const Content: React.FC<{
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
title: string;
|
|
10
|
+
border?: boolean;
|
|
11
|
+
entityType?: string;
|
|
12
|
+
entityName?: string;
|
|
13
|
+
}> = ({ children, border = true, title, entityType, entityName }) => {
|
|
14
|
+
const editLink = useEntityEditLink(entityType ?? "", entityName ?? "");
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className="max-w-3xl">
|
|
18
|
+
<div>
|
|
19
|
+
<h1
|
|
20
|
+
className={clsx(
|
|
21
|
+
"mb-0 m-4 pt-4 text-3xl font-black text-zinc-700 pb-4 relative",
|
|
22
|
+
border && "border-b border-zinc-200",
|
|
23
|
+
)}
|
|
24
|
+
>
|
|
25
|
+
{title}
|
|
26
|
+
|
|
27
|
+
{editLink && (
|
|
28
|
+
<a
|
|
29
|
+
href={editLink}
|
|
30
|
+
target="_blank"
|
|
31
|
+
rel="noopener noreferrer"
|
|
32
|
+
className="text-sm text-zinc-500 hover:text-zinc-700 hover:bg-zinc-300 font-medium inline-block absolute right-0 top-4 bg-zinc-200 py-2 px-3 rounded-md"
|
|
33
|
+
>
|
|
34
|
+
<ArrowTopRightOnSquareIcon className="w-4 h-4 inline-block" /> Edit
|
|
35
|
+
</a>
|
|
36
|
+
)}
|
|
37
|
+
</h1>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
{children}
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { PrettyDate } from "./pretty-date";
|
|
4
|
+
|
|
5
|
+
export function LastModified(props: any) {
|
|
6
|
+
const { lastModified } = props;
|
|
7
|
+
|
|
8
|
+
if (!lastModified) {
|
|
9
|
+
return (
|
|
10
|
+
<p className="inline-flex rounded-full px-2 text-xs leading-5 text-gray-500">
|
|
11
|
+
Last modified
|
|
12
|
+
<span className="pl-1 font-semibold text-gray-600">n/a</span>
|
|
13
|
+
</p>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<p className="inline-flex rounded-full px-2 text-xs leading-5 text-gray-500">
|
|
19
|
+
Last modified by
|
|
20
|
+
<span className="pl-1 pr-1 font-semibold text-gray-600">{lastModified.author}</span> on
|
|
21
|
+
<span className="pl-1 font-semibold text-gray-600">
|
|
22
|
+
<PrettyDate date={lastModified.timestamp} />
|
|
23
|
+
</span>
|
|
24
|
+
</p>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Link } from "react-router";
|
|
3
|
+
|
|
4
|
+
export function LinkEvent(props: any) {
|
|
5
|
+
const { name, className, children } = props;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Link to={`/events/${name}`} className={className}>
|
|
9
|
+
{children}
|
|
10
|
+
</Link>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function LinkAttribute(props: any) {
|
|
15
|
+
const { name, className, children } = props;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Link to={`/attributes/${name}`} className={className}>
|
|
19
|
+
{children}
|
|
20
|
+
</Link>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function LinkDestination(props: any) {
|
|
25
|
+
const { name, className, children } = props;
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Link to={`/destinations/${name}`} className={className}>
|
|
29
|
+
{children}
|
|
30
|
+
</Link>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function LinkEffect(props: any) {
|
|
35
|
+
const { name, className, children } = props;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Link to={`/effects/${name}`} className={className}>
|
|
39
|
+
{children}
|
|
40
|
+
</Link>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactMarkdown from "react-markdown";
|
|
3
|
+
|
|
4
|
+
export const Markdown: React.FC<{ children: React.ReactNode; className?: string }> = (props) => {
|
|
5
|
+
return (
|
|
6
|
+
<div className={`prose prose-sm text-gray-700 ${props.className || ""}`}>
|
|
7
|
+
<ReactMarkdown>{props.children as string}</ReactMarkdown>
|
|
8
|
+
</div>
|
|
9
|
+
);
|
|
10
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Link, useLocation } from "react-router";
|
|
3
|
+
|
|
4
|
+
export const Navbar: React.FC = () => {
|
|
5
|
+
const location = useLocation();
|
|
6
|
+
|
|
7
|
+
const links = [
|
|
8
|
+
// { title: "Home", to: "/" },
|
|
9
|
+
{ title: "Events", to: "/events" },
|
|
10
|
+
{ title: "Attributes", to: "/attributes" },
|
|
11
|
+
{ title: "Destinations", to: "/destinations" },
|
|
12
|
+
{ title: "Effects", to: "/effects" },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className="bg-zinc-900 p-4.5">
|
|
17
|
+
<div className="max-w-3xl mx-auto">
|
|
18
|
+
<div className="flex items-center justify-between">
|
|
19
|
+
<div className="flex items-center justify-start pl-4">
|
|
20
|
+
<a href="/">
|
|
21
|
+
<img src="/img/logo.png" className="w-8 inline-block" alt="" />
|
|
22
|
+
<img src="/img/logo-text.png" className="h-4 pl-3 inline-block opacity-95" alt="" />
|
|
23
|
+
</a>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<ul className="flex gap-0 text-white text-sm justify-end pr-4">
|
|
27
|
+
{links.map((link) => (
|
|
28
|
+
<li key={link.title}>
|
|
29
|
+
<Link
|
|
30
|
+
to={link.to}
|
|
31
|
+
className={`${
|
|
32
|
+
location.pathname.startsWith(link.to)
|
|
33
|
+
? "text-white bg-zinc-800 px-3 py-3 rounded-md"
|
|
34
|
+
: "text-zinc-400 px-3 py-2 rounded-md hover:text-white"
|
|
35
|
+
}`}
|
|
36
|
+
>
|
|
37
|
+
{link.title}
|
|
38
|
+
</Link>
|
|
39
|
+
</li>
|
|
40
|
+
))}
|
|
41
|
+
</ul>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Outlet, useParams, useOutletContext } from "react-router";
|
|
3
|
+
|
|
4
|
+
import { Content } from "./content";
|
|
5
|
+
import { useEntity } from "../hooks";
|
|
6
|
+
import { Alert } from "./alert";
|
|
7
|
+
import { Tabs } from "./tabs";
|
|
8
|
+
import { Markdown } from "./markdown";
|
|
9
|
+
import { Properties } from "./properties";
|
|
10
|
+
import { Tag } from "./tag";
|
|
11
|
+
|
|
12
|
+
export function DisplayAttributeOverview() {
|
|
13
|
+
const { entity, name } = useOutletContext() as any;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className="border-gray-200 py-6">
|
|
17
|
+
<dl className="grid grid-cols-1 gap-x-4 gap-y-8 sm:grid-cols-2">
|
|
18
|
+
<div>
|
|
19
|
+
<dt className="text-sm font-medium text-gray-500">Name</dt>
|
|
20
|
+
<dd className="mt-1 text-sm text-gray-900">{name}</dd>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div>
|
|
24
|
+
<dt className="text-sm font-medium text-gray-500">Tags</dt>
|
|
25
|
+
<dd className="mt-1 text-sm text-gray-900">
|
|
26
|
+
{entity.tags.map((tag: string) => (
|
|
27
|
+
<Tag tag={tag} key={tag} />
|
|
28
|
+
))}
|
|
29
|
+
</dd>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<div>
|
|
33
|
+
<dt className="text-sm font-medium text-gray-500">Archived</dt>
|
|
34
|
+
<dd className="mt-1 text-sm text-gray-900">
|
|
35
|
+
{entity.archived === true ? <span>Yes</span> : <span>No</span>}
|
|
36
|
+
</dd>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div>
|
|
40
|
+
<dt className="text-sm font-medium text-gray-500">Deprecated</dt>
|
|
41
|
+
<dd className="mt-1 text-sm text-gray-900">
|
|
42
|
+
{entity.deprecated === true ? <span>Yes</span> : <span>No</span>}
|
|
43
|
+
</dd>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div className="col-span-2">
|
|
47
|
+
<dt className="text-sm font-medium text-gray-500">Description</dt>
|
|
48
|
+
<dd className="mt-1 text-sm text-gray-900">
|
|
49
|
+
{entity.description.trim().length > 0 ? (
|
|
50
|
+
<Markdown children={entity.description} />
|
|
51
|
+
) : (
|
|
52
|
+
"n/a"
|
|
53
|
+
)}
|
|
54
|
+
</dd>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div>
|
|
58
|
+
<dt className="text-sm font-medium text-gray-500">Type</dt>
|
|
59
|
+
<dd className="mt-1 text-sm text-gray-900">{entity.type}</dd>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
{entity.properties && (
|
|
63
|
+
<div className="col-span-2">
|
|
64
|
+
<dd className="mt-1 text-sm text-gray-900">
|
|
65
|
+
<Properties schema={entity} />
|
|
66
|
+
</dd>
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
|
|
70
|
+
{entity.transforms && (
|
|
71
|
+
<div className="col-span-2">
|
|
72
|
+
<dt className="text-sm font-medium text-gray-500">Transforms</dt>
|
|
73
|
+
<dd className="mt-1 text-sm text-gray-900">
|
|
74
|
+
<pre>
|
|
75
|
+
<code>{JSON.stringify(entity.transforms, null, 2)}</code>
|
|
76
|
+
</pre>
|
|
77
|
+
</dd>
|
|
78
|
+
</div>
|
|
79
|
+
)}
|
|
80
|
+
|
|
81
|
+
{entity.persist && (
|
|
82
|
+
<div className="col-span-2">
|
|
83
|
+
<dt className="text-sm font-medium text-gray-500">Persist</dt>
|
|
84
|
+
<dd className="mt-1 text-sm text-gray-900">
|
|
85
|
+
<pre>
|
|
86
|
+
<code>{JSON.stringify(entity.persist, null, 2)}</code>
|
|
87
|
+
</pre>
|
|
88
|
+
</dd>
|
|
89
|
+
</div>
|
|
90
|
+
)}
|
|
91
|
+
</dl>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const PageAttributesView: React.FC = () => {
|
|
97
|
+
const { name = "" } = useParams();
|
|
98
|
+
|
|
99
|
+
const entity = useEntity("attributes", name);
|
|
100
|
+
|
|
101
|
+
const tabs = [
|
|
102
|
+
{
|
|
103
|
+
title: "Overview",
|
|
104
|
+
to: `/attributes/${encodeURIComponent(name)}`,
|
|
105
|
+
},
|
|
106
|
+
// {
|
|
107
|
+
// title: "History",
|
|
108
|
+
// to: `/attributes/${encodeURIComponent(name)}/history`,
|
|
109
|
+
// },
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<Content title={`Attribute: ${name}`} border={false} entityType="attribute" entityName={name}>
|
|
114
|
+
{!entity && <Alert type="warning">Attribute not found</Alert>}
|
|
115
|
+
|
|
116
|
+
{entity && (
|
|
117
|
+
<>
|
|
118
|
+
<Tabs tabs={tabs} />
|
|
119
|
+
|
|
120
|
+
<div className="p-8">
|
|
121
|
+
<Outlet context={{ entity: entity, name: name }} />
|
|
122
|
+
</div>
|
|
123
|
+
</>
|
|
124
|
+
)}
|
|
125
|
+
</Content>
|
|
126
|
+
);
|
|
127
|
+
};
|