diff --git a/ui/src/components/AttributeView.vue b/ui/src/components/AttributeView.vue new file mode 100644 index 0000000..de0612f --- /dev/null +++ b/ui/src/components/AttributeView.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/ui/src/components/widgets/Compass.vue b/ui/src/components/widgets/Compass.vue new file mode 100644 index 0000000..fbb7289 --- /dev/null +++ b/ui/src/components/widgets/Compass.vue @@ -0,0 +1,202 @@ + + + + + \ No newline at end of file diff --git a/ui/src/components/widgets/Table.vue b/ui/src/components/widgets/Table.vue index e9f7eba..13f607c 100644 --- a/ui/src/components/widgets/Table.vue +++ b/ui/src/components/widgets/Table.vue @@ -58,7 +58,7 @@ export default defineComponent({ Address, Marquee, }, - emits: ["change"], + emits: ["edit"], props: { attributes: { type: Array as PropType<[string, IEntry][]>, @@ -81,7 +81,7 @@ export default defineComponent({ }, methods: { async addEntry() { - this.$emit("change", { + this.$emit("edit", { type: "create", attribute: this.newEntryAttribute, value: this.newEntryValue, @@ -92,7 +92,7 @@ export default defineComponent({ }, async removeEntry(id: string) { if (confirm("Are you sure you want to remove the attribute?")) { - this.$emit("change", { type: "delete", id } as AttributeChange); + this.$emit("edit", { type: "delete", id } as AttributeChange); } }, }, diff --git a/ui/src/lib/entity.ts b/ui/src/lib/entity.ts index 02e6ebb..2290ae7 100644 --- a/ui/src/lib/entity.ts +++ b/ui/src/lib/entity.ts @@ -114,3 +114,11 @@ export function identify(attributes: ComputedRef<[string, IEntry][]>): ComputedR }).flat(); }); } + +export function asDict(attributes: [string, IEntry][]): { [key: string]: string } { + const result = {} as { [key: string]: string }; + attributes.map(([_, attribute]) => attribute).forEach((attribute) => { + result[attribute.attribute] = attribute.value.c; + }); + return result; +} \ No newline at end of file diff --git a/ui/src/lib/types.ts b/ui/src/lib/types.ts index 7277e80..b50b228 100644 --- a/ui/src/lib/types.ts +++ b/ui/src/lib/types.ts @@ -1,15 +1,45 @@ +import { ComponentOptions } from "vue"; export class UpType { name: string | null = null; attributes: string[] = []; - public getIcon(): string | undefined { + public get icon(): string | undefined { return this.name ? TYPE_ICONS[this.name] : undefined; } + + public get widgetInfo(): ComponentOptions[] | undefined { + return this.name ? TYPE_WIDGETS[this.name] : undefined; + } } const TYPE_ICONS: { [key: string]: string } = { "BLOB": "box", "FS_FILE": "file-earmark", "FS_DIR": "folder" +} + +const TYPE_WIDGETS: { [key: string]: ComponentOptions[] } = { + "KSX_TRACK_MOODS": [ + { + name: "Compass", + id: "compass_tint_energy", + props: { + xAttrName: "KSX_TINT", + yAttrName: "KSX_ENERGY", + xLabel: "Lightsoft // Heavydark", + yLabel: "Chill // Extreme", + } + }, + { + name: "Compass", + id: "compass_seriousness_materials", + props: { + xAttrName: "KSX_SERIOUSNESS", + yAttrName: "KSX_MATERIALS", + xLabel: "Dionysia // Apollonia", + yLabel: "Natural // Reinforced", + } + } + ] } \ No newline at end of file diff --git a/ui/src/views/Inspect.vue b/ui/src/views/Inspect.vue index 29dabfb..d1ace7b 100644 --- a/ui/src/views/Inspect.vue +++ b/ui/src/views/Inspect.vue @@ -14,23 +14,26 @@ :key="typeAddr" >

- + {{ types[typeAddr]?.name || "???" }}

- +

Other attributes

-