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:
@@ -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]) => {
|
||||
|
||||
Reference in New Issue
Block a user