upend/ui/lib/types.ts

60 lines
1.3 KiB
TypeScript
Raw Normal View History

import { ComponentOptions } from "vue";
2021-06-19 17:57:09 +02:00
export class UpType {
2021-10-29 17:24:54 +02:00
address: string;
name: string | null = null;
attributes: string[] = [];
2021-06-19 17:57:09 +02:00
2021-10-29 17:24:54 +02:00
constructor(address: string) {
this.address = address;
}
2021-10-29 17:24:54 +02:00
public get icon(): string | undefined {
return this.name ? TYPE_ICONS[this.name] : undefined;
}
2021-10-29 17:24:54 +02:00
public get widgetInfo(): Widget | undefined {
return this.name ? TYPE_WIDGETS[this.name] : undefined;
}
2021-06-19 17:57:09 +02:00
}
2021-07-06 01:01:34 +02:00
export interface Widget {
2021-10-29 17:24:54 +02:00
name: string;
icon?: string;
components: ComponentOptions[];
2021-07-06 01:01:34 +02:00
}
2021-06-19 17:57:09 +02:00
const TYPE_ICONS: { [key: string]: string } = {
2021-10-29 17:24:54 +02:00
BLOB: "box",
HIER: "folder"
};
2021-07-06 01:01:34 +02:00
const TYPE_WIDGETS: { [key: string]: Widget } = {
2021-10-29 17:24:54 +02:00
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"
}
}
]
}
};