diff --git a/tgui/packages/tgui/debug/KitchenSink.tsx b/tgui/packages/tgui/debug/KitchenSink.tsx
index 3bfa77e513c..ae63ddd0633 100644
--- a/tgui/packages/tgui/debug/KitchenSink.tsx
+++ b/tgui/packages/tgui/debug/KitchenSink.tsx
@@ -4,62 +4,107 @@
* @license MIT
*/
import { useState } from 'react';
-import { Section, Stack, Tabs } from 'tgui-core/components';
-
+import { JSONTree } from 'react-json-tree';
+import { Divider, NoticeBox, Section, Stack, Tabs } from 'tgui-core/components';
+import { useBackend } from '../backend';
+import { tgui16 } from '../constants/theme';
import { Pane, Window } from '../layouts';
-const r = import.meta.webpackContext('../', {
- recursive: false,
- include: /\.stories\.tsx$/,
-});
+type Props = {
+ panel?: boolean;
+};
-/**
- * @returns {{
- * meta: {
- * title: string,
- * render: () => any,
- * },
- * }[]}
- */
-function getStories() {
- return r.keys().map((path) => r(path));
+enum Tab {
+ Config = 'config',
+ Data = 'data',
+ Shared = 'shared',
+ Chunks = 'outgoingPayloadQueues',
+ Components = 'components',
}
-export function KitchenSink(props) {
+const tabs = [
+ { name: 'Config', value: Tab.Config },
+ { name: 'Data', value: Tab.Data },
+ { name: 'Shared', value: Tab.Shared },
+ { name: 'Chunks', value: Tab.Chunks },
+] as const;
+
+export function KitchenSink(props: Props) {
const { panel } = props;
- const [pageIndex, setPageIndex] = useState(0);
- const stories = getStories();
- if (stories.length === 0) {
- return
Loading stories...
;
- }
+ const [activeTab, setActiveTab] = useState(Tab.Config);
- const story = stories[pageIndex];
const Layout = panel ? Pane : Window;
return (
-
-
-
- {stories.map((story, i) => (
- setPageIndex(i)}
- >
- {story.meta.title}
-
- ))}
-
-
+
+
+ {tabs.map((tab) => (
+ setActiveTab(tab.value)}
+ >
+ {tab.name}
+
+ ))}
+
+ setActiveTab(Tab.Components)}
+ >
+ Components
+
+
+
+
+ {activeTab === Tab.Components ? (
+
+ ) : (
+
+ )}
- {story.meta.render()}
);
}
+
+function ComponentsPage() {
+ return (
+
+ );
+}
+
+type TreeProps = {
+ tab: Tab;
+};
+
+function TreePage(props: TreeProps) {
+ const { tab } = props;
+
+ const backend = useBackend();
+ const inView = backend[tab];
+
+ return (
+
+ );
+}
diff --git a/tgui/packages/tgui/debug/middleware.ts b/tgui/packages/tgui/debug/middleware.ts
index e102362f8ff..76b55f2fcc3 100644
--- a/tgui/packages/tgui/debug/middleware.ts
+++ b/tgui/packages/tgui/debug/middleware.ts
@@ -57,7 +57,7 @@ export function relayMiddleware(store) {
} else {
acquireHotKey(KEY_F10);
globalEvents.on('keydown', (key) => {
- if (key === KEY_F10) {
+ if (key.code === KEY_F10) {
store.dispatch(openExternalBrowser());
}
});
diff --git a/tgui/packages/tgui/debug/use-debug.ts b/tgui/packages/tgui/debug/use-debug.ts
index 1f2f73edad5..88570eb9a0f 100644
--- a/tgui/packages/tgui/debug/use-debug.ts
+++ b/tgui/packages/tgui/debug/use-debug.ts
@@ -1,7 +1,7 @@
import { globalEvents } from 'tgui-core/events';
import { acquireHotKey } from 'tgui-core/hotkeys';
import { KEY_BACKSPACE, KEY_F11, KEY_F12 } from 'tgui-core/keycodes';
-import { kitchenSinkAtom, store } from '../events/store';
+import { debugLayoutAtom, kitchenSinkAtom, store } from '../events/store';
export function setDebugHotKeys(): void {
acquireHotKey(KEY_F11);
@@ -12,6 +12,10 @@ export function setDebugHotKeys(): void {
store.set(kitchenSinkAtom, (prev) => !prev);
}
+ if (evt.code === KEY_F12) {
+ store.set(debugLayoutAtom, (prev) => !prev);
+ }
+
if (evt.ctrl && evt.alt && evt.code === KEY_BACKSPACE) {
// NOTE: We need to call this in a timeout, because we need a clean
// stack in order for this to be a fatal error.