- 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]>
34 lines
1.1 KiB
Vue
34 lines
1.1 KiB
Vue
<script setup>
|
|
/**
|
|
* Admin form: create a favourite. Emits "done"/"cancel" (see CreatePost.vue).
|
|
*/
|
|
import Button from "@/components/input/Button.vue";
|
|
import { useCreateForm } from "@/js/useCreateForm";
|
|
|
|
|
|
const emit = defineEmits(["done", "cancel"]);
|
|
|
|
const { values, submit: post, error, submitting } = useCreateForm({
|
|
mutation: `mutation CreateFavorite($input: CreateFavoriteInput!) { createFavorite(input: $input) { id } }`,
|
|
fields: ["type", "name", "link"],
|
|
optional: ["link"],
|
|
resultKey: "createFavorite",
|
|
emit,
|
|
});
|
|
const { type, name, link } = values;
|
|
</script>
|
|
|
|
<template>
|
|
<form class="flex flex-col" @submit.prevent="post">
|
|
<h1>Create Favorite</h1>
|
|
<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>
|