From fd56816f856fe46de44ed3f4000a91003b74cad4 Mon Sep 17 00:00:00 2001 From: athevinha Date: Wed, 18 Sep 2024 17:02:49 +0700 Subject: [PATCH] click movement --- .../@dashboard/blog/BlogNewPostForm.tsx | 9 ++- .../user/profile/home/ProfilePostInput.tsx | 58 +++++++++++++++---- 2 files changed, 56 insertions(+), 11 deletions(-) diff --git a/src/sections/@dashboard/blog/BlogNewPostForm.tsx b/src/sections/@dashboard/blog/BlogNewPostForm.tsx index fa890f2..4755b3a 100644 --- a/src/sections/@dashboard/blog/BlogNewPostForm.tsx +++ b/src/sections/@dashboard/blog/BlogNewPostForm.tsx @@ -25,7 +25,7 @@ import BlogNewPostPreview from './BlogNewPostPreview'; // ---------------------------------------------------------------------- -const TAGS_OPTION = [ +export const TAGS_OPTION = [ 'Toy Story 3', 'Logan', 'Full Metal Jacket', @@ -41,6 +41,13 @@ const TAGS_OPTION = [ '3 Idiots', ]; + +export const NFTS_OPTIONS = [ + "ERC-721", + "ERC-1155", + "DN-404" +]; + // ---------------------------------------------------------------------- export type FormValuesProps = IBlogNewPost; diff --git a/src/sections/@dashboard/user/profile/home/ProfilePostInput.tsx b/src/sections/@dashboard/user/profile/home/ProfilePostInput.tsx index fa362b3..dbd2848 100644 --- a/src/sections/@dashboard/user/profile/home/ProfilePostInput.tsx +++ b/src/sections/@dashboard/user/profile/home/ProfilePostInput.tsx @@ -6,8 +6,17 @@ import { yupResolver } from '@hookform/resolvers/yup'; import { Button, Card, Chip, Fab, IconButton, Stack, Typography } from '@mui/material'; // components import { useForm } from 'react-hook-form'; -import FormProvider, { RHFEditor, RHFSwitch, RHFUpload } from 'src/components/hook-form'; -import { FormValuesProps } from 'src/sections/@dashboard/blog/BlogNewPostForm'; +import FormProvider, { + RHFAutocomplete, + RHFEditor, + RHFSwitch, + RHFUpload, +} from 'src/components/hook-form'; +import { + FormValuesProps, + NFTS_OPTIONS, + TAGS_OPTION, +} from 'src/sections/@dashboard/blog/BlogNewPostForm'; import Iconify from '../../../../../components/iconify'; // ---------------------------------------------------------------------- @@ -16,13 +25,14 @@ export default function ProfilePostInput() { const fileInputRef = useRef(null); const handleClickAttach = () => { + setOpenWrite(true); fileInputRef.current?.click(); }; const NewBlogSchema = Yup.object().shape({ title: Yup.string().required('Title is required'), description: Yup.string().required('Description is required'), tags: Yup.array().min(2, 'Must have at least 2 tags'), - metaKeywords: Yup.array().min(1, 'Meta keywords is required'), + metaKeywords: Yup.array().min(0, 'NFTs type is required'), cover: Yup.mixed().required('Cover is required').nullable(true), content: Yup.string(), }); @@ -36,7 +46,7 @@ export default function ProfilePostInput() { comments: true, metaTitle: '', metaDescription: '', - metaKeywords: [], + metaKeywords: ['ERC-721'], }; const methods = useForm({ @@ -99,7 +109,9 @@ export default function ProfilePostInput() { pb={0} sx={{ transition: '0.4s', - ...(!openMedia ? { opacity: '0', height: 0 } : { opacity: '1', height: 'auto', paddingBottom: 1 }), + ...(!openMedia + ? { opacity: '0', height: 0 } + : { opacity: '1', height: 'auto', paddingBottom: 1 }), }} > + option)} + ChipProps={{ size: 'small' }} + /> setOpenWrite(true)} + // onFocus={() => setOpenWrite(true)} > - setOpenOptions(!openOptions)}> + { + setOpenOptions(!openOptions); + setOpenWrite(true); + }} + > - setOpenMedia(!openMedia)}> + { + setOpenMedia(!openMedia); + setOpenWrite(true); + }} + > - setOpenMedia(!openMedia)}> + { + setOpenMedia(!openMedia); + setOpenWrite(true); + }}> @@ -172,9 +209,10 @@ export default function ProfilePostInput() { variant="soft" onClick={() => { reset(); + setOpenWrite(!openWrite); }} > - Post + Post