clean exemple/navigation to a minimal working example

- index.html: fix title and typo, add missing #error div
- config.json: replace project-specific keys with generic api_url
- core/menu.js: remove Voltalis mock data, leave commented usage pattern
- dashboard.js: move logic to init(), Custom Element is a plain shell
- dashboard.css: add real styles, remove placeholder comment
- manifest.json: drop unused version field
- config.yml: fix web/vendor comment → sources/vendor

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-06-07 15:09:02 +02:00
commit 1891ba3d68
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
9 changed files with 43 additions and 50 deletions

View file

@ -1,37 +1,10 @@
// Dynamic menu loader.
// Fetches data for groups declared with empty children in navigation.json
// and injects them into side-nav after it is ready.
//
// Dynamic menu loader — injects children into named groups in the side-nav.
// Imported non-blocking from index.html — does not delay routing.
// Replace MOCK_* with real api-client calls when the backend is ready.
// ── Mock data ────────────────────────────────────────────────────────────────
const MOCK_ACCOUNTS = [
{ id: 'tresorerie', name: 'Trésorerie' },
{ id: 'charges', name: 'Charges' },
{ id: 'produits', name: 'Produits' },
{ id: 'fournisseurs', name: 'Fournisseurs' },
]
async function fetchAccounts() {
// TODO: replace with real call
// const api = document.querySelector('api-client')
// return await api.finance.list('/accounts')
await new Promise(r => setTimeout(r, 500)) // simulate network latency
return MOCK_ACCOUNTS
}
// ── Injection ────────────────────────────────────────────────────────────────
const nav = document.querySelector('side-nav')
if (!nav) throw new Error('menu.js: side-nav not found in DOM')
await nav.ready
const accounts = await fetchAccounts()
nav.setGroupChildren('Comptes', accounts.map(a => ({
label: a.name,
href: `#/account?id=${a.id}`,
icon: 'account',
})))
//
// Example: populate a group declared in config.yml.
//
// const nav = document.querySelector('side-nav')
// await nav.ready
// nav.setGroupChildren('Mon Groupe', [
// { label: 'Item A', href: '#/item-a', icon: 'folder' },
// ])