feat: implement file existence check and improve file upload handling

This commit is contained in:
2026-04-11 00:14:45 -03:00
parent d99ab44ec2
commit c4a22a7583
7 changed files with 83 additions and 15 deletions

View File

@@ -80,7 +80,10 @@ export const CreateArticleForm = () => {
});
const title = useWatch({ control: form.control, name: 'title' });
const coverImageUrl = useWatch({ control: form.control, name: 'coverImageUrl' });
const coverImageUrl = useWatch({
control: form.control,
name: 'coverImageUrl',
});
useEffect(() => {
if (!title) return;
form.setValue('slug', slugify(title).toLowerCase());

View File

@@ -6,7 +6,6 @@ import {
FieldDescription,
FieldError,
} from '@/ui/components/shadcn/field';
import { Spinner } from '@/ui/components/shadcn/spinner';
import {
FileUpload,
FileUploadDropzone,
@@ -17,6 +16,7 @@ import {
FileUploadList,
FileUploadTrigger,
} from '@/ui/components/shadcn/file-upload';
import { Spinner } from '@/ui/components/shadcn/spinner';
import { X } from 'lucide-react';
import React, { useCallback } from 'react';

View File

@@ -18,9 +18,24 @@ export const DynamicDesktopHeader = () => {
const user = sessionData?.user;
const links = [
{ href: '/home', label: 'Home', condition: true, active: pathname === '/home' },
{ href: '/about', label: 'About', condition: true, active: pathname === '/about' },
{ href: '/admin', label: 'Admin', condition: !!user, active: pathname === '/admin' },
{
href: '/home',
label: 'Home',
condition: true,
active: pathname === '/home',
},
{
href: '/about',
label: 'About',
condition: true,
active: pathname === '/about',
},
{
href: '/admin',
label: 'Admin',
condition: !!user,
active: pathname === '/admin',
},
];
const userButton = !!user ? <UserButton user={user} /> : <div />;