From 754599c9e4697735400e5801259586b4387e3650 Mon Sep 17 00:00:00 2001 From: inyoung Date: Tue, 30 Jan 2024 03:56:22 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=ED=8E=B8=EC=A7=80=20=EC=B4=88=EA=B8=B0?= =?UTF-8?q?=20=EC=83=81=ED=83=9C=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Seller/SellerLetter.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/pages/Seller/SellerLetter.tsx b/src/pages/Seller/SellerLetter.tsx index fb6f2c90..a21cdab4 100644 --- a/src/pages/Seller/SellerLetter.tsx +++ b/src/pages/Seller/SellerLetter.tsx @@ -15,13 +15,14 @@ import { useEffect, useMemo, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import { useRecoilState, useSetRecoilState } from 'recoil'; import styled from 'styled-components'; +import constructWithOptions from 'styled-components/dist/constructors/constructWithOptions'; import { isConsultModalOpenState, scrollLockState } from 'utils/atom'; export const SellerLetter = () => { const navigate = useNavigate(); // 상단 태그상태 -> 질문, 답장, 추가질문 , 추가답장 : 0,1,2,3 const [tagStatus, setTagStatus] = useState(0); - // 현재 편지의 태그 활성화레벨, tagStatus가 tagActiveLevel보다 작으면 검은색, 같거나 크면 희색: 1 2 3 4 + // 현재 편지의 태그 활성화레벨, tagStatus가 tagActiveLevel보다 작으면 검은색, 같거나 크면 희색: 0 1 2 3 4 const [tagActiveLevel, setTagActiveLevel] = useState(0); // 신고할 것인지 여부 const [isActiveComplaint, setIsComplaint] = useState(false); @@ -68,8 +69,18 @@ export const SellerLetter = () => { const level = levelMap[data?.recentType as keyof typeof levelMap] || 0; setTagActiveLevel(level); - const initStatus = level === 4 || 0 ? level - 1 : level; - setTagStatus(initStatus); + console.log(level); + setTagStatus( + level === 0 + ? 1 + : level === 1 + ? 1 + : level === 2 + ? 1 + : level === 3 + ? 2 + : 3, + ); setDeadLine(deadlineResponse?.data?.deadline); } } catch (err) { @@ -79,7 +90,6 @@ export const SellerLetter = () => { }; fetchLetterInfo(); }, []); - // 태그 바뀜에 따라 getLetterMessages API 호출 const messageTypeMap = useMemo( () => ({