diff --git a/app/components/dialog/delete.tsx b/app/components/dialog/delete.tsx index 04b3cfe..351e2e3 100644 --- a/app/components/dialog/delete.tsx +++ b/app/components/dialog/delete.tsx @@ -5,31 +5,21 @@ import { DialogPanel, DialogTitle, } from '@headlessui/react' -import { - useEffect, - type Dispatch, - type PropsWithChildren, - type SetStateAction, -} from 'react' +import { useEffect, type PropsWithChildren } from 'react' import toast from 'react-hot-toast' import { useFetcher } from 'react-router' import { Button } from '~/components/ui/button' -type T = { - id: string -} & any // eslint-disable-line @typescript-eslint/no-explicit-any - type TProperties = PropsWithChildren & { - selectedItem?: T - setSelectedItem: Dispatch> + selectedId?: string + close: () => void title: string fetcherAction: string } export const DialogDelete = (properties: TProperties) => { - const { selectedItem, setSelectedItem, children, title, fetcherAction } = - properties || {} + const { selectedId, close, children, title, fetcherAction } = properties || {} const fetcher = useFetcher() useEffect(() => { @@ -39,7 +29,7 @@ export const DialogDelete = (properties: TProperties) => { } if (fetcher.data?.success === true) { - setSelectedItem(undefined) + close() toast.success(`${title} berhasil dihapus!`) return } @@ -48,10 +38,10 @@ export const DialogDelete = (properties: TProperties) => { return ( { if (fetcher.state === 'idle') { - setSelectedItem(undefined) + close() } }} className="relative z-50" diff --git a/app/components/text-editor/index.tsx b/app/components/text-editor/index.tsx index dad6cf1..fdfedad 100644 --- a/app/components/text-editor/index.tsx +++ b/app/components/text-editor/index.tsx @@ -8,22 +8,16 @@ import TextStyle from '@tiptap/extension-text-style' import { EditorContent, useEditor } from '@tiptap/react' import StarterKit from '@tiptap/starter-kit' import { useEffect, useId, useState } from 'react' -import { - get, - type FieldError, - type FieldValues, - type Path, - type RegisterOptions, -} from 'react-hook-form' +import { get, type FieldError, type RegisterOptions } from 'react-hook-form' import { useRemixFormContext } from 'remix-hook-form' import { twMerge } from 'tailwind-merge' import { EditorMenuBar } from './editor-menubar' import { EditorTextArea } from './editor-textarea' -type TProperties = { +type TProperties = { id?: string - name: Path + name: string label?: string placeholder?: string labelClassName?: string @@ -36,9 +30,7 @@ type TProperties = { category: string } -export const TextEditor = >( - properties: TProperties, -) => { +export const TextEditor = (properties: TProperties) => { const { id, label, @@ -92,7 +84,7 @@ export const TextEditor = >( immediatelyRender: false, content: watchContent, onUpdate: ({ editor }) => { - setValue(name, editor.getHTML() as any) // eslint-disable-line @typescript-eslint/no-explicit-any + setValue(name, editor.getHTML() as string) }, }) useEffect(() => { diff --git a/app/pages/dashboard-advertisements/index.tsx b/app/pages/dashboard-advertisements/index.tsx index 956a9e3..e42cd53 100644 --- a/app/pages/dashboard-advertisements/index.tsx +++ b/app/pages/dashboard-advertisements/index.tsx @@ -98,8 +98,8 @@ export const AdvertisementsPage = () => { /> setSelectedAds(undefined)} title="Banner iklan" fetcherAction={`/actions/admin/advertisements/delete/${selectedAds?.id}`} > diff --git a/app/pages/dashboard-subscribe-plan/index.tsx b/app/pages/dashboard-subscribe-plan/index.tsx index 78c5615..55b4dcc 100644 --- a/app/pages/dashboard-subscribe-plan/index.tsx +++ b/app/pages/dashboard-subscribe-plan/index.tsx @@ -129,8 +129,8 @@ export const SubscribePlanPage = () => { /> setSelectedSubscribePlan(undefined)} title="Subscribe plan" fetcherAction={`/actions/admin/subscribe-plan/delete/${selectedSubscribePlan?.id}`} > diff --git a/app/pages/dashboard-tags/index.tsx b/app/pages/dashboard-tags/index.tsx index 2ae2e8b..fb01772 100644 --- a/app/pages/dashboard-tags/index.tsx +++ b/app/pages/dashboard-tags/index.tsx @@ -102,8 +102,8 @@ export const TagsPage = () => { /> setSelectedTag(undefined)} title="Tag" fetcherAction={`/actions/admin/tags/delete/${selectedTag?.id}`} >