import { createEffect, createSignal, Match, mergeProps, onCleanup, Switch, } from "solid-js"; import UrlUtils from "../../tools/url-utils"; import CommandsList from "./commands-list-view"; import RemotesList from "./remotes-list-view"; function RemotesView(props) { props = mergeProps({ onIntegrationClicked: () => {} }, props); const REMOTES_LIST_VIEW = "remotes_list"; const COMMANDS_LIST_VIEW = "commands_list"; const VIEWS = [REMOTES_LIST_VIEW, COMMANDS_LIST_VIEW]; const [currentView, setCurrentView] = createSignal(REMOTES_LIST_VIEW); createEffect(() => { let url = UrlUtils.getUrl(); url = UrlUtils.addQueryParameter(url, "tab", currentView()); UrlUtils.setUrl(url); }); onCleanup(() => { window.removeEventListener("popstate", setViewFromUrl); }); setViewFromUrl(); window.addEventListener("popstate", setViewFromUrl); function setViewFromUrl() { let view = UrlUtils.getQueryParameter("tab"); if (!view) return; if (!VIEWS.includes(view)) return; setCurrentView(view); } function Navigation(props) { return (