feat: implement file existence check and improve file upload handling
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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 />;
|
||||
|
||||
Reference in New Issue
Block a user