improved error message readability
This commit is contained in:
@@ -20,18 +20,18 @@ import { ApplicationData } from '@/api/application';
|
|||||||
|
|
||||||
const formSchema = toTypedSchema(z.object({
|
const formSchema = toTypedSchema(z.object({
|
||||||
dob: z.string().refine(v => v, { message: "A date of birth is required." }),
|
dob: z.string().refine(v => v, { message: "A date of birth is required." }),
|
||||||
name: z.string(),
|
name: z.string().nonempty(),
|
||||||
playtime: z.coerce.number({ invalid_type_error: "Must be a number", }).min(0, "Cannot be less than 0"),
|
playtime: z.coerce.number({ invalid_type_error: "Must be a number", }).min(0, "Cannot be less than 0"),
|
||||||
hobbies: z.string(),
|
hobbies: z.string().nonempty(),
|
||||||
military: z.boolean(),
|
military: z.boolean(),
|
||||||
communities: z.string(),
|
communities: z.string().nonempty(),
|
||||||
joinReason: z.string(),
|
joinReason: z.string().nonempty(),
|
||||||
milsimAttraction: z.string(),
|
milsimAttraction: z.string().nonempty(),
|
||||||
referral: z.string(),
|
referral: z.string().nonempty(),
|
||||||
steamProfile: z.string(),
|
steamProfile: z.string().nonempty(),
|
||||||
timezone: z.string(),
|
timezone: z.string().nonempty(),
|
||||||
canAttendSaturday: z.boolean(),
|
canAttendSaturday: z.boolean(),
|
||||||
interests: z.string(),
|
interests: z.string().nonempty(),
|
||||||
aknowledgeRules: z.literal(true, {
|
aknowledgeRules: z.literal(true, {
|
||||||
errorMap: () => ({ message: "Required" })
|
errorMap: () => ({ message: "Required" })
|
||||||
}),
|
}),
|
||||||
@@ -82,7 +82,9 @@ onMounted(() => {
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<DateInput :model-value="(value as string) ?? ''" :disabled="readOnly" @update:model-value="handleChange" />
|
<DateInput :model-value="(value as string) ?? ''" :disabled="readOnly" @update:model-value="handleChange" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -94,7 +96,9 @@ onMounted(() => {
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<Input :model-value="value" @update:model-value="handleChange" :disabled="readOnly" />
|
<Input :model-value="value" @update:model-value="handleChange" :disabled="readOnly" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -105,7 +109,9 @@ onMounted(() => {
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<Input type="number" :model-value="value" @update:model-value="handleChange" :disabled="readOnly" />
|
<Input type="number" :model-value="value" @update:model-value="handleChange" :disabled="readOnly" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -117,7 +123,9 @@ onMounted(() => {
|
|||||||
<Textarea rows="4" class="resize-none" :model-value="value" @update:model-value="handleChange"
|
<Textarea rows="4" class="resize-none" :model-value="value" @update:model-value="handleChange"
|
||||||
:disabled="readOnly" />
|
:disabled="readOnly" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -131,7 +139,9 @@ onMounted(() => {
|
|||||||
<span>Yes (checked) / No (unchecked)</span>
|
<span>Yes (checked) / No (unchecked)</span>
|
||||||
</div>
|
</div>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -142,7 +152,9 @@ onMounted(() => {
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<Input :model-value="value" @update:model-value="handleChange" :disabled="readOnly" />
|
<Input :model-value="value" @update:model-value="handleChange" :disabled="readOnly" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -154,7 +166,9 @@ onMounted(() => {
|
|||||||
<Textarea rows="4" class="resize-none" :model-value="value" @update:model-value="handleChange"
|
<Textarea rows="4" class="resize-none" :model-value="value" @update:model-value="handleChange"
|
||||||
:disabled="readOnly" />
|
:disabled="readOnly" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -166,7 +180,9 @@ onMounted(() => {
|
|||||||
<Textarea rows="4" class="resize-none" :model-value="value" @update:model-value="handleChange"
|
<Textarea rows="4" class="resize-none" :model-value="value" @update:model-value="handleChange"
|
||||||
:disabled="readOnly" />
|
:disabled="readOnly" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -178,7 +194,9 @@ onMounted(() => {
|
|||||||
<Input placeholder="e.g., Reddit / Member: Alice" :model-value="value" @update:model-value="handleChange"
|
<Input placeholder="e.g., Reddit / Member: Alice" :model-value="value" @update:model-value="handleChange"
|
||||||
:disabled="readOnly" />
|
:disabled="readOnly" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -194,7 +212,9 @@ onMounted(() => {
|
|||||||
<Input type="url" placeholder="https://steamcommunity.com/profiles/7656119..." :model-value="value"
|
<Input type="url" placeholder="https://steamcommunity.com/profiles/7656119..." :model-value="value"
|
||||||
@update:model-value="handleChange" :disabled="readOnly" />
|
@update:model-value="handleChange" :disabled="readOnly" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -206,7 +226,9 @@ onMounted(() => {
|
|||||||
<Input placeholder="e.g., AEST, EST, UTC+10" :model-value="value" @update:model-value="handleChange"
|
<Input placeholder="e.g., AEST, EST, UTC+10" :model-value="value" @update:model-value="handleChange"
|
||||||
:disabled="readOnly" />
|
:disabled="readOnly" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -220,7 +242,9 @@ onMounted(() => {
|
|||||||
<span>Yes (checked) / No (unchecked)</span>
|
<span>Yes (checked) / No (unchecked)</span>
|
||||||
</div>
|
</div>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -232,7 +256,9 @@ onMounted(() => {
|
|||||||
<Input placeholder="e.g., Rifleman; Medic; Pilot" :model-value="value" @update:model-value="handleChange"
|
<Input placeholder="e.g., Rifleman; Medic; Pilot" :model-value="value" @update:model-value="handleChange"
|
||||||
:disabled="readOnly" />
|
:disabled="readOnly" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@@ -243,11 +269,13 @@ onMounted(() => {
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<Checkbox :model-value="value" @update:model-value="handleChange" :disabled="readOnly" />
|
<Checkbox :model-value="value" @update:model-value="handleChange" :disabled="readOnly" />
|
||||||
<span>By checking this box, you accept the <Button variant="link" class="p-0">Code of
|
<span>By checking this box, you accept the <Button variant="link" class="p-0 h-min">Code of
|
||||||
Conduct</Button>.</span>
|
Conduct</Button>.</span>
|
||||||
</div>
|
</div>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<div class="h-4">
|
||||||
|
<FormMessage class="text-destructive" />
|
||||||
|
</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ async function handleDeny(id) {
|
|||||||
<div v-else class="flex flex-row justify-between items-center py-2 mb-8">
|
<div v-else class="flex flex-row justify-between items-center py-2 mb-8">
|
||||||
<h3 class="scroll-m-20 text-2xl font-semibold tracking-tight">Apply to join the 17th Rangers</h3>
|
<h3 class="scroll-m-20 text-2xl font-semibold tracking-tight">Apply to join the 17th Rangers</h3>
|
||||||
</div>
|
</div>
|
||||||
<ApplicationForm :read-only="readOnly" :data="appData" @submit="(e) => { postApp(e) }" class="mb-7">
|
<ApplicationForm :read-only="readOnly" :data="appData" @submit="(e) => { postApp(e) }" class="mb-7 pb-15">
|
||||||
</ApplicationForm>
|
</ApplicationForm>
|
||||||
<div v-if="!newApp">
|
<div v-if="!newApp">
|
||||||
<h3 class="scroll-m-20 text-2xl font-semibold tracking-tight mb-4">Discussion</h3>
|
<h3 class="scroll-m-20 text-2xl font-semibold tracking-tight mb-4">Discussion</h3>
|
||||||
|
|||||||
Reference in New Issue
Block a user