Skip to content

Commit aaa3091

Browse files
committed
Working intent resolver
1 parent e0c1b2d commit aaa3091

22 files changed

+430
-198
lines changed

package-lock.json

+38-38
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.3",
22-
"@kite9/da-server": "2.2.0-beta.3",
23-
"@kite9/fdc3": "2.2.0-beta.3",
21+
"@kite9/client": "2.2.0-beta.6",
22+
"@kite9/da-server": "2.2.0-beta.6",
23+
"@kite9/fdc3": "2.2.0-beta.6",
2424
"@types/react-dom": "^18.2.25",
2525
"@types/uuid": "^9.0.8",
2626
"@types/ws": "^8.5.10",

src/app/embed.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { io } from "socket.io-client"
22
import { link } from "./util";
3-
import { APP_HELLO } from "../server/da/message-types";
4-
import { getClientState } from "../client/state/client";
3+
import { APP_HELLO, AppHelloArgs } from "../server/da/message-types";
4+
import { getClientState } from "../client/state/clientState";
55

66
const appWindow = window.parent;
77

@@ -46,7 +46,11 @@ window.addEventListener("load", () => {
4646

4747
link(socket, channel, instanceId)
4848

49-
socket.emit(APP_HELLO, clientState.getUserSessionID(), instanceId, appId)
49+
socket.emit(APP_HELLO, {
50+
userSessionId: clientState.getUserSessionID(),
51+
instanceId,
52+
appId
53+
} as AppHelloArgs)
5054

5155
// sned the other end of the channel to the app
5256
appWindow.postMessage({

src/client/appd/appd.tsx

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Component } from "react";
22
import { Icon } from "../icon/icon";
3-
import { getServerState } from "../state/server";
3+
import { getServerState } from "../state/serverConnectivity";
44
import * as styles from "./styles.module.css";
5-
import { ClientState } from "../state/client";
65
import { Popup, PopupButton } from "../popups/popup";
76
import { DirectoryApp } from "@kite9/da-server";
87

@@ -17,7 +16,7 @@ function getIcon(a: DirectoryApp) {
1716
}
1817
}
1918

20-
type AppPanelProps = { closeAction: () => void; cs: ClientState };
19+
type AppPanelProps = { closeAction: () => void };
2120

2221
type AppPanelState = {
2322
chosen: DirectoryApp | null;
@@ -96,12 +95,8 @@ export class AppDPanel extends Component<AppPanelProps, AppPanelState> {
9695
disabled={this.state.chosen == null}
9796
onClick={async () => {
9897
if (this.state.chosen) {
99-
const ap = await this.props.cs.open(this.state.chosen);
100-
if (ap) {
101-
this.props.closeAction();
102-
} else {
103-
alert("Not a web app");
104-
}
98+
getServerState().registerAppLaunch(this.state.chosen.appId);
99+
this.props.closeAction();
105100
}
106101
}}
107102
/>,

src/client/config/config.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component } from "react";
22
import * as styles from "./styles.module.css";
3-
import { ClientState, Directory, getClientState } from "../state/client";
3+
import { ClientState, Directory, getClientState } from "../state/clientState";
44
import { Popup } from "../popups/popup";
55

66
const CONFIG_ITENS = ["Directories", "Something else", "Thing 3", "Thing 4"];

src/client/frame/frame.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Bin, Controls, NewPanel, Resolver } from "../controls/controls";
22
import { Logo, Settings } from "../top/top";
33
import { Tabs } from "../tabs/tabs";
44
import * as styles from "./styles.module.css";
5-
import { ClientState, getClientState } from "../state/client";
5+
import { ClientState, getClientState } from "../state/clientState";
66
import { Component } from "react";
77
import { AppDPanel } from "../appd/appd";
88
import { Content, Grids } from "../grid/grid";
@@ -64,7 +64,6 @@ export class Frame extends Component<FrameProps, FrameState> {
6464
context: EXAMPLE_CONTEXT,
6565
requestId: "123",
6666
});
67-
this.setState(this.state);
6867
}}
6968
/>
7069
<NewPanel onClick={() => this.setState({ popup: Popup.APPD })} />
@@ -80,7 +79,6 @@ export class Frame extends Component<FrameProps, FrameState> {
8079
{this.state?.popup == Popup.APPD ? (
8180
<AppDPanel
8281
key="appd"
83-
cs={this.props.cs}
8482
closeAction={() =>
8583
this.setState({
8684
popup: Popup.NONE,
@@ -105,7 +103,6 @@ export class Frame extends Component<FrameProps, FrameState> {
105103
context={this.props.cs.getIntentResolution()!!.context}
106104
closeAction={() => {
107105
this.props.cs.setIntentResolution(null);
108-
this.setState(this.state);
109106
}}
110107
/>
111108
) : null}

src/client/grid/grid.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component } from "react";
2-
import { AppPanel, ClientState } from "../state/client";
2+
import { AppPanel, ClientState } from "../state/clientState";
33
import * as styles from "./styles.module.css";
44
import "gridstack/dist/gridstack.css";
55
import { GridsState } from "./gridstate";

src/client/grid/gridstate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { GridItemHTMLElement, GridStack, GridStackElement, GridStackWidget } from "gridstack"
22
import { ReactElement } from "react"
33
import ReactDOM from 'react-dom';
4-
import { AppPanel, ClientState } from "../state/client"
4+
import { AppPanel, ClientState } from "../state/clientState"
55

66
const TRASH_DROP = "trash";
77

src/client/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Frame } from "./frame/frame";
22
import { createRoot } from "react-dom/client";
3-
import { getClientState } from "./state/client";
3+
import { getClientState } from "./state/clientState";
44
import { setupPostMessage } from "./state/postMessage";
55
import "../../static/fonts/DM_Sans/DM_Sans.css";
66

src/client/popups/styles.module.css

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
margin-top: 1rem;
2424
margin: auto;
2525
max-width: 50rem;
26+
max-height: 80%;
2627
background-color: white;
2728
border-radius: .5rem;
2829
padding: 1rem;
@@ -36,6 +37,7 @@
3637
.popupArea {
3738
display: flex;
3839
flex-direction: row;
40+
overflow: scroll;
3941
}
4042

4143
.popupTitle {

0 commit comments

Comments
 (0)