Added basic module support

This commit is contained in:
2026-04-19 18:15:39 +01:00
parent 142a7408bd
commit 1e8cf0cb78
6 changed files with 93 additions and 2 deletions

35
app/modules/clock.ts Normal file
View File

@@ -0,0 +1,35 @@
import { h, ref, onMounted, onUnmounted, defineComponent } from 'vue';
import type { DashboardModule } from '../types/module';
export const ClockModule: DashboardModule = {
name: 'clock',
width: 2,
height: 1,
render() {
return h(defineComponent({
setup() {
const time = ref(new Date().toLocaleTimeString());
let interval: any;
onMounted(() => {
interval = setInterval(() => {
time.value = new Date().toLocaleTimeString();
}, 1000);
});
onUnmounted(() => {
clearInterval(interval);
});
return () => h(
'div',
{ class: 'w-full h-full flex flex-col items-center justify-center p-5 rounded-2xl bg-white/10 backdrop-blur-md border border-white/10 shadow-lg text-white group cursor-default transition-all' },
[
h('span', { class: 'text-sm text-white/50 mb-1 uppercase tracking-widest' }, 'Local Time'),
h('span', { class: 'text-3xl font-light tracking-tight text-shadow' }, time.value)
]
);
}
}));
}
};

7
app/modules/index.ts Normal file
View File

@@ -0,0 +1,7 @@
import type { DashboardModule } from '../types/module';
import { ClockModule } from './clock';
// Register all modules here
export const modules: Record<string, DashboardModule> = {
[ClockModule.name]: ClockModule
};