components have their own icons (?)

feat/vaults
Tomáš Mládek 2021-07-06 01:01:34 +02:00
parent 60baed5e22
commit 08f1b12143
2 changed files with 35 additions and 35 deletions

View File

@ -35,16 +35,10 @@
import UpLink from "@/components/UpLink.vue"; import UpLink from "@/components/UpLink.vue";
import Compass from "@/components/widgets/Compass.vue"; import Compass from "@/components/widgets/Compass.vue";
import Table from "@/components/widgets/Table.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 { AttributeChange, IEntry } from "@/types/base";
import { ComponentOptions, defineComponent, PropType } from "vue"; import { ComponentOptions, defineComponent, PropType } from "vue";
interface Widget {
name: string;
icon?: string;
components: ComponentOptions[];
}
export default defineComponent({ export default defineComponent({
name: "AttributeView", name: "AttributeView",
components: { components: {
@ -88,11 +82,7 @@ export default defineComponent({
const result = [] as Widget[]; const result = [] as Widget[];
if (this.type?.widgetInfo) { if (this.type?.widgetInfo) {
result.push({ result.push(this.type.widgetInfo);
name: this.type.name || this.type.address,
icon: this.type.icon,
components: this.type.widgetInfo,
});
} }
result.push({ result.push({

View File

@ -13,38 +13,48 @@ export class UpType {
return this.name ? TYPE_ICONS[this.name] : undefined; 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; return this.name ? TYPE_WIDGETS[this.name] : undefined;
} }
} }
export interface Widget {
name: string;
icon?: string;
components: ComponentOptions[];
}
const TYPE_ICONS: { [key: string]: string } = { const TYPE_ICONS: { [key: string]: string } = {
"BLOB": "box", "BLOB": "box",
"FS_FILE": "file-earmark", "FS_FILE": "file-earmark",
"FS_DIR": "folder" "FS_DIR": "folder"
} }
const TYPE_WIDGETS: { [key: string]: ComponentOptions[] } = { const TYPE_WIDGETS: { [key: string]: Widget } = {
"KSX_TRACK_MOODS": [ "KSX_TRACK_MOODS": {
{ name: "ksx-track-compass",
name: "Compass", icon: "plus-square",
id: "compass_tint_energy", components: [
props: { {
xAttrName: "KSX_TINT", name: "Compass",
yAttrName: "KSX_ENERGY", id: "compass_tint_energy",
xLabel: "Lightsoft // Heavydark", props: {
yLabel: "Chill // Extreme", 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",
}
}
]
} }