updated
This commit is contained in:
		| @@ -41,32 +41,32 @@ type FileUploadProps = { | |||||||
|   children?: ReactNode |   children?: ReactNode | ||||||
| } | } | ||||||
|  |  | ||||||
| const FileUpload = (props: FileUploadProps) => { | // const FileUpload = (props: FileUploadProps) => { | ||||||
|   const { register, accept, multiple, children } = props | //   const { register, accept, multiple, children } = props | ||||||
|   const inputRef = useRef<HTMLInputElement | null>(null) | //   const inputRef = useRef<HTMLInputElement | null>(null) | ||||||
|   const { ref, ...rest } = register as { ref: (instance: HTMLInputElement | null) => void } | //   const { ref, ...rest } = register as { ref: (instance: HTMLInputElement | null) => void } | ||||||
|  |  | ||||||
|   const handleClick = () => inputRef.current?.click() | //   const handleClick = () => inputRef.current?.click() | ||||||
|  |  | ||||||
|   return ( | //   return ( | ||||||
|     <InputGroup onClick={handleClick}> | //     <InputGroup onClick={handleClick}> | ||||||
|       <input | //       <input | ||||||
|         type={'file'} | //         type={'file'} | ||||||
|         multiple={multiple || false} | //         multiple={multiple || false} | ||||||
|         hidden | //         hidden | ||||||
|         accept={accept} | //         accept={accept} | ||||||
|         {...rest} | //         {...rest} | ||||||
|         ref={(e) => { | //         ref={(e) => { | ||||||
|           ref(e) | //           ref(e) | ||||||
|           inputRef.current = e | //           inputRef.current = e | ||||||
|         }} | //         }} | ||||||
|       /> | //       /> | ||||||
|       <> | //       <> | ||||||
|         {children} | //         {children} | ||||||
|       </> | //       </> | ||||||
|     </InputGroup> | //     </InputGroup> | ||||||
|   ) | //   ) | ||||||
| } | // } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -104,9 +104,9 @@ const AddAboutUs = ({ isOpen, onClose }: AddAboutUsProps) => { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|  |  | ||||||
|   type FormValues = { |   // type FormValues = { | ||||||
|     file_: FileList |   //   file_: FileList | ||||||
|   } |   // } | ||||||
|  |  | ||||||
|  |  | ||||||
|   const mutation = useMutation({ |   const mutation = useMutation({ | ||||||
|   | |||||||
| @@ -46,32 +46,32 @@ type FileUploadProps = { | |||||||
|     children?: ReactNode |     children?: ReactNode | ||||||
| } | } | ||||||
|  |  | ||||||
| const FileUpload = (props: FileUploadProps) => { | // const FileUpload = (props: FileUploadProps) => { | ||||||
|     const { register, accept, multiple, children } = props | //     const { register, accept, multiple, children } = props | ||||||
|     const inputRef = useRef<HTMLInputElement | null>(null) | //     const inputRef = useRef<HTMLInputElement | null>(null) | ||||||
|     const { ref, ...rest } = register as { ref: (instance: HTMLInputElement | null) => void } | //     const { ref, ...rest } = register as { ref: (instance: HTMLInputElement | null) => void } | ||||||
|  |  | ||||||
|     const handleClick = () => inputRef.current?.click() | //     const handleClick = () => inputRef.current?.click() | ||||||
|  |  | ||||||
|     return ( | //     return ( | ||||||
|         <InputGroup onClick={handleClick}> | //         <InputGroup onClick={handleClick}> | ||||||
|             <input | //             <input | ||||||
|                 type={'file'} | //                 type={'file'} | ||||||
|                 multiple={multiple || false} | //                 multiple={multiple || false} | ||||||
|                 hidden | //                 hidden | ||||||
|                 accept={accept} | //                 accept={accept} | ||||||
|                 {...rest} | //                 {...rest} | ||||||
|                 ref={(e) => { | //                 ref={(e) => { | ||||||
|                     ref(e) | //                     ref(e) | ||||||
|                     inputRef.current = e | //                     inputRef.current = e | ||||||
|                 }} | //                 }} | ||||||
|             /> | //             /> | ||||||
|             <> | //             <> | ||||||
|                 {children} | //                 {children} | ||||||
|             </> | //             </> | ||||||
|         </InputGroup> | //         </InputGroup> | ||||||
|     ) | //     ) | ||||||
| } | // } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -118,9 +118,9 @@ const EditAboutUs = ({ aboutUs, isOpen, onClose }: EditAboutUsProps) => { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|     type FormValues = { |     // type FormValues = { | ||||||
|         file_: FileList |     //     file_: FileList | ||||||
|     } |     // } | ||||||
|  |  | ||||||
|  |  | ||||||
|     const mutation = useMutation({ |     const mutation = useMutation({ | ||||||
|   | |||||||
| @@ -54,7 +54,6 @@ const CourseDetails = () => { | |||||||
|         reset, |         reset, | ||||||
|         getValues, |         getValues, | ||||||
|         setValue, |         setValue, | ||||||
|         unregister, |  | ||||||
|         formState: { isSubmitting, errors, isDirty }, |         formState: { isSubmitting, errors, isDirty }, | ||||||
|     } = useForm<CourseCreate>({ |     } = useForm<CourseCreate>({ | ||||||
|         mode: "onBlur", |         mode: "onBlur", | ||||||
|   | |||||||
| @@ -44,7 +44,6 @@ const CourseImages = () => { | |||||||
|         reset, |         reset, | ||||||
|         getValues, |         getValues, | ||||||
|         setValue, |         setValue, | ||||||
|         unregister, |  | ||||||
|         formState: { isSubmitting, errors, isDirty }, |         formState: { isSubmitting, errors, isDirty }, | ||||||
|     } = useForm<ImageCreate>({ |     } = useForm<ImageCreate>({ | ||||||
|         mode: "onBlur", |         mode: "onBlur", | ||||||
|   | |||||||
| @@ -39,9 +39,7 @@ const CourseInfoImages = () => { | |||||||
|         register, |         register, | ||||||
|         handleSubmit, |         handleSubmit, | ||||||
|         reset, |         reset, | ||||||
|         getValues, |  | ||||||
|         setValue, |         setValue, | ||||||
|         unregister, |  | ||||||
|         formState: { isSubmitting, errors, isDirty }, |         formState: { isSubmitting, errors, isDirty }, | ||||||
|     } = useForm<ImageCreate>({ |     } = useForm<ImageCreate>({ | ||||||
|         mode: "onBlur", |         mode: "onBlur", | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ interface EditItemProps { | |||||||
|     type: string |     type: string | ||||||
| } | } | ||||||
|  |  | ||||||
| const EditSechedule = ({ sechedule, type, isOpen, onClose }: EditItemProps) => { | const EditSechedule = ({ sechedule, isOpen, onClose }: EditItemProps) => { | ||||||
|     const queryClient = useQueryClient() |     const queryClient = useQueryClient() | ||||||
|     const showToast = useCustomToast() |     const showToast = useCustomToast() | ||||||
|     const { |     const { | ||||||
| @@ -38,7 +38,7 @@ const EditSechedule = ({ sechedule, type, isOpen, onClose }: EditItemProps) => { | |||||||
|         reset, |         reset, | ||||||
|         setValue, |         setValue, | ||||||
|         getValues, |         getValues, | ||||||
|         formState: { isSubmitting, errors, isDirty }, |         formState: { isSubmitting, errors }, | ||||||
|     } = useForm<ScheduleUpdate>({ |     } = useForm<ScheduleUpdate>({ | ||||||
|         mode: "onBlur", |         mode: "onBlur", | ||||||
|         criteriaMode: "all", |         criteriaMode: "all", | ||||||
|   | |||||||
| @@ -10,7 +10,6 @@ import { | |||||||
| } from "@chakra-ui/react" | } from "@chakra-ui/react" | ||||||
| import moment from 'moment'; | import moment from 'moment'; | ||||||
| import {  useQueryClient,  } from "@tanstack/react-query" | import {  useQueryClient,  } from "@tanstack/react-query" | ||||||
| import useCustomToast from "../../hooks/useCustomToast" |  | ||||||
| import { CourseDetailsPublic } from "../../client" | import { CourseDetailsPublic } from "../../client" | ||||||
| import ActionsMenu from "../../components/Common/ActionsMenu" | import ActionsMenu from "../../components/Common/ActionsMenu" | ||||||
| import 'react-datetime-picker/dist/DateTimePicker.css'; | import 'react-datetime-picker/dist/DateTimePicker.css'; | ||||||
| @@ -21,7 +20,7 @@ const Sechedule = () => { | |||||||
|     const queryClient = useQueryClient(); |     const queryClient = useQueryClient(); | ||||||
|     const courseDetails = queryClient.getQueryData(['course']) as CourseDetailsPublic | undefined; |     const courseDetails = queryClient.getQueryData(['course']) as CourseDetailsPublic | undefined; | ||||||
|  |  | ||||||
|     const showToast = useCustomToast() |   //  const showToast = useCustomToast() | ||||||
|  |  | ||||||
|     return ( |     return ( | ||||||
|         <Container maxW="full"> |         <Container maxW="full"> | ||||||
| @@ -38,7 +37,7 @@ const Sechedule = () => { | |||||||
|                         </Tr> |                         </Tr> | ||||||
|                     </Thead> |                     </Thead> | ||||||
|                     <Tbody> |                     <Tbody> | ||||||
|                         {courseDetails?.schedule?.map((schedule, index) => ( |                         {courseDetails?.schedule?.map((schedule) => ( | ||||||
|                             <Tr key={schedule.id}> |                             <Tr key={schedule.id}> | ||||||
|                                 <Td maxWidth="20px"> |                                 <Td maxWidth="20px"> | ||||||
|                                     {moment(schedule.date).utcOffset("+08:00").format('DD-MM-YYYY HH:mm')} |                                     {moment(schedule.date).utcOffset("+08:00").format('DD-MM-YYYY HH:mm')} | ||||||
|   | |||||||
| @@ -7,9 +7,9 @@ import { | |||||||
|     TabPanels, |     TabPanels, | ||||||
|     Tabs, |     Tabs, | ||||||
| } from "@chakra-ui/react" | } from "@chakra-ui/react" | ||||||
| import { useQueryClient, useQuery } from "@tanstack/react-query" | import { useQuery } from "@tanstack/react-query" | ||||||
| import { createFileRoute } from "@tanstack/react-router" | import { createFileRoute } from "@tanstack/react-router" | ||||||
| import { UserPublic, CoursesService } from "../../../client" | import { CoursesService } from "../../../client" | ||||||
|  |  | ||||||
| import CourseDetails from "../../../components/Courses/CourseDetails" | import CourseDetails from "../../../components/Courses/CourseDetails" | ||||||
| import CourseImages from "../../../components/Courses/CourseImages" | import CourseImages from "../../../components/Courses/CourseImages" | ||||||
|   | |||||||
| @@ -50,8 +50,6 @@ function AddCourseForms() { | |||||||
|     const { |     const { | ||||||
|         register, |         register, | ||||||
|         handleSubmit, |         handleSubmit, | ||||||
|         reset, |  | ||||||
|         getValues, |  | ||||||
|         setValue, |         setValue, | ||||||
|         formState: { isSubmitting, errors, isDirty }, |         formState: { isSubmitting, errors, isDirty }, | ||||||
|     } = useForm<CourseCreate>({ |     } = useForm<CourseCreate>({ | ||||||
|   | |||||||
| @@ -21,13 +21,13 @@ export const Route = createFileRoute("/_layout/webSetting")({ | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| function getWebSettingQuery() { | // function getWebSettingQuery() { | ||||||
|     return { | //     return { | ||||||
|         queryFn: () => | //         queryFn: () => | ||||||
|             WebSettingsService.readWebSetting(), | //             WebSettingsService.readWebSetting(), | ||||||
|         queryKey: ["webSetting"], | //         queryKey: ["webSetting"], | ||||||
|     } | //     } | ||||||
| } | // } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -54,7 +54,6 @@ function WebSettingForms() { | |||||||
|         const { |         const { | ||||||
|             register, |             register, | ||||||
|             handleSubmit, |             handleSubmit, | ||||||
|             reset, |  | ||||||
|             formState: { isSubmitting, errors, isDirty }, |             formState: { isSubmitting, errors, isDirty }, | ||||||
|         } = useForm<WebSettingUpdate>({ |         } = useForm<WebSettingUpdate>({ | ||||||
|             mode: "onBlur", |             mode: "onBlur", | ||||||
|   | |||||||
| @@ -9,12 +9,9 @@ import { | |||||||
|   Input, |   Input, | ||||||
|   InputGroup, |   InputGroup, | ||||||
|   InputRightElement, |   InputRightElement, | ||||||
|   Link, |  | ||||||
|   Text, |  | ||||||
|   useBoolean, |   useBoolean, | ||||||
| } from "@chakra-ui/react" | } from "@chakra-ui/react" | ||||||
| import { | import { | ||||||
|   Link as RouterLink, |  | ||||||
|   createFileRoute, |   createFileRoute, | ||||||
|   redirect, |   redirect, | ||||||
| } from "@tanstack/react-router" | } from "@tanstack/react-router" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user