updated
This commit is contained in:
parent
b50a827757
commit
60ac644fc0
|
@ -1,4 +1,4 @@
|
||||||
import { useRef, ReactNode, useState } from 'react';
|
import { useState } from 'react';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
FormControl,
|
FormControl,
|
||||||
|
@ -11,7 +11,6 @@ import {
|
||||||
ModalFooter,
|
ModalFooter,
|
||||||
ModalHeader,
|
ModalHeader,
|
||||||
ModalOverlay,
|
ModalOverlay,
|
||||||
InputGroup,
|
|
||||||
NumberInput,
|
NumberInput,
|
||||||
NumberInputField,
|
NumberInputField,
|
||||||
NumberInputStepper,
|
NumberInputStepper,
|
||||||
|
@ -34,12 +33,12 @@ interface AddAboutUsProps {
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
type FileUploadProps = {
|
// type FileUploadProps = {
|
||||||
register: UseFormRegisterReturn
|
// register: UseFormRegisterReturn
|
||||||
accept?: string
|
// accept?: string
|
||||||
multiple?: boolean
|
// multiple?: boolean
|
||||||
children?: ReactNode
|
// children?: ReactNode
|
||||||
}
|
// }
|
||||||
|
|
||||||
// const FileUpload = (props: FileUploadProps) => {
|
// const FileUpload = (props: FileUploadProps) => {
|
||||||
// const { register, accept, multiple, children } = props
|
// const { register, accept, multiple, children } = props
|
||||||
|
@ -90,18 +89,18 @@ const AddAboutUs = ({ isOpen, onClose }: AddAboutUsProps) => {
|
||||||
const [editorState, setEditorState] = useState<EditorState>(EditorState.createEmpty());
|
const [editorState, setEditorState] = useState<EditorState>(EditorState.createEmpty());
|
||||||
const [content, setContent] = useState<string>('');
|
const [content, setContent] = useState<string>('');
|
||||||
|
|
||||||
const validateFiles = (value: File) => {
|
// const validateFiles = (value: File) => {
|
||||||
if (typeof value === 'string') return true;
|
// if (typeof value === 'string') return true;
|
||||||
|
|
||||||
|
|
||||||
const fsMb = value.size / (1024 * 1024)
|
// const fsMb = value.size / (1024 * 1024)
|
||||||
const MAX_FILE_SIZE = 10
|
// const MAX_FILE_SIZE = 10
|
||||||
if (fsMb > MAX_FILE_SIZE) {
|
// if (fsMb > MAX_FILE_SIZE) {
|
||||||
return 'Max file size 10mb'
|
// return 'Max file size 10mb'
|
||||||
}
|
// }
|
||||||
|
|
||||||
return true
|
// return true
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// type FormValues = {
|
// type FormValues = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useRef, ReactNode, useState } from 'react';
|
import {useState } from 'react';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
FormControl,
|
FormControl,
|
||||||
|
@ -12,7 +12,6 @@ import {
|
||||||
ModalFooter,
|
ModalFooter,
|
||||||
ModalHeader,
|
ModalHeader,
|
||||||
ModalOverlay,
|
ModalOverlay,
|
||||||
InputGroup,
|
|
||||||
NumberInput,
|
NumberInput,
|
||||||
NumberInputField,
|
NumberInputField,
|
||||||
NumberInputStepper,
|
NumberInputStepper,
|
||||||
|
@ -23,7 +22,7 @@ import {
|
||||||
} from "@chakra-ui/react"
|
} from "@chakra-ui/react"
|
||||||
|
|
||||||
import { useMutation, useQueryClient } from "@tanstack/react-query"
|
import { useMutation, useQueryClient } from "@tanstack/react-query"
|
||||||
import { type SubmitHandler, useForm, UseFormRegisterReturn } from "react-hook-form"
|
import { type SubmitHandler, useForm } from "react-hook-form"
|
||||||
import { type ApiError, AboutUsService, AboutUsUpdate, AboutUsPublic } from "../../client"
|
import { type ApiError, AboutUsService, AboutUsUpdate, AboutUsPublic } from "../../client"
|
||||||
import useCustomToast from "../../hooks/useCustomToast"
|
import useCustomToast from "../../hooks/useCustomToast"
|
||||||
import { handleError } from "../../utils"
|
import { handleError } from "../../utils"
|
||||||
|
@ -39,12 +38,12 @@ interface EditAboutUsProps {
|
||||||
aboutUs: AboutUsPublic
|
aboutUs: AboutUsPublic
|
||||||
}
|
}
|
||||||
|
|
||||||
type FileUploadProps = {
|
// type FileUploadProps = {
|
||||||
register: UseFormRegisterReturn
|
// register: UseFormRegisterReturn
|
||||||
accept?: string
|
// accept?: string
|
||||||
multiple?: boolean
|
// multiple?: boolean
|
||||||
children?: ReactNode
|
// children?: ReactNode
|
||||||
}
|
// }
|
||||||
|
|
||||||
// const FileUpload = (props: FileUploadProps) => {
|
// const FileUpload = (props: FileUploadProps) => {
|
||||||
// const { register, accept, multiple, children } = props
|
// const { register, accept, multiple, children } = props
|
||||||
|
@ -104,18 +103,18 @@ const EditAboutUs = ({ aboutUs, isOpen, onClose }: EditAboutUsProps) => {
|
||||||
});
|
});
|
||||||
const [content, setContent] = useState<string>(aboutUs.description);
|
const [content, setContent] = useState<string>(aboutUs.description);
|
||||||
|
|
||||||
const validateFiles = (value: File) => {
|
// const validateFiles = (value: File) => {
|
||||||
if (typeof value === 'string') return true;
|
// if (typeof value === 'string') return true;
|
||||||
|
|
||||||
|
|
||||||
const fsMb = value.size / (1024 * 1024)
|
// const fsMb = value.size / (1024 * 1024)
|
||||||
const MAX_FILE_SIZE = 10
|
// const MAX_FILE_SIZE = 10
|
||||||
if (fsMb > MAX_FILE_SIZE) {
|
// if (fsMb > MAX_FILE_SIZE) {
|
||||||
return 'Max file size 10mb'
|
// return 'Max file size 10mb'
|
||||||
}
|
// }
|
||||||
|
|
||||||
return true
|
// return true
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// type FormValues = {
|
// type FormValues = {
|
||||||
|
|
|
@ -12,12 +12,9 @@ import {
|
||||||
NumberIncrementStepper,
|
NumberIncrementStepper,
|
||||||
NumberDecrementStepper,
|
NumberDecrementStepper,
|
||||||
Image,
|
Image,
|
||||||
Flex,
|
|
||||||
HStack,
|
HStack,
|
||||||
VStack,
|
VStack,
|
||||||
Text,
|
Text,
|
||||||
Td,
|
|
||||||
Icon,
|
|
||||||
Grid
|
Grid
|
||||||
} from "@chakra-ui/react"
|
} from "@chakra-ui/react"
|
||||||
import { useQueryClient, useMutation } from "@tanstack/react-query"
|
import { useQueryClient, useMutation } from "@tanstack/react-query"
|
||||||
|
|
Loading…
Reference in New Issue