From d51655f3d96e07c466a95b80e1f9ba200e867511 Mon Sep 17 00:00:00 2001 From: KimGaeun Date: Thu, 14 Dec 2023 23:06:24 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Add=20FadeoutScreen=20?= =?UTF-8?q?onAnimationEnd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - FadeoutScreen에 onAnimationEnd 추가 - isSwitching === 'end'일 경우를 WarpScreen 내에서 처리하도록 함 - 함수 오타 수정 --- packages/client/src/pages/Home/Home.tsx | 5 ++--- packages/client/src/widgets/warpScreen/WarpScreen.tsx | 7 +++++-- packages/client/src/widgets/warpScreen/ui/SpaceWarp.tsx | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/client/src/pages/Home/Home.tsx b/packages/client/src/pages/Home/Home.tsx index b8862df..158c873 100644 --- a/packages/client/src/pages/Home/Home.tsx +++ b/packages/client/src/pages/Home/Home.tsx @@ -95,11 +95,10 @@ export default function Home() { <> {status === 'new' && } - {isSwitching !== 'end' && ( - - )} {text && {text}} + + diff --git a/packages/client/src/widgets/warpScreen/WarpScreen.tsx b/packages/client/src/widgets/warpScreen/WarpScreen.tsx index d2232af..0de1210 100644 --- a/packages/client/src/widgets/warpScreen/WarpScreen.tsx +++ b/packages/client/src/widgets/warpScreen/WarpScreen.tsx @@ -36,7 +36,11 @@ export default function WarpScreen({ isSwitching, setIsSwitching }: PropsType) { zIndex: 999, backgroundColor: theme.colors.background.bdp04, }; - if (isSwitching === 'fade') return ; + + if (isSwitching === 'end') return null; + + if (isSwitching === 'fade') + return setIsSwitching('end')} />; return ( @@ -50,7 +54,6 @@ export default function WarpScreen({ isSwitching, setIsSwitching }: PropsType) { - diff --git a/packages/client/src/widgets/warpScreen/ui/SpaceWarp.tsx b/packages/client/src/widgets/warpScreen/ui/SpaceWarp.tsx index 009498c..5e9728a 100644 --- a/packages/client/src/widgets/warpScreen/ui/SpaceWarp.tsx +++ b/packages/client/src/widgets/warpScreen/ui/SpaceWarp.tsx @@ -13,7 +13,7 @@ import { } from '../lib/constants'; import { WarpStateType } from 'shared/lib'; -const geSpaceWarpLinesInfo = () => { +const getSpaceWarpLinesInfo = () => { const positions = Array.from({ length: SPACE_WARP_LINES_NUM }, () => { const x = getRandomFloat(SPACE_WARP_XZ_MIN, SPACE_WARP_XZ_MAX); const y = getRandomFloat(SPACE_WARP_Y_MIN, SPACE_WARP_Y_MAX); @@ -38,10 +38,10 @@ interface PropsType { } export default function SpaceWarp({ setIsSwitching }: PropsType) { - const [positions, colors] = useMemo(() => geSpaceWarpLinesInfo(), []); + const [positions, colors] = useMemo(() => getSpaceWarpLinesInfo(), []); useFrame((state, delta) => { - if (state.camera.position.y <= 0) { + if (state.camera.position.y <= SPACE_WARP_Y_MIN) { state.scene.background = new THREE.Color(0xffffff); setIsSwitching('fade'); return; From e5826553ed030829d14d74739c585bd99cd8bc04 Mon Sep 17 00:00:00 2001 From: MinboyKim Date: Fri, 15 Dec 2023 01:36:16 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8=20Post=20limit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 글 수정 제목 및 본문 제한 --- packages/client/src/shared/lib/types/post.ts | 2 + .../src/widgets/postModal/ui/PostModal.tsx | 113 +++++++++++++++--- .../widgets/writingModal/ui/WritingModal.tsx | 3 +- 3 files changed, 99 insertions(+), 19 deletions(-) diff --git a/packages/client/src/shared/lib/types/post.ts b/packages/client/src/shared/lib/types/post.ts index efaddd6..fb8738b 100644 --- a/packages/client/src/shared/lib/types/post.ts +++ b/packages/client/src/shared/lib/types/post.ts @@ -5,3 +5,5 @@ export interface PostData { images: string[]; like_cnt?: number; } + +export type TextStateTypes = 'DEFAULT' | 'INVALID' | 'OVER'; diff --git a/packages/client/src/widgets/postModal/ui/PostModal.tsx b/packages/client/src/widgets/postModal/ui/PostModal.tsx index 4bfcfa9..dad3bf5 100644 --- a/packages/client/src/widgets/postModal/ui/PostModal.tsx +++ b/packages/client/src/widgets/postModal/ui/PostModal.tsx @@ -6,11 +6,13 @@ import { useLocation, useNavigate, useParams } from 'react-router-dom'; import remarkGfm from 'remark-gfm'; import { instance } from 'shared/apis'; import { useCheckNickName, useFetch, useRefresh } from 'shared/hooks'; -import { PostData } from 'shared/lib'; +import { PostData, TextStateTypes } from 'shared/lib'; import { useCameraStore, useToastStore, useViewStore } from 'shared/store'; import { AlertDialog, Button, Input, Modal, TextArea } from 'shared/ui'; import { deletePost } from '../api/deletePost'; import ImageSlider from './ImageSlider'; +import { Caption } from 'shared/styles'; +import { css } from '@emotion/react'; export default function PostModal() { const [deleteModal, setDeleteModal] = useState(false); @@ -19,6 +21,8 @@ export default function PostModal() { const [title, setTitle] = useState(''); const [isDeleteButtonDisabled, setIsDeleteButtonDisabled] = useState(false); const [isSaveButtonDisabled, setIsSaveButtonDisabled] = useState(false); + const [titleState, setTitleState] = useState('DEFAULT'); + const [contentState, setContentState] = useState('DEFAULT'); const { setToast } = useToastStore(); const { setView } = useViewStore(); @@ -44,7 +48,6 @@ export default function PostModal() { const formData = new FormData(); formData.append('title', title); formData.append('content', content); - try { await instance({ url: `/post/${postId}`, @@ -105,6 +108,8 @@ export default function PostModal() { buttonType="CTA-icon" type="button" onClick={() => { + if (title === '') return setTitleState('INVALID'); + if (content === '') return setContentState('INVALID'); setIsEdit(false); handleEditSave(); }} @@ -160,21 +165,44 @@ export default function PostModal() { )} {isEdit ? ( - setTitle(e.target.value)} - /> -