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 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({

View File

@ -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",
}
}
]
]
}
}