Polish the SPA: focus rings, reduced motion, forms that report errors
Test and deploy / test (push) Successful in 1m10s
Test and deploy / deploy (push) Successful in 58s

- Global :focus-visible ring (text fields get a border instead) and a
  prefers-reduced-motion override; the navbar marquee stops for it too.
- Button: disabled state and horizontal padding.
- useCreateForm returns error and submitting, so the create forms show a
  refused save inline and can't double-submit; they, Login, CreatePlace and
  CreateUser are real <form>s so Enter submits from any field.
- Admin: section list wraps on phones, Manage Users is a table with errors,
  Manage Radio confirms before deleting, page delete errors show inline.
- Hard-coded Tailwind colours replaced with tokens; 404 image alt text and
  no forced scrollbars.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-23 20:11:05 +01:00
co-authored by Claude Opus 5.5
parent 3fa456a063
commit 8c535b1cc2
19 changed files with 271 additions and 128 deletions
+20 -4
View File
@@ -1,8 +1,11 @@
// The shared body of the admin "create X" forms (CreatePost, CreateFavorite,
// CreateActivity, CreateBookmark): a ref per field, a GraphQL mutation taking a
// single `input`, clear the fields on success, then emit "done" so the host
// modal can close. Failures are logged and leave the fields alone, exactly as
// the hand-written versions did.
// modal can close. A failure leaves the fields alone and its message on
// `error` for the form to show — it used to go only to the console, so a
// refused save looked exactly like a button that did nothing. `submitting`
// disables the button while the request is out, and a second submit in that
// window is ignored, so a double click cannot create the row twice.
import { ref } from "vue";
import { gql } from "@/graphql";
@@ -15,7 +18,12 @@ import { gql } from "@/graphql";
* @param {string[]} [options.optional] fields sent as undefined when blank,
* so the backend sees "not set" rather than an empty string
* @param {string} [options.resultKey] mutation field to log on success
* @returns {{ values: Record<string, import("vue").Ref<string>>, submit: () => Promise<void> }}
* @returns {{
* values: Record<string, import("vue").Ref<string>>,
* submit: () => Promise<void>,
* error: import("vue").Ref<string>,
* submitting: import("vue").Ref<boolean>,
* }}
*/
export function useCreateForm({
mutation,
@@ -25,8 +33,13 @@ export function useCreateForm({
resultKey,
}) {
const values = Object.fromEntries(fields.map((name) => [name, ref("")]));
const error = ref("");
const submitting = ref(false);
async function submit() {
if (submitting.value) return;
submitting.value = true;
error.value = "";
try {
const input = {};
for (const name of fields) {
@@ -39,8 +52,11 @@ export function useCreateForm({
emit("done");
} catch (err) {
console.error(err);
error.value = err?.message || "Failed to save";
} finally {
submitting.value = false;
}
}
return { values, submit };
return { values, submit, error, submitting };
}