Wire UI dock to crimata-dock service
- Fetch installed apps from /dock/apps on init instead of hardcoded list
- Refresh running status every 10s
- Map dock response to app format (add url: /apps/{id})
- Show running indicator dot on active apps in dock
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a825aec162
commit
ac3215abf5
3 changed files with 33 additions and 7 deletions
27
ui/js/os.js
27
ui/js/os.js
|
|
@ -122,15 +122,28 @@ document.addEventListener('alpine:init', () => {
|
|||
},
|
||||
|
||||
// ── Installed apps ────────────────────────────────────────────────────
|
||||
// Loaded from crimata.json manifests on the server
|
||||
installedApps: [
|
||||
{ id: 'bio', name: 'Bio', icon: '🪪', url: '/apps/bio' },
|
||||
{ id: 'contacts', name: 'Contacts', icon: '👥', url: '/apps/contacts' },
|
||||
{ id: 'blog', name: 'Blog', icon: '📝', url: '/apps/blog' },
|
||||
],
|
||||
installedApps: [],
|
||||
|
||||
async loadApps() {
|
||||
try {
|
||||
const res = await fetch('/dock/apps')
|
||||
const data = await res.json()
|
||||
this.installedApps = data.map(app => ({
|
||||
...app,
|
||||
url: `/apps/${app.id}`,
|
||||
}))
|
||||
} catch (e) {
|
||||
console.error('dock unreachable:', e)
|
||||
}
|
||||
},
|
||||
|
||||
// ── Init ──────────────────────────────────────────────────────────────
|
||||
init() {
|
||||
async init() {
|
||||
await this.loadApps()
|
||||
|
||||
// Refresh running status every 10s
|
||||
setInterval(() => this.loadApps(), 10_000)
|
||||
|
||||
// Open bio full-screen on load
|
||||
const bio = this.installedApps.find(a => a.id === 'bio')
|
||||
if (bio) this.openApp(bio)
|
||||
|
|
|
|||
Loading…
Reference in a new issue