feat(web): rework mod inspector layout

Fill the viewport with a fixed sidebar of highlightable type-filter
icons over an independently scrolling tree, and let the viewer expand
into a full-height scene.
This commit is contained in:
2026-08-14 11:27:46 +08:00
parent 8ebb9211c5
commit f01bb5f99b
10 changed files with 123 additions and 100 deletions
+9 -2
View File
@@ -8,7 +8,14 @@ import type { TTSObject } from '@tts/shared';
export interface ObjectViewer {
/** The object class this viewer handles, e.g. `Card`, `Bag`. */
name: string;
component: (props: { object: TTSObject }) => ReactNode;
component: (props: ViewerProps) => ReactNode;
}
/** Props passed to every object viewer. */
export interface ViewerProps {
object: TTSObject;
/** Expand the 3D scene to fill its container instead of the default frame. */
fill?: boolean;
}
const registry = new Map<string, ObjectViewer['component']>();
@@ -24,7 +31,7 @@ export function resolveViewer(object: TTSObject): ObjectViewer['component'] {
}
/** The default viewer: a plain inspection of the object's fields. */
export function DefaultViewer({ object }: { object: TTSObject }) {
export function DefaultViewer({ object }: ViewerProps) {
return (
<dl className="grid grid-cols-1 gap-2 text-sm sm:grid-cols-2">
{Object.entries(object).map(([key, value]) => {