Skip to content

Commit e0c1b2d

Browse files
committed
Added intent resolver
1 parent 67c59a7 commit e0c1b2d

18 files changed

+677
-237
lines changed

package-lock.json

+29-145
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
"vite": "^5.0.2"
1919
},
2020
"dependencies": {
21-
"@kite9/client": "2.2.0-beta.2",
22-
"@kite9/da-server": "2.2.0-beta.2",
23-
"@kite9/fdc3": "2.2.0-beta.2",
21+
"@kite9/client": "2.2.0-beta.3",
22+
"@kite9/da-server": "2.2.0-beta.3",
23+
"@kite9/fdc3": "2.2.0-beta.3",
2424
"@types/react-dom": "^18.2.25",
2525
"@types/uuid": "^9.0.8",
2626
"@types/ws": "^8.5.10",

src/client/appd/appd.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,22 @@ export class AppDPanel extends Component<AppPanelProps, AppPanelState> {
9090
</div>
9191
</div>
9292
}
93-
button={
93+
buttons={[
9494
<PopupButton
9595
text="open"
9696
disabled={this.state.chosen == null}
97-
onClick={() => {
97+
onClick={async () => {
9898
if (this.state.chosen) {
99-
const ap = this.props.cs.open(this.state.chosen);
99+
const ap = await this.props.cs.open(this.state.chosen);
100100
if (ap) {
101101
this.props.closeAction();
102102
} else {
103103
alert("Not a web app");
104104
}
105105
}
106106
}}
107-
/>
108-
}
107+
/>,
108+
]}
109109
closeAction={() => this.props.closeAction()}
110110
/>
111111
);

src/client/config/config.tsx

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { Component } from "react";
2+
import * as styles from "./styles.module.css";
3+
import { ClientState, Directory, getClientState } from "../state/client";
4+
import { Popup } from "../popups/popup";
5+
6+
const CONFIG_ITENS = ["Directories", "Something else", "Thing 3", "Thing 4"];
7+
8+
type AppPanelProps = {
9+
closeAction: () => void;
10+
cs: ClientState;
11+
};
12+
13+
type AppPanelState = {
14+
item: string;
15+
};
16+
17+
function toggleDirectory(d: Directory) {
18+
d.active = !d.active;
19+
getClientState().updateDirectory(d);
20+
}
21+
22+
export class ConfigPanel extends Component<AppPanelProps, AppPanelState> {
23+
constructor(props: AppPanelProps) {
24+
super(props);
25+
this.state = {
26+
item: CONFIG_ITENS[0],
27+
};
28+
}
29+
30+
render() {
31+
return (
32+
<Popup
33+
key="AppDConfigPopup"
34+
title="Sail Configuration"
35+
area={
36+
<div className={styles.configContent}>
37+
<div className={styles.configChoice}>
38+
{CONFIG_ITENS.map((a) => (
39+
<div
40+
key={a}
41+
className={`${styles.configItem} ${a == this.state.item ? styles.selected : ""}`}
42+
onClick={() => this.setState({ item: a })}
43+
>
44+
{a}
45+
</div>
46+
))}
47+
</div>
48+
49+
<div className={styles.configChoice}>
50+
{this.state.item == CONFIG_ITENS[0]
51+
? getClientState()
52+
.getDirectories()
53+
.map((d) => (
54+
<div
55+
key={d.url}
56+
className={`${styles.directoryItem} ${d.active ? styles.directoryActive : styles.directoryInactive}`}
57+
onClick={() => toggleDirectory(d)}
58+
>
59+
<div className={styles.directoryName}>{d.label}</div>
60+
<div className={styles.directoryUrl}>{d.url}</div>
61+
</div>
62+
))
63+
: null}
64+
</div>
65+
</div>
66+
}
67+
buttons={[]}
68+
closeAction={() => this.props.closeAction()}
69+
/>
70+
);
71+
}
72+
}

0 commit comments

Comments
 (0)