All checks were successful
Deploy baustelle-pwa / deploy (push) Successful in 1s
4.c PIN-Schutz (optional):
- Settings → Sicherheit → Toggle aktiviert PIN
- 4-stelliger Keypad-Dialog (promptPin/promptNewPin)
- SHA256 mit random Salt, beides in IndexedDB
- appBoot() Lockscreen vor Router-Start
- PIN ändern, deaktivieren jederzeit möglich
- Logout löscht PIN-Daten
4.f Seiten umsortieren:
- Long-Press (500ms) auf Seiten-Thumb → Drag-Modus
- Touch-basierter Reorder mit elementFromPoint
- Vibrationshinweis beim Drag-Start
- Beim Release: api.reorderPages + Nummern-Badges updaten
5.1 Stamps im Sketch-Editor:
- Vier vordefinierte Stempel in der Toolbar:
⚠ Achtung, ✓ OK, ✗ Mangel, 🔧 Reparatur
- Ein-Klick-Platzierung, Farbe aus Color-Picker,
weißer Outline damit sie auf jedem Bild sichtbar sind
- 96px Bold-Font
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
[deploy]
60 lines
1.7 KiB
JavaScript
60 lines
1.7 KiB
JavaScript
/* Mini Hash-Router für die PWA.
|
|
* Routen:
|
|
* #/login
|
|
* #/orders
|
|
* #/orders/<id>
|
|
* #/orders/<id>/upload
|
|
* #/settings
|
|
*/
|
|
(function () {
|
|
const routes = {};
|
|
let currentRoute = null;
|
|
|
|
function on(pattern, handler) {
|
|
// Pattern: '/orders/:id'
|
|
const re = new RegExp('^' + pattern.replace(/:[a-z]+/gi, '([^/]+)') + '$');
|
|
const params = (pattern.match(/:([a-z]+)/gi) || []).map(s => s.slice(1));
|
|
routes[pattern] = { re, params, handler };
|
|
}
|
|
|
|
async function navigate(hash) {
|
|
if (!hash) hash = window.location.hash || '#/orders';
|
|
const path = hash.replace(/^#/, '') || '/orders';
|
|
for (const key of Object.keys(routes)) {
|
|
const r = routes[key];
|
|
const m = path.match(r.re);
|
|
if (m) {
|
|
const args = {};
|
|
r.params.forEach((p, i) => { args[p] = decodeURIComponent(m[i + 1]); });
|
|
currentRoute = { pattern: key, args };
|
|
try {
|
|
await r.handler(args);
|
|
} catch (e) {
|
|
console.error(e);
|
|
showToast('Fehler: ' + e.message, 'error');
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
// Default
|
|
navigate('#/orders');
|
|
}
|
|
|
|
function go(hash) {
|
|
if (hash !== window.location.hash) {
|
|
window.location.hash = hash;
|
|
} else {
|
|
navigate(hash);
|
|
}
|
|
}
|
|
|
|
window.addEventListener('hashchange', () => navigate());
|
|
document.addEventListener('DOMContentLoaded', async () => {
|
|
if (typeof window.appBoot === 'function') {
|
|
try { await window.appBoot(); } catch (e) {}
|
|
}
|
|
navigate();
|
|
});
|
|
|
|
window.router = { on, navigate, go };
|
|
})();
|