mirror of
https://git.j0bot.ch/admin_j0bot/ploxion-phares.git
synced 2026-11-29 06:55:11 +00:00
178 lines
11 KiB
PHP
178 lines
11 KiB
PHP
{{-- PL0XI0N phares ⭐ — LA VITRINE PUBLIQUE des grands chantiers (demande RS-7 12.08 :
|
||
« voir tous les gros projets phares, parce que là c'est éparpillé partout »).
|
||
≠ du ploxion roadmap (admin, todo dev) : ici un visiteur/zion comprend le paysage
|
||
en 30 secondes et saute dedans. Données = resources/data/projets-phares.json,
|
||
servies par GET /px/projets-phares.json (routes/web.php, pattern revision-heig).
|
||
Curation : docs/roadmap.md + config/ploxions.php + PapersSeeder (état RÉEL —
|
||
un projet en pause est dit en pause). Entrées : ploxion → openPx (helper canonique
|
||
shipyard), papier → /wiki/paper/slug, quête → openPx('quetes'), url → lien.
|
||
Mobile-first, zéro dépendance, style sobre var(--xr-*). --}}
|
||
<style>
|
||
.px-ph{position:absolute;inset:0;overflow-y:auto;-webkit-overflow-scrolling:touch;background:var(--xr-bg,#060810);color:var(--xr-fg,#dbe3f2);font-family:var(--xr-font-ui,ui-sans-serif,system-ui);padding:calc(env(safe-area-inset-top,0px) + 14px) 14px calc(env(safe-area-inset-bottom,0px) + 24px)}
|
||
.px-ph *{box-sizing:border-box;min-width:0}
|
||
.px-ph .hd{max-width:980px;margin:0 auto 12px}
|
||
.px-ph .hd h2{margin:0 0 4px;font-size:1.05rem;letter-spacing:.12em;color:var(--xr-text,#eef2fb)}
|
||
.px-ph .hd p{margin:0;font-size:.78rem;line-height:1.55;color:var(--xr-muted,#8aa0c8)}
|
||
.px-ph .chips{max-width:980px;margin:10px auto 14px;display:flex;gap:6px;flex-wrap:wrap}
|
||
.px-ph .chip{font:inherit;font-size:.7rem;padding:8px 12px;min-height:44px;border-radius:16px;border:1px solid var(--xr-line,#223056);background:var(--xr-card,#111a30);color:var(--xr-muted,#9fb0d0);cursor:pointer}
|
||
.px-ph .chip.on{border-color:var(--xr-accent,#6ad0ff);color:var(--xr-accent,#6ad0ff)}
|
||
.px-ph .grid{max-width:980px;margin:0 auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(290px,1fr));gap:10px}
|
||
@media (max-width:700px){.px-ph .grid{grid-template-columns:1fr}}
|
||
.px-ph .card{border:1px solid var(--xr-line,#223056);border-radius:10px;background:var(--xr-card,#0d1526);padding:13px 14px;display:flex;flex-direction:column;gap:8px}
|
||
.px-ph .top{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
|
||
.px-ph .ic{font-size:1.4rem;flex:0 0 auto}
|
||
.px-ph .nm{font-weight:700;font-size:.9rem;color:var(--xr-text,#eef2fb)}
|
||
.px-ph .badges{display:flex;gap:6px;margin-left:auto;flex:0 0 auto}
|
||
.px-ph .st{font-size:.58rem;letter-spacing:.1em;text-transform:uppercase;padding:3px 8px;border-radius:3px;border:1px solid;white-space:nowrap}
|
||
.px-ph .st.vivant{color:#7fd6a0;border-color:#7fd6a0}
|
||
.px-ph .st.chantier{color:#d7a53c;border-color:#d7a53c}
|
||
.px-ph .st.pause{color:#8894a8;border-color:#8894a8}
|
||
.px-ph .phz{font-size:.58rem;letter-spacing:.08em;padding:3px 8px;border-radius:3px;border:1px solid var(--xr-line,#2a3a60);color:var(--xr-muted,#8aa0c8);white-space:nowrap}
|
||
.px-ph .pitch{margin:0;font-size:.76rem;line-height:1.6;color:var(--xr-fg,#c6d0e4)}
|
||
.px-ph .ent{display:flex;flex-direction:column;gap:6px;margin-top:auto}
|
||
.px-ph .ent a,.px-ph .ent button{display:flex;align-items:center;font:inherit;font-size:.73rem;text-align:left;min-height:44px;padding:9px 12px;border-radius:8px;border:1px solid var(--xr-line,#223056);background:var(--xr-surface,#101a34);color:var(--xr-accent,#9fc0ff);cursor:pointer;text-decoration:none}
|
||
.px-ph .ent a:hover,.px-ph .ent button:hover{border-color:var(--xr-accent,#6ad0ff)}
|
||
.px-ph .empty{max-width:980px;margin:20px auto;font-size:.8rem;color:var(--xr-muted,#8aa0c8);text-align:center;line-height:1.6}
|
||
</style>
|
||
<script>
|
||
(function () {
|
||
'use strict';
|
||
|
||
function openPx(id) { // séquence canonique (succès, pas existence) — copiée de shipyard
|
||
try { if (window.jOSOp && window.jOSOp.openPloxion) { var r = window.jOSOp.openPloxion(id); if (r && r.ok) return; } } catch (e) {}
|
||
try { if (window.jOSMobile && window.jOSMobile.open && window.jOSMobile.open(id, id)) return; } catch (e) {}
|
||
try { if (window.jOS && window.jOS.openPloxion && window.jOS.openPloxion(id)) return; } catch (e) {}
|
||
location.href = '/local#px=' + encodeURIComponent(id);
|
||
}
|
||
function esc(s) { return window.jOSb.esc(s); }
|
||
|
||
// ===== XUI (contrat v0, bion jOSXui) : describe() PUR = l'état pour TOUTE surface =====
|
||
var lastData = null; // dernier /px/projets-phares.json chargé (partagé mount ↔ describe)
|
||
// seed embarqué = miroir de resources/data/projets-phares.json au 12.08 (fallback
|
||
// honnête tant que rien n'est fetché — même pattern que le SEED de xerbot)
|
||
var XUI_SEED = [
|
||
{ n: '🛸 Space Cubion', e: 'vivant' }, { n: '🪐 Le Nexus = RepoVerse', e: 'en chantier' },
|
||
{ n: '📍 La Carte ultime', e: 'vivant' }, { n: '⧗ La Machine à tsoins', e: 'vivant' },
|
||
{ n: '💽 Xerboxion-OS bare-metal', e: 'en chantier' }, { n: '🔮 La Forge', e: 'vivant' },
|
||
{ n: '🎓 Révision HEIG', e: 'vivant' }, { n: '📱 L\'app iPhone', e: 'en chantier' },
|
||
{ n: '🚀 Le Jeu — ère spatiale', e: 'vivant' }, { n: '⟁ Le langage des glyphes', e: 'vivant' },
|
||
{ n: '👥 Le social souverain', e: 'en chantier' }, { n: '🧬 L\'Adressage Génératif', e: 'vivant' },
|
||
{ n: '🧠 Le Xerbion (Rosa)', e: 'pause' }, { n: '🚜 Xerfarm', e: 'vivant' }, { n: '🤖 Xerbot', e: 'en chantier' }
|
||
];
|
||
function describe() {
|
||
var list = (lastData && Array.isArray(lastData.phares))
|
||
? lastData.phares.map(function (p) { return { n: ((p.icone ? p.icone + ' ' : '') + (p.nom || '')).trim(), e: p.etat || '' }; })
|
||
: XUI_SEED;
|
||
var vivants = 0;
|
||
list.forEach(function (p) { if (p.e === 'vivant') vivants++; });
|
||
// révélation progressive : la montre voit p1 (le compte), le téléphone la
|
||
// liste (vivants d'abord, max 7 — contrat), le desktop peut ouvrir la galerie
|
||
var ordre = { 'vivant': 0, 'en chantier': 1, 'pause': 2 };
|
||
var tri = list.slice().sort(function (a, b) { return (ordre[a.e] != null ? ordre[a.e] : 3) - (ordre[b.e] != null ? ordre[b.e] : 3); });
|
||
return {
|
||
v: 1, id: 'phares', title: 'Phares', icon: '⭐',
|
||
items: [
|
||
{ p: 1, kind: 'stat', label: 'chantiers vivants', value: vivants, unit: '/' + list.length },
|
||
{ p: 2, kind: 'list', label: 'les phares', items: tri.slice(0, 7).map(function (p) { return { label: p.n, value: p.e }; }) },
|
||
{ p: 3, kind: 'action', label: 'ouvrir la galerie', act: { port: 'ploxion.phares.open', payload: { id: 'phares' } } }
|
||
]
|
||
};
|
||
}
|
||
|
||
function mount(container) {
|
||
var root = document.createElement('div');
|
||
root.className = 'px-ph';
|
||
root.innerHTML =
|
||
'<div class="hd"><h2>⭐ PROJETS PHARES</h2>' +
|
||
'<p>Le xerboxion en un coup d’œil — les grands chantiers et où sauter dedans.</p></div>' +
|
||
'<div class="chips" data-chips></div>' +
|
||
'<div class="grid" data-grid></div>' +
|
||
'<div class="empty" data-empty style="display:none"></div>';
|
||
container.appendChild(root);
|
||
|
||
var data = null;
|
||
var filtre = { etat: null, phase: null }; // null = tout
|
||
var aborter = ('AbortController' in window) ? new AbortController() : null;
|
||
|
||
function badge(etat) {
|
||
if (etat === 'vivant') return '<span class="st vivant">vivant</span>';
|
||
if (etat === 'en chantier') return '<span class="st chantier">en chantier</span>';
|
||
return '<span class="st pause">pause</span>';
|
||
}
|
||
|
||
function entree(e) {
|
||
var label = esc(e.label || e.id_ou_url);
|
||
if (e.type === 'url') {
|
||
var ext = /^https?:\/\//.test(e.id_ou_url);
|
||
return '<a href="' + esc(e.id_ou_url) + '"' + (ext ? ' target="_blank" rel="noopener"' : '') + '>' + label + '</a>';
|
||
}
|
||
if (e.type === 'papier') return '<a href="/wiki/paper/' + esc(e.id_ou_url) + '">' + label + '</a>';
|
||
if (e.type === 'quete') return '<button data-px="quetes">' + label + '</button>';
|
||
return '<button data-px="' + esc(e.id_ou_url) + '">' + label + '</button>'; // type ploxion
|
||
}
|
||
|
||
function chipsHtml() {
|
||
var etats = ['vivant', 'en chantier', 'pause'];
|
||
var phases = [];
|
||
(data.phares || []).forEach(function (p) { if (p.phase && phases.indexOf(p.phase) < 0) phases.push(p.phase); });
|
||
phases.sort(function (a, b) { return a - b; });
|
||
var h = '<button class="chip' + (filtre.etat === null && filtre.phase === null ? ' on' : '') + '" data-f="tout">tout</button>';
|
||
etats.forEach(function (e) { h += '<button class="chip' + (filtre.etat === e ? ' on' : '') + '" data-f="etat" data-v="' + esc(e) + '">' + esc(e) + '</button>'; });
|
||
phases.forEach(function (p) {
|
||
var t = (data.phases && data.phases[p]) ? ' · ' + data.phases[p] : '';
|
||
h += '<button class="chip' + (filtre.phase === p ? ' on' : '') + '" data-f="phase" data-v="' + p + '" title="' + esc(t) + '">phase ' + p + '</button>';
|
||
});
|
||
return h;
|
||
}
|
||
|
||
function render() {
|
||
root.querySelector('[data-chips]').innerHTML = chipsHtml();
|
||
root.querySelectorAll('[data-chips] .chip').forEach(function (c) {
|
||
c.onclick = function () {
|
||
var f = c.getAttribute('data-f');
|
||
if (f === 'tout') { filtre.etat = null; filtre.phase = null; }
|
||
else if (f === 'etat') { var v = c.getAttribute('data-v'); filtre.etat = (filtre.etat === v) ? null : v; }
|
||
else { var n = +c.getAttribute('data-v'); filtre.phase = (filtre.phase === n) ? null : n; }
|
||
render();
|
||
};
|
||
});
|
||
var list = (data.phares || []).filter(function (p) {
|
||
if (filtre.etat && p.etat !== filtre.etat) return false;
|
||
if (filtre.phase && p.phase !== filtre.phase) return false;
|
||
return true;
|
||
});
|
||
var grid = root.querySelector('[data-grid]');
|
||
grid.innerHTML = list.map(function (p) {
|
||
return '<div class="card">' +
|
||
'<div class="top"><span class="ic">' + esc(p.icone) + '</span><span class="nm">' + esc(p.nom) + '</span>' +
|
||
'<span class="badges">' + badge(p.etat) + (p.phase ? '<span class="phz">phase ' + (+p.phase) + '</span>' : '') + '</span></div>' +
|
||
'<p class="pitch">' + esc(p.pitch) + '</p>' +
|
||
'<div class="ent">' + (p.entrees || []).map(entree).join('') + '</div>' +
|
||
'</div>';
|
||
}).join('');
|
||
grid.querySelectorAll('[data-px]').forEach(function (b) {
|
||
b.onclick = function () { openPx(b.getAttribute('data-px')); };
|
||
});
|
||
var emptyEl = root.querySelector('[data-empty]');
|
||
emptyEl.style.display = list.length ? 'none' : 'block';
|
||
if (!list.length) emptyEl.textContent = 'Aucun phare avec ce filtre — tape « tout ».';
|
||
}
|
||
|
||
fetch('/px/projets-phares.json', aborter ? { signal: aborter.signal } : {})
|
||
.then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.json(); })
|
||
.then(function (j) { data = j; lastData = j; render(); })
|
||
.catch(function (err) {
|
||
if (err && err.name === 'AbortError') return;
|
||
root.querySelector('[data-empty]').style.display = 'block';
|
||
root.querySelector('[data-empty]').textContent = 'Les projets phares ne sont pas chargeables pour le moment (' + (err && err.message ? err.message : 'réseau') + '). Réessaie plus tard.';
|
||
});
|
||
|
||
var wikiWl = window.jOSWikiLink ? window.jOSWikiLink.auto(root) : null; // auto-liens wiki
|
||
return { unmount: function () { if (wikiWl) { try { wikiWl.stop(); } catch (e) {} } if (aborter) { try { aborter.abort(); } catch (e) {} } container.innerHTML = ''; } };
|
||
}
|
||
|
||
window.jOSApps = window.jOSApps || {};
|
||
window.jOSApps['phares'] = { manifest: { id: 'phares', name: 'Projets phares', icon: '⭐' }, mount: mount, describe: describe };
|
||
})();
|
||
</script>
|