-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix : Issue 해결 #52
Fix : Issue 해결 #52
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,20 +6,17 @@ interface PhotoList { | |
} | ||
|
||
export default function PhotoList({ data }: PhotoList) { | ||
if (!data) return <Photo />; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 데이터 없을때 스켈레톤 ? 이미지 나오게 하면 좋을 것 같네요 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 그것도 좋을 것 같네요 -! |
||
return ( | ||
<> | ||
{data ? ( | ||
data.map((item) => ( | ||
<Photo | ||
key={item.poseInfo.poseId} | ||
imageKey={item.poseInfo.imageKey} | ||
source={item.poseInfo.source} | ||
id={item.poseInfo.poseId} | ||
/> | ||
)) | ||
) : ( | ||
<Photo /> | ||
)} | ||
{data.map((item) => ( | ||
<Photo | ||
key={item.poseInfo.poseId} | ||
imageKey={item.poseInfo.imageKey} | ||
source={item.poseInfo.source} | ||
id={item.poseInfo.poseId} | ||
/> | ||
))} | ||
</> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
'use client'; | ||
|
||
import { useState } from 'react'; | ||
import { useQueryClient } from '@tanstack/react-query'; | ||
import { useEffect, useState } from 'react'; | ||
import Lottie from 'react-lottie-player'; | ||
|
||
import lottieTalkAfterClick from '#/lotties/talk_after_click.json'; | ||
|
@@ -11,26 +12,38 @@ import { Spacing } from '@/components/Spacing'; | |
import useLoading from '@/hooks/useLoading'; | ||
|
||
export default function TalkSection() { | ||
const [talkWord, setTalkWord] = useState<string>(`제시어에 맞춰 포즈를 취해요!`); | ||
const { isLoading: isFirstLoading, stopLoading: stopFirstLoading } = useLoading({ | ||
loadingDelay: 1000, | ||
isFirstLoadingInfinite: true, | ||
}); | ||
|
||
const { refetch, data } = usePoseTalkQuery(); | ||
const { refetch, data } = usePoseTalkQuery({ | ||
onSuccess: (data) => { | ||
setTimeout(() => { | ||
setTalkWord(data.poseWord.content); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 코드가 아닌 기획관련 의견이긴 한데 , 1초동안 로딩하고나서 키워드 보여주고 이미지 재생하는 대신 키워드 보여주고 나서 1초동안 이미지 재생하는건 어떨까요 ?.? 키워드가 빨리 나오는게 좋을 것 같아서용 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 맞아요 이 부분 저도 무언가 어색하다랄까 .. 아쉽다는 느낌받긴했어요 회의 때 이 부분 이야기해봐도 좋을 것 같아요 ~ |
||
}, 1000); | ||
}, | ||
}); | ||
|
||
const { isLoading, startLoading } = useLoading({ | ||
loadingDelay: 1000, | ||
onStopLoading: () => data && setTalkWord(data.poseWord.content), | ||
initialState: false, | ||
}); | ||
const [talkWord, setTalkWord] = useState<string>(`제시어에 맞춰 포즈를 취해요!`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 엇 다른페이지 갔다왔을때 기본 키워드로 돌아가는거 고쳐진건가요?! 제가 코드만 보고 원리를 모르겠어서 여쭤봅니답ㅠㅜ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. useEffect(() => {
return () => {
queryClient.resetQueries(['poseTalk']);
};
}, [queryClient]); 이 부분에서 useEffect의 return문에 캐싱된 쿼리를 초기화 하도록 설정하였습니다. 우선 임시로 이 방식으로 구현은 했는데, 무언가 더 효율적인 코드가 있을 거라는 생각이 들어요 .. |
||
|
||
const handleTalkClick = () => { | ||
if (isFirstLoading) stopFirstLoading(); | ||
startLoading(); | ||
refetch(); | ||
}; | ||
|
||
const queryClient = useQueryClient(); | ||
|
||
useEffect(() => { | ||
return () => { | ||
queryClient.resetQueries(['poseTalk']); | ||
}; | ||
}, [queryClient]); | ||
|
||
return ( | ||
<section className="flex flex-col items-center"> | ||
<h1 className="max-w-310 break-keep text-center">{talkWord}</h1> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import { Metadata } from 'next'; | |
|
||
import TalkSection from './components/TalkSection'; | ||
import TitleSection from './components/TitleSection'; | ||
import { PageAnimation } from '@/components/PageAnimation'; | ||
import { Spacing } from '@/components/Spacing'; | ||
|
||
export const metadata: Metadata = { | ||
|
@@ -11,10 +12,10 @@ export const metadata: Metadata = { | |
export default function Talk() { | ||
return ( | ||
<> | ||
<div className="flex flex-1 flex-col items-center justify-center"> | ||
<PageAnimation className="flex flex-1 flex-col items-center justify-center"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pageanimation은 어떤 애니메이션인가요?.? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pageanimation은 framer-motion을 활용하여 애니메이션을 구현한 컴포넌트로, 컴포넌트가 마운트됬을 때 opacity 0부터 1까지 자연스럽게 변화합니다. |
||
<TitleSection /> | ||
<TalkSection /> | ||
</div> | ||
</PageAnimation> | ||
<Spacing size={80} /> | ||
</> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
'use client'; | ||
import cn from '@/utils/cn'; | ||
import { type AnimationProps, motion } from 'framer-motion'; | ||
|
||
import cn from '@/utils/cn'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cn도 궁금해요-! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cn은 기존 tailwindcss를 사용했을 때의 단점을 극복한 util함수입니다. 기존 tailwindcss를 사용하면 로 작성할 경우, 두 속성 중 한 속성이 사라지지 않고 스타일에 그대로 나타나는 이슈가 있었습니다. (중복으로 적용되지는 않지만 어떤 것이 적용될 지는 미지수) 그래서 twMerge 라이브러리를 도입하였지만, 이 라이브러리에서는 커스텀 css속성을 사용할 경우 적용이 정상적으로 동작하지 않는 이슈가 있습니다. 저희 프로젝트에서는 커스텀 css속성이 아니라, h1/h2 등 태그로 typography를 적용하기에 cn까지는 필요 없고, twMerge를 사용해도 될 것 같긴 하네용 |
||
|
||
import type { StrictPropsWithChildren } from '@/types'; | ||
|
||
interface PageAnimationProps extends AnimationProps { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
깔끔하네유 ㅎㅎ 감삼다