Skip to content

Commit c0658e3

Browse files
author
Benedikt Strehle
committed
bugfixes
1 parent f05f25b commit c0658e3

File tree

7 files changed

+32
-152
lines changed

7 files changed

+32
-152
lines changed

.github/workflows/uix-deploy-prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ jobs:
1414
with:
1515
submodules: recursive
1616
- name: Setup Deno
17-
uses: "denoland/setup-deno@v1"
17+
uses: "denoland/setup-deno@v2"
1818
- name: Deploy UIX App
1919
run: "deno run --importmap ./importmap.json -Aqr https://cdn.unyt.org/[email protected]/run.ts --stage prod --detach"

backend/entrypoint.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ if (await listStorage.getSize() === 0) {
3333

3434
// The frontend routes definition
3535
export default {
36-
"/": <Overview lists={listStorage} />,
36+
"/": () => <Overview lists={listStorage} />,
3737
"*": null,
3838
} satisfies Entrypoint;

common/List.scss

Lines changed: 0 additions & 121 deletions
This file was deleted.

common/List.tsx

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import { type ListItem } from "backend/lists.ts";
22
import { template } from "uix/html/template.ts";
33
import { Component } from "uix/components/Component.ts";
4-
import type { Ref } from "datex-core-legacy/datex_all.ts";
54

6-
@template(function (this: List) {
7-
const { title, items } = this.properties;
5+
@template(function({ title, items }) {
86
return (
97
<div>
108
<div class="header">
119
<h1>{title}</h1>
1210
</div>
1311
<ol>
14-
{val(items).map((item, index) => (
12+
{items.map((item, index) => (
1513
<li>
1614
<input
1715
type="checkbox"
@@ -24,12 +22,14 @@ import type { Ref } from "datex-core-legacy/datex_all.ts";
2422
))}
2523
</ol>
2624
<button
25+
type="button"
2726
class="add-button"
2827
onclick:frontend={() => this.dialog.showModal()}
2928
>
3029
Add item
3130
</button>
3231
<button
32+
type="button"
3333
class="remove-button"
3434
onclick:frontend={() => this.removeChecked()}
3535
>
@@ -49,34 +49,30 @@ import type { Ref } from "datex-core-legacy/datex_all.ts";
4949
max={99}
5050
/>
5151
<select id="type" value={this.type}>
52-
<option name={"bottle"}>Bottle</option>
53-
<option name={"piece"}>Piece</option>
54-
<option name={"whatever"}>Whatever</option>
52+
<option name="bottle">Bottle</option>
53+
<option name="piece">Piece</option>
54+
<option name="whatever">Whatever</option>
5555
</select>
56-
<div id="add" onclick:frontend={() => this.addItem()}>
56+
<button type="button" onclick:frontend={() => this.addItem()}>
5757
Add
58-
</div>
58+
</button>
5959
</dialog>
6060
</div>
6161
);
6262
})
63-
export class List extends Component<{ title: string; items: Ref<ListItem[]> }> {
63+
export class List extends Component<{ title: string; items: ListItem[] }> {
6464
/** references to the DOM elements */
65-
@property
66-
name = "";
67-
@property
68-
amount = 1;
69-
@property
70-
type = "bottle";
71-
@id
72-
dialog!: HTMLDialogElement;
65+
@property name = "";
66+
@property amount = 1;
67+
@property type = "bottle";
68+
@id dialog!: HTMLDialogElement;
7369

7470
/**
7571
* Remove all checked items
7672
*/
7773
private removeChecked() {
7874
const items = this.properties.items;
79-
items.val = val(items).filter((e) => !e.checked);
75+
items.splice(0, items.length, ...items.filter((e) => !e.checked))
8076
globalThis.location.reload();
8177
}
8278

common/Overview.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ import { template } from "uix/html/template.ts";
33
import { Component } from "uix/components/Component.ts";
44
import { StorageMap } from "datex-core-legacy/datex_all.ts";
55

6-
@template(async function (this: Overview) {
7-
return (
8-
<div>
6+
@template(async ({lists}) => {
7+
const entries = await lists.entriesArray();
8+
return <div>
99
<h1>Overview</h1>
10-
{(await this.properties.lists.entriesArray()).map(([key, val]) => (
10+
{entries.map(([key, val]) => (
1111
<a href={`/${key}`}>{val.title}</a>
1212
))}
1313
</div>
14-
);
1514
})
1615
export class Overview
1716
extends Component<{ lists: StorageMap<string, SharedList> }> {}

deno.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
{
2-
"importMap": "./importmap.json",
2+
"_publicImportMap": "./importmap.json",
3+
"importMap": "./.datex-cache/importmap.lock.json",
34
"compilerOptions": {
45
"jsx": "react-jsx",
56
"jsxImportSource": "jusix",
67
"lib": [
78
"deno.window",
89
"dom"
910
]
11+
},
12+
"lint": {
13+
"rules": {
14+
"exclude": [
15+
"jsx-key"
16+
]
17+
}
1018
}
1119
}

frontend/entrypoint.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { Lists } from "../backend/lists.ts";
22
import { List } from "../common/List.tsx";
33
import { type Entrypoint } from "uix/providers/entrypoints.ts";
4-
import { lazy } from "uix/providers/common.tsx";
54

65
export default {
7-
"/:id": lazy(async (_, { id }) => {
6+
"/:id": async (_ctx, { id }) => {
87
const list = await Lists.get(id);
9-
108
return <List items={list.items} title={list.title} />; // render the list component
11-
}),
9+
},
1210
} satisfies Entrypoint;

0 commit comments

Comments
 (0)