-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.ts
More file actions
49 lines (44 loc) · 1.67 KB
/
Copy pathscript.ts
File metadata and controls
49 lines (44 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { type Route, Router, RouteView } from '@/user-interface/core/router'
import { html } from '@arrow-js/core'
import { Navigation } from '@/user-interface/components/module/navigation'
import { Home } from '@/user-interface/components/page/home'
import { Contacts } from '@/user-interface/components/page/contacts'
import { Contact } from '@/user-interface/components/module/contact'
import { ContactStore } from '@/user-interface/state-management/contacts'
const root = document.body
const contactPaths: Route[] = [
{ path: '/', element: html`🍽️` },
{ path: '/tacos', element: html`🌮` },
{ path: '/pizza', element: html`🍕` },
{ path: '/ice-cream', element: html`🍨` }
]
const router = new Router([
{ path: '/', element: Home() },
{
path: '/contacts',
element: Contacts(),
children: [
{ path: '/1', element: new Contact('1').html, children: contactPaths },
{ path: '/2', element: new Contact('2').html, children: contactPaths },
{ path: '/3', element: new Contact('3').html, children: contactPaths }
]
}
])
const getJsonData = (): string => {
return '⚡ Watch state changes here! \n\nContacts: ' +
JSON.stringify(ContactStore.readonlyState.contacts, null, 4) +
`\n\n💌 Messages: ${JSON.stringify(ContactStore.readonlyState.messages, null, 4)}`
}
html`
<div class="wrapper">
<div class="main-application">
${new Navigation().html}
<br/>
${new RouteView().html}
</div>
<div class="data-watcher">
<textarea disabled value="${() => getJsonData()}">
</textarea>
</div>
</div>
`(root)