mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-01-31 09:03:36 +00:00
Fixed Type Errors and Replaced Most Cases of ElementRef with Modern Alternitives
This commit is contained in:
parent
b44c2e0f6e
commit
e29f7bf253
11 changed files with 45 additions and 1958 deletions
|
@ -1,7 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { ElementRef, useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
import { Board } from '@prisma/client';
|
import { Board } from '@prisma/client';
|
||||||
|
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
@ -25,8 +25,8 @@ export const BoardTitleForm = ({ data }: BoardTitleFormProps) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const formRef = useRef<ElementRef<'form'>>(null);
|
const formRef = useRef<HTMLFormElement>(document.createElement('form'));
|
||||||
const inputRef = useRef<ElementRef<'input'>>(null);
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
const [title, setTitle] = useState(data.title);
|
const [title, setTitle] = useState(data.title);
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { X } from 'lucide-react';
|
import { X } from 'lucide-react';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { ElementRef, useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
@ -20,7 +20,7 @@ interface BoardUpdateImageProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const BoardUpdateImage = ({ boardId }: BoardUpdateImageProps) => {
|
export const BoardUpdateImage = ({ boardId }: BoardUpdateImageProps) => {
|
||||||
const closeRef = useRef<ElementRef<'button'>>(null);
|
const closeRef = useRef<HTMLButtonElement>(null);
|
||||||
|
|
||||||
const { execute, fieldErrors } = useAction(updateBoard, {
|
const { execute, fieldErrors } = useAction(updateBoard, {
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { Plus, X } from 'lucide-react';
|
import { Plus, X } from 'lucide-react';
|
||||||
import { forwardRef, useRef, ElementRef, KeyboardEventHandler } from 'react';
|
import { forwardRef, useRef, KeyboardEventHandler } from 'react';
|
||||||
import { useOnClickOutside, useEventListener } from 'usehooks-ts';
|
import { useOnClickOutside, useEventListener } from 'usehooks-ts';
|
||||||
import { useParams } from 'next/navigation';
|
import { useParams } from 'next/navigation';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
|
@ -22,7 +22,7 @@ interface CardFormProps {
|
||||||
export const CardForm = forwardRef<HTMLTextAreaElement, CardFormProps>(
|
export const CardForm = forwardRef<HTMLTextAreaElement, CardFormProps>(
|
||||||
({ listId, isEditing, enableEditing, disableEditing }, ref) => {
|
({ listId, isEditing, enableEditing, disableEditing }, ref) => {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const formRef = useRef<ElementRef<'form'>>(null);
|
const formRef = useRef<HTMLFormElement>(document.createElement('form'));
|
||||||
|
|
||||||
const { execute, fieldErrors } = useAction(createCard, {
|
const { execute, fieldErrors } = useAction(createCard, {
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { Plus, X } from 'lucide-react';
|
import { Plus, X } from 'lucide-react';
|
||||||
import { useState, useRef, ElementRef } from 'react';
|
import { useState, useRef } from 'react';
|
||||||
import { useEventListener, useOnClickOutside } from 'usehooks-ts';
|
import { useEventListener, useOnClickOutside } from 'usehooks-ts';
|
||||||
import { useParams, useRouter } from 'next/navigation';
|
import { useParams, useRouter } from 'next/navigation';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
|
@ -18,8 +18,8 @@ export const ListForm = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
|
||||||
const formRef = useRef<ElementRef<'form'>>(null);
|
const formRef = useRef<HTMLFormElement>(document.createElement('form'));
|
||||||
const inputRef = useRef<ElementRef<'input'>>(null);
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState, useRef, ElementRef } from 'react';
|
import { useState, useRef } from 'react';
|
||||||
import { useEventListener } from 'usehooks-ts';
|
import { useEventListener } from 'usehooks-ts';
|
||||||
import { List } from '@prisma/client';
|
import { List } from '@prisma/client';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
|
@ -20,8 +20,8 @@ export const ListHeader = ({ data, onAddCard }: ListHeaderProps) => {
|
||||||
const [title, setTitle] = useState(data.title);
|
const [title, setTitle] = useState(data.title);
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
|
|
||||||
const formRef = useRef<ElementRef<'form'>>(null);
|
const formRef = useRef<HTMLFormElement>(document.createElement('form'));
|
||||||
const inputRef = useRef<ElementRef<'input'>>(null);
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
const enableEditing = () => {
|
const enableEditing = () => {
|
||||||
setIsEditing(true);
|
setIsEditing(true);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { ElementRef, useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
import { Draggable, Droppable } from '@hello-pangea/dnd';
|
import { Draggable, Droppable } from '@hello-pangea/dnd';
|
||||||
|
|
||||||
import { ListWithCards } from '@/types';
|
import { ListWithCards } from '@/types';
|
||||||
|
@ -16,7 +16,7 @@ interface ListItemProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ListItem = ({ index, data }: ListItemProps) => {
|
export const ListItem = ({ index, data }: ListItemProps) => {
|
||||||
const textareaRef = useRef<ElementRef<'textarea'>>(null);
|
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
||||||
|
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { MoreHorizontal, X } from 'lucide-react';
|
import { MoreHorizontal, X } from 'lucide-react';
|
||||||
import { ElementRef, useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { List } from '@prisma/client';
|
import { List } from '@prisma/client';
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ interface ListOptionsProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ListOptions = ({ data, onAddCard }: ListOptionsProps) => {
|
export const ListOptions = ({ data, onAddCard }: ListOptionsProps) => {
|
||||||
const closeRef = useRef<ElementRef<'button'>>(null);
|
const closeRef = useRef<HTMLButtonElement>(null);
|
||||||
|
|
||||||
const { execute: executeDelete } = useAction(deleteList, {
|
const { execute: executeDelete } = useAction(deleteList, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import { X } from 'lucide-react';
|
import { X } from 'lucide-react';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { ElementRef, useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -36,7 +36,7 @@ export const FormPopover = ({
|
||||||
}: FormPopoverProps) => {
|
}: FormPopoverProps) => {
|
||||||
const proModal = useProModal();
|
const proModal = useProModal();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const closeRef = useRef<ElementRef<'button'>>(null);
|
const closeRef = useRef<HTMLButtonElement>(null);
|
||||||
|
|
||||||
const { execute, fieldErrors } = useAction(createBoard, {
|
const { execute, fieldErrors } = useAction(createBoard, {
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import { useEventListener, useOnClickOutside } from 'usehooks-ts';
|
import { useEventListener, useOnClickOutside } from 'usehooks-ts';
|
||||||
import { useQueryClient } from '@tanstack/react-query';
|
import { useQueryClient } from '@tanstack/react-query';
|
||||||
import { useState, ElementRef, useRef } from 'react';
|
import { useState, useRef } from 'react';
|
||||||
import { useParams } from 'next/navigation';
|
import { useParams } from 'next/navigation';
|
||||||
import { AlignLeft } from 'lucide-react';
|
import { AlignLeft } from 'lucide-react';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
|
@ -26,8 +26,8 @@ export const Description = ({ data }: DescriptionProps) => {
|
||||||
|
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
|
|
||||||
const textareaRef = useRef<ElementRef<'textarea'>>(null);
|
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
||||||
const formRef = useRef<ElementRef<'form'>>(null);
|
const formRef = useRef<HTMLFormElement>(document.createElement('form'));
|
||||||
|
|
||||||
const enaleEditing = () => {
|
const enaleEditing = () => {
|
||||||
setIsEditing(true);
|
setIsEditing(true);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useRef, ElementRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
import { useQueryClient } from '@tanstack/react-query';
|
import { useQueryClient } from '@tanstack/react-query';
|
||||||
import { useParams } from 'next/navigation';
|
import { useParams } from 'next/navigation';
|
||||||
import { Layout } from 'lucide-react';
|
import { Layout } from 'lucide-react';
|
||||||
|
@ -38,7 +38,7 @@ export const Header = ({ data }: HeaderProps) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const inputRef = useRef<ElementRef<'input'>>(null);
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
const [title, setTitle] = useState(data.title);
|
const [title, setTitle] = useState(data.title);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue