Polish the SPA: focus rings, reduced motion, forms that report errors
- 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:
@@ -8,7 +8,7 @@ import { useCreateForm } from "@/js/useCreateForm";
|
||||
|
||||
const emit = defineEmits(["done", "cancel"]);
|
||||
|
||||
const { values, submit: post } = useCreateForm({
|
||||
const { values, submit: post, error, submitting } = useCreateForm({
|
||||
mutation: `mutation CreateActivity($input: CreateActivityInput!) { createActivity(input: $input) { id } }`,
|
||||
fields: ["type", "name", "link"],
|
||||
optional: ["link"],
|
||||
@@ -19,12 +19,15 @@ const { type, name, link } = values;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col">
|
||||
<form class="flex flex-col" @submit.prevent="post">
|
||||
<h1>Create Activity</h1>
|
||||
<input type="text" v-model="type" placeholder="Type" @keyup.enter="post" />
|
||||
<input type="text" v-model="name" placeholder="Name" @keyup.enter="post" />
|
||||
<input type="text" v-model="link" placeholder="Link" @keyup.enter="post" />
|
||||
<Button @click="post">Upload</Button>
|
||||
<Button @click="emit('cancel')">Cancel</Button>
|
||||
</div>
|
||||
<input type="text" v-model="type" placeholder="Type" />
|
||||
<input type="text" v-model="name" placeholder="Name" />
|
||||
<input type="text" v-model="link" placeholder="Link" />
|
||||
<small v-if="error" class="p-1" role="alert">{{ error }}</small>
|
||||
<Button type="submit" :disabled="submitting">
|
||||
{{ submitting ? "Uploading…" : "Upload" }}
|
||||
</Button>
|
||||
<Button type="button" @click="emit('cancel')">Cancel</Button>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user