feat: add hub
This commit is contained in:
@@ -19,7 +19,8 @@ const state = reactive({ bookId: undefined as number | undefined, date: todayIso
|
||||
const { saving, save } = useSaveEntry({
|
||||
url: '/api/diary/reviews',
|
||||
dataKey: ['diary-reviews', 'diary-books'],
|
||||
noun: 'review',
|
||||
saved: 'Rezension gespeichert',
|
||||
failed: 'Rezension konnte nicht gespeichert werden',
|
||||
onSaved: () => emit('saved')
|
||||
})
|
||||
|
||||
@@ -34,29 +35,29 @@ function onSubmit(event: FormSubmitEvent<NewReviewInput>) {
|
||||
|
||||
<template>
|
||||
<UForm :schema="newReviewSchema" :state="state" class="space-y-5" @submit="onSubmit">
|
||||
<UFormField label="Book" name="bookId" required>
|
||||
<UFormField label="Buch" name="bookId" required>
|
||||
<USelectMenu
|
||||
v-model="state.bookId"
|
||||
:items="bookItems"
|
||||
value-key="value"
|
||||
:filter-fields="['label', 'description', 'originalTitle']"
|
||||
:loading="status === 'pending'"
|
||||
:search-input="{ placeholder: 'Title or author' }"
|
||||
placeholder="Pick a book"
|
||||
:search-input="{ placeholder: 'Titel oder Autor' }"
|
||||
placeholder="Buch auswählen"
|
||||
icon="i-lucide-book-open"
|
||||
virtualize
|
||||
class="w-full"
|
||||
/>
|
||||
</UFormField>
|
||||
|
||||
<UFormField label="Read on" name="date" help="Saved as the book's read date" required>
|
||||
<UFormField label="Gelesen am" name="date" help="Wird als Lesedatum des Buchs gespeichert" required>
|
||||
<UInput v-model="state.date" type="date" />
|
||||
</UFormField>
|
||||
|
||||
<UFormField label="Review" name="text" required>
|
||||
<UFormField label="Rezension" name="text" required>
|
||||
<UTextarea v-model="state.text" :rows="8" autoresize :maxrows="18" class="w-full" />
|
||||
</UFormField>
|
||||
|
||||
<UButton type="submit" label="Save review" :icon="REVIEW_ICON" :loading="saving" />
|
||||
<UButton type="submit" label="Rezension speichern" :icon="REVIEW_ICON" :loading="saving" />
|
||||
</UForm>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user