Skip to content

Commit

Permalink
Working intent resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
robmoffat committed Sep 5, 2024
1 parent e0c1b2d commit aaa3091
Show file tree
Hide file tree
Showing 22 changed files with 430 additions and 198 deletions.
76 changes: 38 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"vite": "^5.0.2"
},
"dependencies": {
"@kite9/client": "2.2.0-beta.3",
"@kite9/da-server": "2.2.0-beta.3",
"@kite9/fdc3": "2.2.0-beta.3",
"@kite9/client": "2.2.0-beta.6",
"@kite9/da-server": "2.2.0-beta.6",
"@kite9/fdc3": "2.2.0-beta.6",
"@types/react-dom": "^18.2.25",
"@types/uuid": "^9.0.8",
"@types/ws": "^8.5.10",
Expand Down
10 changes: 7 additions & 3 deletions src/app/embed.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { io } from "socket.io-client"
import { link } from "./util";
import { APP_HELLO } from "../server/da/message-types";
import { getClientState } from "../client/state/client";
import { APP_HELLO, AppHelloArgs } from "../server/da/message-types";
import { getClientState } from "../client/state/clientState";

const appWindow = window.parent;

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

link(socket, channel, instanceId)

socket.emit(APP_HELLO, clientState.getUserSessionID(), instanceId, appId)
socket.emit(APP_HELLO, {
userSessionId: clientState.getUserSessionID(),
instanceId,
appId
} as AppHelloArgs)

// sned the other end of the channel to the app
appWindow.postMessage({
Expand Down
13 changes: 4 additions & 9 deletions src/client/appd/appd.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Component } from "react";
import { Icon } from "../icon/icon";
import { getServerState } from "../state/server";
import { getServerState } from "../state/serverConnectivity";
import * as styles from "./styles.module.css";
import { ClientState } from "../state/client";
import { Popup, PopupButton } from "../popups/popup";
import { DirectoryApp } from "@kite9/da-server";

Expand All @@ -17,7 +16,7 @@ function getIcon(a: DirectoryApp) {
}
}

type AppPanelProps = { closeAction: () => void; cs: ClientState };
type AppPanelProps = { closeAction: () => void };

type AppPanelState = {
chosen: DirectoryApp | null;
Expand Down Expand Up @@ -96,12 +95,8 @@ export class AppDPanel extends Component<AppPanelProps, AppPanelState> {
disabled={this.state.chosen == null}
onClick={async () => {
if (this.state.chosen) {
const ap = await this.props.cs.open(this.state.chosen);
if (ap) {
this.props.closeAction();
} else {
alert("Not a web app");
}
getServerState().registerAppLaunch(this.state.chosen.appId);
this.props.closeAction();
}
}}
/>,
Expand Down
2 changes: 1 addition & 1 deletion src/client/config/config.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from "react";
import * as styles from "./styles.module.css";
import { ClientState, Directory, getClientState } from "../state/client";
import { ClientState, Directory, getClientState } from "../state/clientState";
import { Popup } from "../popups/popup";

const CONFIG_ITENS = ["Directories", "Something else", "Thing 3", "Thing 4"];
Expand Down
5 changes: 1 addition & 4 deletions src/client/frame/frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Bin, Controls, NewPanel, Resolver } from "../controls/controls";
import { Logo, Settings } from "../top/top";
import { Tabs } from "../tabs/tabs";
import * as styles from "./styles.module.css";
import { ClientState, getClientState } from "../state/client";
import { ClientState, getClientState } from "../state/clientState";
import { Component } from "react";
import { AppDPanel } from "../appd/appd";
import { Content, Grids } from "../grid/grid";
Expand Down Expand Up @@ -64,7 +64,6 @@ export class Frame extends Component<FrameProps, FrameState> {
context: EXAMPLE_CONTEXT,
requestId: "123",
});
this.setState(this.state);
}}
/>
<NewPanel onClick={() => this.setState({ popup: Popup.APPD })} />
Expand All @@ -80,7 +79,6 @@ export class Frame extends Component<FrameProps, FrameState> {
{this.state?.popup == Popup.APPD ? (
<AppDPanel
key="appd"
cs={this.props.cs}
closeAction={() =>
this.setState({
popup: Popup.NONE,
Expand All @@ -105,7 +103,6 @@ export class Frame extends Component<FrameProps, FrameState> {
context={this.props.cs.getIntentResolution()!!.context}
closeAction={() => {
this.props.cs.setIntentResolution(null);
this.setState(this.state);
}}
/>
) : null}
Expand Down
2 changes: 1 addition & 1 deletion src/client/grid/grid.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from "react";
import { AppPanel, ClientState } from "../state/client";
import { AppPanel, ClientState } from "../state/clientState";
import * as styles from "./styles.module.css";
import "gridstack/dist/gridstack.css";
import { GridsState } from "./gridstate";
Expand Down
2 changes: 1 addition & 1 deletion src/client/grid/gridstate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GridItemHTMLElement, GridStack, GridStackElement, GridStackWidget } from "gridstack"
import { ReactElement } from "react"
import ReactDOM from 'react-dom';
import { AppPanel, ClientState } from "../state/client"
import { AppPanel, ClientState } from "../state/clientState"

const TRASH_DROP = "trash";

Expand Down
2 changes: 1 addition & 1 deletion src/client/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Frame } from "./frame/frame";
import { createRoot } from "react-dom/client";
import { getClientState } from "./state/client";
import { getClientState } from "./state/clientState";
import { setupPostMessage } from "./state/postMessage";
import "../../static/fonts/DM_Sans/DM_Sans.css";

Expand Down
2 changes: 2 additions & 0 deletions src/client/popups/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
margin-top: 1rem;
margin: auto;
max-width: 50rem;
max-height: 80%;
background-color: white;
border-radius: .5rem;
padding: 1rem;
Expand All @@ -36,6 +37,7 @@
.popupArea {
display: flex;
flex-direction: row;
overflow: scroll;
}

.popupTitle {
Expand Down
Loading

0 comments on commit aaa3091

Please sign in to comment.