This commit is contained in:
Mateusz Gruszczyński
2026-07-20 15:59:15 +02:00
parent 771494671b
commit dfa0828c38
42 changed files with 964 additions and 755 deletions
+7 -7
View File
@@ -1,4 +1,4 @@
import { api } from "./api.js?v=0.6.0";
import { api } from "@rustpad/api";
function slugify(value, fallback) {
return value.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || fallback;
@@ -21,7 +21,7 @@ function setBusy(button, busy, idleText, busyText) {
button.textContent = busy ? busyText : idleText;
}
bindPreview("#pad-name", "#pad-slug-preview", "#pad-name-count", "/p/", "notatka");
bindPreview("#pad-name", "#pad-slug-preview", "#pad-name-count", "/p/", "note");
bindPreview("#workspace-name", "#workspace-slug-preview", "#workspace-name-count", "/w/", "workspace");
document.querySelectorAll(".password-toggle").forEach((button) => {
@@ -29,7 +29,7 @@ document.querySelectorAll(".password-toggle").forEach((button) => {
const input = document.getElementById(button.dataset.target);
const show = input.type === "password";
input.type = show ? "text" : "password";
button.textContent = show ? "Ukryj" : "Pokaż";
button.textContent = show ? "Hide" : "Show";
});
});
@@ -40,7 +40,7 @@ document.querySelector("#pad-form").addEventListener("submit", async (event) =>
const button = document.querySelector("#pad-button");
const error = document.querySelector("#pad-error");
error.textContent = "";
setBusy(button, true, "Utwórz notatkę", "Tworzenie…");
setBusy(button, true, "Create note", "Creating…");
try {
const payload = { name: name.value.trim() };
if (password.value) payload.password = password.value;
@@ -50,7 +50,7 @@ document.querySelector("#pad-form").addEventListener("submit", async (event) =>
} catch (requestError) {
error.textContent = requestError.message;
} finally {
setBusy(button, false, "Utwórz notatkę", "Tworzenie…");
setBusy(button, false, "Create note", "Creating…");
}
});
@@ -61,7 +61,7 @@ document.querySelector("#workspace-form").addEventListener("submit", async (even
const button = document.querySelector("#workspace-button");
const error = document.querySelector("#workspace-error");
error.textContent = "";
setBusy(button, true, "Utwórz workspace", "Tworzenie…");
setBusy(button, true, "Create workspace", "Creating…");
try {
const payload = { name: name.value.trim() };
if (password.value) payload.password = password.value;
@@ -71,6 +71,6 @@ document.querySelector("#workspace-form").addEventListener("submit", async (even
} catch (requestError) {
error.textContent = requestError.message;
} finally {
setBusy(button, false, "Utwórz workspace", "Tworzenie…");
setBusy(button, false, "Create workspace", "Creating…");
}
});