From 08f1b12143cf4abc66870eeb4c2cd089166143d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Tue, 6 Jul 2021 01:01:34 +0200 Subject: [PATCH] components have their own icons (?) --- ui/src/components/AttributeView.vue | 14 ++------ ui/src/lib/types.ts | 56 +++++++++++++++++------------ 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/ui/src/components/AttributeView.vue b/ui/src/components/AttributeView.vue index 6cc4aae..df5d071 100644 --- a/ui/src/components/AttributeView.vue +++ b/ui/src/components/AttributeView.vue @@ -35,16 +35,10 @@ import UpLink from "@/components/UpLink.vue"; import Compass from "@/components/widgets/Compass.vue"; import Table from "@/components/widgets/Table.vue"; -import { UpType } from "@/lib/types"; +import { UpType, Widget } from "@/lib/types"; import { AttributeChange, IEntry } from "@/types/base"; import { ComponentOptions, defineComponent, PropType } from "vue"; -interface Widget { - name: string; - icon?: string; - components: ComponentOptions[]; -} - export default defineComponent({ name: "AttributeView", components: { @@ -88,11 +82,7 @@ export default defineComponent({ const result = [] as Widget[]; if (this.type?.widgetInfo) { - result.push({ - name: this.type.name || this.type.address, - icon: this.type.icon, - components: this.type.widgetInfo, - }); + result.push(this.type.widgetInfo); } result.push({ diff --git a/ui/src/lib/types.ts b/ui/src/lib/types.ts index fb40f90..3b9f647 100644 --- a/ui/src/lib/types.ts +++ b/ui/src/lib/types.ts @@ -13,38 +13,48 @@ export class UpType { return this.name ? TYPE_ICONS[this.name] : undefined; } - public get widgetInfo(): ComponentOptions[] | undefined { + public get widgetInfo(): Widget | undefined { return this.name ? TYPE_WIDGETS[this.name] : undefined; } } +export interface Widget { + name: string; + icon?: string; + components: ComponentOptions[]; +} + 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", +const TYPE_WIDGETS: { [key: string]: Widget } = { + "KSX_TRACK_MOODS": { + name: "ksx-track-compass", + icon: "plus-square", + components: [ + { + 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", + } } - }, - { - 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