Files
maturity/index.html
2025-09-29 21:31:55 +02:00

111 lines
4.7 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Agile Maturity</title>
<link rel="icon" href="data:,">
<style>
:root{--bg:#0b0d10;--card:#12161b;--text:#e6edf3;--muted:#9da7b3;--brand:#5bb8ff;--accent:#7ee787;--danger:#ff6666}
*{box-sizing:border-box}
body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;background:var(--bg);color:var(--text)}
header{padding:20px}
.container{max-width:960px;margin:0 auto;padding:20px}
.card{background:var(--card);border:1px solid #222831;border-radius:12px;padding:20px}
h1{margin:0 0 8px;font-size:24px}
p{margin:0 0 16px;color:var(--muted)}
.grid{display:grid;gap:16px;grid-template-columns:repeat(auto-fit,minmax(240px,1fr))}
a.tile{display:block;padding:16px;border-radius:10px;background:#141a21;border:1px solid #1f2630;color:var(--text);text-decoration:none}
a.tile:hover{border-color:#2a3442;background:#161d25}
.small{font-size:12px;color:var(--muted)}
code.inline{background:#0d1117;border:1px solid #1f2630;border-radius:6px;padding:2px 6px}
footer{opacity:.7;margin-top:24px;font-size:12px}
.row{display:flex;gap:12px;flex-wrap:wrap}
input[type="text"]{background:#0d1117;border:1px solid #1f2630;border-radius:8px;padding:10px;color:var(--text);width:100%;}
button{background:var(--brand);color:#00111f;border:0;border-radius:8px;padding:10px 14px;cursor:pointer;font-weight:600}
button.secondary{background:#232b36;color:var(--text);border:1px solid #2c3644}
pre{background:#0d1117;border:1px solid #1f2630;border-radius:10px;padding:12px;overflow:auto}
</style>
</head>
<body>
<header class="container">
<h1>Agile Maturity</h1>
<p>Manage companies, teams and assessments stored as JSON files.</p>
</header>
<main class="container">
<section class="card" id="app">
<div class="grid">
<a class="tile" href="company/index.html">
<h3>Companies</h3>
<p class="small">Create or load a company file</p>
</a>
<a class="tile" href="team/index.html">
<h3>Teams</h3>
<p class="small">Create or load a team file</p>
</a>
</div>
<hr style="border:none;border-top:1px solid #222831;margin:20px 0">
<div>
<h3>Configuration</h3>
<p class="small">Reads <code class="inline">config.json</code> at project root.</p>
<div class="row">
<button class="secondary" id="reloadCfg">Reload config</button>
<button id="openCfg">Open config.json</button>
</div>
<pre id="cfgOut">Loading config...</pre>
</div>
</section>
<footer>Single-file static app — no backend required.</footer>
</main>
<script>
function migrateLegacy(){
try{
const migrated = localStorage.getItem('migratedFromLegacy');
const hasCompanies = JSON.parse(localStorage.getItem('companies')||'[]').length>0;
const legacy = JSON.parse(localStorage.getItem('agileMaturity')||'null');
if(migrated || hasCompanies || !legacy){ return; }
const companyId = (crypto&&crypto.randomUUID)?crypto.randomUUID():'id-'+Math.random().toString(36).slice(2);
const company = {
id: companyId,
name: legacy.org?.name || 'Organisation',
domain: legacy.org?.sector || '',
createdAt: new Date().toISOString(),
version: 1
};
const teams = (legacy.teams||[]).map(t=>({
id: t.id || ((crypto&&crypto.randomUUID)?crypto.randomUUID():'id-'+Math.random().toString(36).slice(2)),
companyId,
name: t.name || 'Equipe',
coach: t.lead || '',
createdAt: t.createdAt || new Date().toISOString(),
version: 1
}));
localStorage.setItem('companies', JSON.stringify([company]));
localStorage.setItem('teams', JSON.stringify(teams));
localStorage.setItem('migratedFromLegacy', 'true');
}catch(e){ console.warn('Legacy migration skipped:', e); }
}
async function loadConfig(){
const out = document.getElementById('cfgOut');
try{
const res = await fetch('config.json', {cache:'no-store'});
if(!res.ok) throw new Error('HTTP '+res.status);
const cfg = await res.json();
out.textContent = JSON.stringify(cfg, null, 2);
}catch(err){
out.textContent = 'Could not load config.json. '+err.message;
}
}
document.getElementById('reloadCfg').addEventListener('click', loadConfig);
document.getElementById('openCfg').addEventListener('click', ()=>{
window.location.href = 'config.json';
});
migrateLegacy();
loadConfig();
</script>
</body>
</html>