Added basic module support
This commit is contained in:
33
app/components/ModuleItem.vue
Normal file
33
app/components/ModuleItem.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { modules } from '../modules/index';
|
||||
|
||||
const props = defineProps<{
|
||||
item: any
|
||||
}>();
|
||||
|
||||
const moduleDef = computed(() => modules[props.item.moduleName]);
|
||||
|
||||
// Create a render function component on the fly
|
||||
const RenderedModule = () => {
|
||||
if (moduleDef.value && typeof moduleDef.value.render === 'function') {
|
||||
return moduleDef.value.render();
|
||||
}
|
||||
return null;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="moduleDef"
|
||||
:style="{ gridColumn: `span ${moduleDef.width} / span ${moduleDef.width}`, gridRow: `span ${moduleDef.height} / span ${moduleDef.height}` }"
|
||||
>
|
||||
<RenderedModule />
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="flex items-center justify-center p-5 rounded-2xl bg-red-500/10 border border-red-500/20 text-red-400 text-sm"
|
||||
>
|
||||
Unknown Module: {{ item.moduleName }}
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user