Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] 즐겨찾기 관련 레이아웃 구현 및 API 연동 #222

Merged
merged 8 commits into from
Nov 28, 2024

Conversation

dongree
Copy link
Collaborator

@dongree dongree commented Nov 27, 2024

✅ 주요 작업

  • 즐겨찾기 관련 레이아웃 구현 및 API 연동
    • 즐겨찾기 등록
    • 즐겨찾기 취소
    • 즐겨찾기 목록 조회
  • toastify 설정

image

image

💭 고민과 해결과정

즐겨찾기 등록, 취소할 때 디바운스를 걸어 연속적인 호출을 하지 못하게 하려고 했다.
그래서 useEffect로 debouncedValue에 변화를 측정해 구현하려고 했지만 페이지가 렌더링될 때마다 즐겨찾기 취소가 되는 문제가 있었다.
명확한 이유를 찾지 못해 일단 즐겨찾기를 클릭할 때마다 등록/취소 api가 호출되도록 변경했다.
추후에 문제가 발생한 원인이 어떤 것인지 한 번 분석해봐야겠다.

close #212 #213 #214 #215 #216 #217

@dongree dongree added FE 프론트엔드 LAYOUT 레이아웃 구현 INTEGRATION API/Socket 연동 labels Nov 27, 2024
@dongree dongree requested a review from dannysir November 27, 2024 15:30
@dongree dongree self-assigned this Nov 27, 2024
Copy link
Collaborator

@dannysir dannysir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

밤 늦게까지 작업을 하셨군요.
수고하셨습니다!!

<p
className={`w-1/4 truncate text-right ${+prdy_vrss_sign > 3 ? 'text-juga-blue-50' : 'text-juga-red-60'}`}
>
{prdy_ctrt}%
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢여기도 +나 - 표시 하면 좋을 것 같아요

Comment on lines +38 to +52
// const { debounceValue } = useDebounce(isBookmarked, 1000);
// const isInitialMount = useRef(true);

// useEffect(() => {
// if (isInitialMount.current) {
// isInitialMount.current = false;
// return;
// }

// if (debounceValue) {
// bookmark(code);
// } else {
// unbookmark(code);
// }
// }, [code, debounceValue]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢아 여기에 사용하시려고 debounce를 변경하셨군요.

Comment on lines +1 to +23
import { toast } from 'react-toastify';

type ToastType = 'success' | 'error' | 'warning' | 'info';

type ToastProps = {
message: string;
type: ToastType;
};

export default function Toast({ message, type }: ToastProps) {
switch (type) {
case 'success':
return toast.success(message, { position: 'top-right', autoClose: 1000 });
case 'error':
return toast.error(message, { position: 'top-right', autoClose: 1000 });
case 'warning':
return toast.warning(message, { position: 'top-right', autoClose: 1000 });
case 'info':
return toast.info(message, { position: 'top-right', autoClose: 1000 });
default:
return null;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 안그래도 토스트 관련으로 물어보려고 했는데 사용해 주셨군요 👍🏼

@dannysir dannysir merged commit 4ca6cbb into front/main Nov 28, 2024
2 checks passed
@dongree dongree deleted the feature/bookmark branch December 5, 2024 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FE 프론트엔드 INTEGRATION API/Socket 연동 LAYOUT 레이아웃 구현
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants