-
-
);
diff --git a/client/src/pages/Config/ShipSystems/ShipSystemsList.tsx b/client/src/pages/Config/ShipSystems/ShipSystemsList.tsx
index 4bcf8a2d..411ce7cf 100644
--- a/client/src/pages/Config/ShipSystems/ShipSystemsList.tsx
+++ b/client/src/pages/Config/ShipSystems/ShipSystemsList.tsx
@@ -2,7 +2,7 @@ import {usePrompt} from "@thorium/ui/AlertDialog";
import Menubar from "@thorium/ui/Menubar";
import SearchableList from "@thorium/ui/SearchableList";
import {Outlet, useParams, useNavigate} from "react-router-dom";
-import {Fragment} from "react";
+import {Fragment, Suspense} from "react";
import {toast} from "client/src/context/ToastContext";
import Dropdown, {DropdownItem} from "@thorium/ui/Dropdown";
import {HiChevronDown} from "react-icons/hi";
@@ -11,6 +11,20 @@ import {capitalCase} from "change-case";
import {q} from "@client/context/AppContext";
export function ShipSystemsList() {
+ const {pluginId} = useParams() as {
+ pluginId: string;
+ };
+ return (
+
+
+
+
+
+
+ );
+}
+
+function ShipSystemsInner() {
const {pluginId, systemId} = useParams() as {
pluginId: string;
systemId?: string;
@@ -20,82 +34,80 @@ export function ShipSystemsList() {
const [data] = q.plugin.systems.all.useNetRequest({pluginId});
const [availableShipSystems] = q.plugin.systems.available.useNetRequest();
const system = data.find(d => d.name === systemId);
+
return (
-
-
-
-
- Ship Systems Config
-
-
-
-
- New Ship System
-
- }
- >
- {availableShipSystems.map(system => (
- {
- const name = await prompt({
- header: "Enter system name",
- defaultValue: capitalCase(system.type),
+
+
+ Ship Systems Config
+
+
+
+
+ New Ship System
+
+ }
+ >
+ {availableShipSystems.map(system => (
+ {
+ const name = await prompt({
+ header: "Enter system name",
+ defaultValue: capitalCase(system.type),
+ });
+ if (typeof name !== "string") return;
+ try {
+ const result = await q.plugin.systems.create.netSend({
+ name,
+ type: system.type,
+ pluginId,
});
- if (typeof name !== "string") return;
- try {
- const result = await q.plugin.systems.create.netSend({
- name,
- type: system.type,
- pluginId,
+ navigate(`${result.shipSystemId}`);
+ } catch (err) {
+ if (err instanceof Error) {
+ toast({
+ title: "Error creating system",
+ body: err.message,
+ color: "error",
});
- navigate(`${result.shipSystemId}`);
- } catch (err) {
- if (err instanceof Error) {
- toast({
- title: "Error creating system",
- body: err.message,
- color: "error",
- });
- return;
- }
+ return;
}
- }}
- >
- {capitalCase(system.type)}
-
- ))}
-
+ }
+ }}
+ >
+ {capitalCase(system.type)}
+
+ ))}
+
-
({
- id: d.name,
- name: d.name,
- description: d.description,
- category: capitalCase(d.type),
- tags: d.tags,
- }))}
- searchKeys={["name", "category", "tags"]}
- selectedItem={systemId || null}
- setSelectedItem={({id}) => navigate(`${id}`)}
- renderItem={c => (
-
+
({
+ id: d.name,
+ name: d.name,
+ description: d.description,
+ category: capitalCase(d.type),
+ tags: d.tags,
+ }))}
+ searchKeys={["name", "category", "tags"]}
+ selectedItem={systemId || null}
+ setSelectedItem={({id}) => navigate(`${id}`)}
+ renderItem={c => (
+
+
+ {c.name}
- {c.name}
-
- {c.category}
-
+
{c.category}
- )}
- />
-
-
-
-
+
+ )}
+ />
+
+
+
);
diff --git a/client/src/pages/Config/Ships/ShipList.tsx b/client/src/pages/Config/Ships/ShipList.tsx
index abc5ca9b..c8693114 100644
--- a/client/src/pages/Config/Ships/ShipList.tsx
+++ b/client/src/pages/Config/Ships/ShipList.tsx
@@ -3,77 +3,87 @@ import Menubar from "@thorium/ui/Menubar";
import SearchableList from "@thorium/ui/SearchableList";
import Button from "@thorium/ui/Button";
import {Outlet, useParams, useNavigate} from "react-router-dom";
-import {Fragment} from "react";
+import {Fragment, Suspense} from "react";
import {toast} from "@client/context/ToastContext";
import {q} from "@client/context/AppContext";
export function ShipList() {
+ const {pluginId} = useParams() as {pluginId: string};
+
+ return (
+
+
+
+
+
+
+ );
+}
+
+function ShipListInner() {
const {pluginId, shipId} = useParams() as {pluginId: string; shipId?: string};
const navigate = useNavigate();
const prompt = usePrompt();
const [ships] = q.plugin.ship.all.useNetRequest({pluginId});
const ship = ships.find(d => d.name === shipId);
+
return (
-
-
-
-
Ships Config
-
-
-
{
- const name = await prompt({header: "Enter ship name"});
- if (typeof name !== "string" || name.trim().length === 0)
- return;
- try {
- const result = await q.plugin.ship.create.netSend({
- name,
- pluginId,
+
+
Ships Config
+
+
+
{
+ const name = await prompt({header: "Enter ship name"});
+ if (typeof name !== "string" || name.trim().length === 0) return;
+ try {
+ const result = await q.plugin.ship.create.netSend({
+ name,
+ pluginId,
+ });
+ navigate(`${result.shipId}`);
+ } catch (err) {
+ if (err instanceof Error) {
+ toast({
+ title: "Error creating ship",
+ body: err.message,
+ color: "error",
});
- navigate(`${result.shipId}`);
- } catch (err) {
- if (err instanceof Error) {
- toast({
- title: "Error creating ship",
- body: err.message,
- color: "error",
- });
- return;
- }
+ return;
}
- }}
- >
- New Ship
-
+ }
+ }}
+ >
+ New Ship
+
-
({
- id: d.name,
- name: d.name,
- description: d.description,
- category: d.category,
- tags: d.tags,
- }))}
- searchKeys={["name", "category", "tags"]}
- selectedItem={shipId || null}
- setSelectedItem={({id}) => navigate(`${id}`)}
- renderItem={c => (
-
+
({
+ id: d.name,
+ name: d.name,
+ description: d.description,
+ category: d.category,
+ tags: d.tags,
+ }))}
+ searchKeys={["name", "category", "tags"]}
+ selectedItem={shipId || null}
+ setSelectedItem={({id}) => navigate(`${id}`)}
+ renderItem={c => (
+
+
+ {c.name}
- {c.name}
-
- {c.category}
-
+
{c.category}
- )}
- />
-
-
-
-
+
+ )}
+ />
+
+
+
);
diff --git a/client/src/pages/Config/Themes/ThemeList.tsx b/client/src/pages/Config/Themes/ThemeList.tsx
index bba6c59b..806a7879 100644
--- a/client/src/pages/Config/Themes/ThemeList.tsx
+++ b/client/src/pages/Config/Themes/ThemeList.tsx
@@ -3,11 +3,25 @@ import Menubar from "@thorium/ui/Menubar";
import SearchableList from "@thorium/ui/SearchableList";
import Button from "@thorium/ui/Button";
import {Outlet, useParams, useNavigate} from "react-router-dom";
-import {Fragment} from "react";
+import {Fragment, Suspense} from "react";
import {toast} from "client/src/context/ToastContext";
import {q} from "@client/context/AppContext";
export function ThemeList() {
+ const {pluginId} = useParams() as {
+ pluginId: string;
+ };
+ return (
+
+
+
+
+
+
+ );
+}
+
+function ThemeListInner() {
const {pluginId, themeId} = useParams() as {
pluginId: string;
themeId?: string;
@@ -16,59 +30,56 @@ export function ThemeList() {
const prompt = usePrompt();
const [data] = q.plugin.theme.all.useNetRequest({pluginId});
const theme = data.find(d => d.name === themeId);
+
return (
-
-
-
-
Themes Config
-
-
-
{
- const name = await prompt({header: "Enter theme name"});
- if (typeof name !== "string" || name.trim().length === 0)
- return;
- try {
- const result = await q.plugin.theme.create.netSend({
- name,
- pluginId,
+
+
Themes Config
+
+
+
{
+ const name = await prompt({header: "Enter theme name"});
+ if (typeof name !== "string" || name.trim().length === 0) return;
+ try {
+ const result = await q.plugin.theme.create.netSend({
+ name,
+ pluginId,
+ });
+ navigate(`${result.themeId}`);
+ } catch (err) {
+ if (err instanceof Error) {
+ toast({
+ title: "Error creating theme",
+ body: err.message,
+ color: "error",
});
- navigate(`${result.themeId}`);
- } catch (err) {
- if (err instanceof Error) {
- toast({
- title: "Error creating theme",
- body: err.message,
- color: "error",
- });
- return;
- }
+ return;
}
- }}
- >
- New theme
-
+ }
+ }}
+ >
+ New theme
+
-
({
- id: d.name,
- name: d.name,
- }))}
- searchKeys={["name"]}
- selectedItem={themeId || null}
- setSelectedItem={({id}) => navigate(`${id}`)}
- renderItem={c => (
-
- )}
- />
-
-
-
-
+
({
+ id: d.name,
+ name: d.name,
+ }))}
+ searchKeys={["name"]}
+ selectedItem={themeId || null}
+ setSelectedItem={({id}) => navigate(`${id}`)}
+ renderItem={c => (
+
+ )}
+ />
+
+
+
);
diff --git a/client/src/pages/Config/index.tsx b/client/src/pages/Config/index.tsx
index fc0bd956..57db10e9 100644
--- a/client/src/pages/Config/index.tsx
+++ b/client/src/pages/Config/index.tsx
@@ -1,5 +1,5 @@
import {q} from "@client/context/AppContext";
-import {lazy} from "react";
+import {lazy, Suspense} from "react";
import {Navigate, Route, Routes} from "react-router-dom";
const PluginEdit = lazy(() => import("./PluginEdit"));
@@ -16,15 +16,25 @@ export default function ConfigRoutes() {
if (!client.isHost) return
;
return (
-
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
-
+ <>
+
+
+
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ }
+ />
+
+
+
+
+ >
);
}