Skip to content

Commit

Permalink
chore: delete unusing imports (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyuhho committed Mar 23, 2024
1 parent f092a34 commit ce272de
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ReactComponent as CircleCheckIcon } from 'assets/icons/circle-check.svg
import { Button2 } from 'styles/font';
import styled from 'styled-components';

import { useState } from 'react';
import { useSetRecoilState } from 'recoil';
import { isConsultModalOpenState } from 'utils/atom';
import SellerLetterList from './SellerLetterList';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Seller/SellerConsult/SellerLetterList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function SellerLetterList({
content={
item.status === '질문 대기'
? '셰어의 질문이 도착할 때까지 조금만 기다려주세요! '
: item?.latestMessageContent
: item.latestMessageContent
}
key={item.id}
counselorprofileStatus={consultStyleToCharNum(
Expand Down
4 changes: 1 addition & 3 deletions src/hooks/useConsultParams.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// import { useStompContext } from 'contexts/StompContext';
import { useEffect, useState } from 'react';
import { useState } from 'react';
import { useSearchParams } from 'react-router-dom';
import { Green, Grey1 } from 'styles/color';

// The setSearchParams function works like navigate, but only for the search portion of the URL. Also note that the second arg to setSearchParams is the same type as the second arg to navigate.
// https://reactrouter.com/en/main/hooks/use-search-params
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Buyer/BuyerChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const BuyerChat = () => {
null,
);
const [isLastElem, setIsLastElem] = useState<boolean>(false);
const [startRequestActive, setStartRequestActive] = useState<boolean>(true);

//useRefs
const inputRef = useRef<HTMLTextAreaElement>(null); //input ref 높이 초기화를 위함
const hiddenInputRef = useRef<HTMLInputElement>(null);
Expand Down
1 change: 0 additions & 1 deletion src/pages/Buyer/BuyerConsult.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Header } from 'components/Common/Header';
import { TabA1 } from 'components/Common/TabA1';
import { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useRecoilState, useSetRecoilState } from 'recoil';
import styled from 'styled-components';
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Buyer/BuyerPwChange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const BuyerPwChange = () => {
} else {
setValid(false);
}
}, [pw.isValid, newPw.isValid, newPwCheck.isValid]);
}, [pw.isValid, newPw.isValid, newPwCheck.isValid, newPw.typeValid]);

useEffect(() => {
// 첫 마운트 시에는 error 색상 안되게 처리
Expand Down Expand Up @@ -108,7 +108,7 @@ export const BuyerPwChange = () => {
setCorrectState('invalid');
newPwCheck.setIsValid(false);
}
}, [newPw.value, newPwCheck.value]);
}, [newPw, newPw.value, newPwCheck, newPwCheck.value, pw]);

return (
<Wrapper>
Expand Down
19 changes: 4 additions & 15 deletions src/pages/Seller/SellerChatTemp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const SellerChatTemp = () => {
const { stompClient } = useStompContext();

const preventRef = useRef(false); // observer 중복방지, 첫 mount 시 message 가져온 후 true로 전환
const preventScrollRef = useRef(true); // message 변경 시 모바일에서 오버 스크롤로 인해 여러번 불리는 오류 발생, scrollintoview 완료 전까지 observe 막기

const isLastElem = useRef(false); //마지막 채팅인지 확인
const lastRef = useRef<HTMLDivElement>(null); // 마지막 채팅 box ref
const newMessageRef = useRef(true); // 새로운 메세지인지 이전 메세지 fetch인지
Expand Down Expand Up @@ -300,17 +300,9 @@ export const SellerChatTemp = () => {
!isLastElem.current &&
!isInitialLoading &&
preventRef.current
// &&preventScrollRef.current
) {
preventRef.current = false;
// preventScrollRef.current = false;
// console.log(`관측: ${messages[0].messageId}`);
await getChatMessages(messages[0].messageId);
// console.log('fetch 완료');
// setTimeout(() => {
// preventRef.current = true;
// }, 100);
// console.log(`관측: ${messages[0].messageId}`);
preventRef.current = true;
}
};
Expand Down Expand Up @@ -369,9 +361,6 @@ export const SellerChatTemp = () => {
block: 'start', // 페이지 하단으로 스크롤하도록 지정합니다.
});
}
// console.log('스크롤 완료');
//scrollIntoView 완료 후 다시 관측가능
// preventScrollRef.current = true;
}, [messages]);
//상담 start request 관련 처리
useEffect(() => {
Expand All @@ -397,15 +386,15 @@ export const SellerChatTemp = () => {
}, 1000);

return () => clearInterval(timer);
}, [time]);
}, [chatStatus, time]);

if (isInitialLoading) {
return (
<>
<HeaderWrapper border={false}>
<BackIcon
onClick={() => {
navigate('/minder/consult');
navigate(-1);
}}
/>
<Heading color={Grey1}></Heading>
Expand All @@ -418,7 +407,7 @@ export const SellerChatTemp = () => {
<HeaderWrapper border={false}>
<BackIcon
onClick={() => {
navigate('/minder/consult');
navigate(-1);
}}
/>
<Heading color={Grey1}>{opponentName}</Heading>
Expand Down

0 comments on commit ce272de

Please sign in to comment.