diff --git a/www/src/services/remotes-service.js b/www/src/services/remotes-service.js new file mode 100644 index 0000000..1712ff5 --- /dev/null +++ b/www/src/services/remotes-service.js @@ -0,0 +1,18 @@ +function RemotesService() { + async function getRemotes() { + return []; + } + + async function getCommands() { + return []; + } + + return { + getRemotes, + getCommands, + }; +} + +RemotesService = new RemotesService(); + +export default RemotesService; diff --git a/www/src/views/main-view.jsx b/www/src/views/main-view.jsx index 8cc42ab..2eee839 100644 --- a/www/src/views/main-view.jsx +++ b/www/src/views/main-view.jsx @@ -1,27 +1,28 @@ +import { autoUpdate, computePosition, offset, shift } from "@floating-ui/dom"; import { + createEffect, + createResource, createSignal, mergeProps, - createResource, - createEffect, - onMount, onCleanup, + onMount, } from "solid-js"; -import { computePosition, shift, autoUpdate, offset } from "@floating-ui/dom"; -import UserService from "../services/user-service.js"; import ModalRegistry from "../modals/modal-registry.jsx"; +import UserService from "../services/user-service.js"; import UrlUtils from "../tools/url-utils.js"; -import SettingsView from "./settings-view.jsx"; import DevicesView from "./devices-view.jsx"; +import SettingsView from "./settings-view.jsx"; import { DEVICES_VIEW, - REMOTES_VIEW, - RECORDINGS_VIEW, - SETTINGS_VIEW, INTEGRATION_VIEW, + RECORDINGS_VIEW, + REMOTES_VIEW, + SETTINGS_VIEW, } from "../data/constants.js"; import IntegrationView from "./integration-view.jsx"; +import RemotesView from "./remotes/remotes-view.jsx"; let [activeView, setActiveView] = createSignal(DEVICES_VIEW); @@ -215,6 +216,9 @@ const MainView = function (props) { + + + ); diff --git a/www/src/views/remotes/commands-list-view.jsx b/www/src/views/remotes/commands-list-view.jsx new file mode 100644 index 0000000..bfcfe72 --- /dev/null +++ b/www/src/views/remotes/commands-list-view.jsx @@ -0,0 +1,76 @@ +import { createResource, onMount } from "solid-js"; +import List from "../../modules/list"; +import RemotesService from "../../services/remotes-service"; + +function CommandsList(props) { + const [commands, { refetch: refetchCommands }] = createResource( + RemotesService.getCommands + ); + + onMount(() => { + refetchCommands(); + }); + + function handleNewCommand() {} + + return ( + <> +
+
+ {props.navigation ? props.navigation : null} +
+
+ +
+
+ ({ + id: { + html: {integration.getId()}, + }, + name: { + text: integration.getName(), + }, + options: { + html: ( + <> + + + ), + }, + integration: integration, + }))} + class={"flex-fill"} + columns={[ + { + id: "id", + name: "id", + width: 6, + }, + { + id: "name", + name: "Name", + }, + { + id: "options", + name: "", + width: 4, + }, + ]} + > + + ); +} + +export default CommandsList; diff --git a/www/src/views/remotes/remotes-list-view.jsx b/www/src/views/remotes/remotes-list-view.jsx new file mode 100644 index 0000000..a50f937 --- /dev/null +++ b/www/src/views/remotes/remotes-list-view.jsx @@ -0,0 +1,64 @@ +import { createResource, onMount } from "solid-js"; +import List from "../../modules/list"; +import RemotesService from "../../services/remotes-service"; + +function RemotesList(props) { + const [remotes, { refetch: refetchRemotes }] = + createResource(RemotesService.getRemotes); + + onMount(() => { + refetchRemotes(); + }); + + function handleNewRemote() {} + + return ( + <> +
+
+ {props.navigation ? props.navigation : null} +
+
+ +
+
+ {}} + items={(remotes() || []).map((device) => ({ + id: { + html: {device.getId()}, + }, + name: { + text: device.getName(), + }, + description: { + text: device.getDescription(), + }, + device, + }))} + class={"flex-fill"} + columns={[ + { + id: "id", + name: "id", + width: 6, + }, + { + id: "name", + name: "Name", + width: 10, + }, + { + id: "description", + name: "Description", + }, + ]} + > + + ); +} + +export default RemotesList; diff --git a/www/src/views/remotes/remotes-view.jsx b/www/src/views/remotes/remotes-view.jsx new file mode 100644 index 0000000..3c1a38a --- /dev/null +++ b/www/src/views/remotes/remotes-view.jsx @@ -0,0 +1,64 @@ +import { + createSignal, + Match, + mergeProps, + Switch +} from "solid-js"; + +import CommandsList from "./commands-list-view"; +import RemotesList from "./remotes-list-view"; + +function RemotesView(props) { + props = mergeProps({ onIntegrationClicked: () => {} }, props); + const REMOTES_LIST_TYPE = "remotes"; + const COMMANDS_LIST_TYPE = "commands"; + + const [listType, setListType] = createSignal(REMOTES_LIST_TYPE); + + function Navigation(props) { + return ( +
+ + +
+ ); + } + + return ( +
+ + + } /> + + + } /> + + +
+ ); +} + +export default RemotesView;