Zmiana aplikacji na wersje lang
This commit is contained in:
+25
-3
@@ -43,6 +43,10 @@ import {
|
||||
saveUserName,
|
||||
startGeoBootstrap,
|
||||
} from "./modules/geo.js";
|
||||
import {
|
||||
createLanguagePicker,
|
||||
initI18n,
|
||||
} from "./modules/i18n.js";
|
||||
import {
|
||||
getHashParam,
|
||||
setHashParam,
|
||||
@@ -51,13 +55,32 @@ import {
|
||||
} from "./modules/state.js";
|
||||
import { showToast } from "./modules/toast.js";
|
||||
|
||||
initI18n();
|
||||
|
||||
function mountLanguagePickers() {
|
||||
const mounts = [
|
||||
["geoLangPickerMount", "geoLang"],
|
||||
["headerLangPickerMount", "headerLang"],
|
||||
["menuLangPickerMount", "menuLang"],
|
||||
];
|
||||
|
||||
mounts.forEach(([mountId, prefix]) => {
|
||||
const mount = document.getElementById(mountId);
|
||||
if (!mount || mount.dataset.ready) return;
|
||||
const picker = createLanguagePicker({ idPrefix: prefix });
|
||||
mount.appendChild(picker.el);
|
||||
mount.dataset.ready = "1";
|
||||
});
|
||||
}
|
||||
|
||||
mountLanguagePickers();
|
||||
|
||||
// Parse URL into shared state
|
||||
const params = new URLSearchParams(location.search);
|
||||
setHashParam((params.get("h") || "").trim());
|
||||
setIsStaffPreview(params.get("preview") === "staff");
|
||||
setTableParam(""); // Puste, zostanie uzupełnione przez backend
|
||||
setTableParam("");
|
||||
|
||||
// Jeśli brak hasha w URL – zapytaj użytkownika (np. do testów)
|
||||
if (!getHashParam()) {
|
||||
const input = prompt("Podaj bezpieczny hash stolika (wymagane):");
|
||||
const trimmed = (input || "").trim();
|
||||
@@ -73,7 +96,6 @@ setProtectedActionHandlers({
|
||||
bill: openBillDialogInternal,
|
||||
});
|
||||
|
||||
// window.* for inline onclick in app.php
|
||||
window.saveUserName = saveUserName;
|
||||
window.declineUserName = declineUserName;
|
||||
window.handleGeoMenuClick = handleGeoMenuClick;
|
||||
|
||||
Reference in New Issue
Block a user