-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from dnd-side-project/OZ-70-F-pick
Feature : Pick, Talk페이지 애니메이션 구현
- Loading branch information
Showing
23 changed files
with
3,084 additions
and
1,750 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,11 @@ | ||
import { UseQueryOptions, useQuery } from '@tanstack/react-query'; | ||
|
||
import { PosePickResponse, PoseTalkResponse } from '.'; | ||
import publicApi from './config/publicApi'; | ||
|
||
export const getPoseTalk = () => publicApi.get('/pose/talk'); | ||
export const usePoseTalkQuery = () => | ||
useQuery(['poseTalk'], getPoseTalk, { | ||
enabled: false, | ||
}); | ||
|
||
export const getPoseDetail = (poseId: number) => publicApi.get(`/pose/${poseId}`); | ||
export const usePoseDetailQuery = (poseId: number) => | ||
useQuery(['poseId', poseId], () => getPoseDetail(poseId)); | ||
|
||
export interface PosePickResponse { | ||
poseInfo: { | ||
createdAt: string; | ||
frameCount: number; | ||
imageKey: string; | ||
peopleCount: number; | ||
poseId: number; | ||
source: string; | ||
sourceUrl: string; | ||
tagAttributes: string; | ||
updatedAt: string; | ||
}; | ||
} | ||
|
||
export const getPosePick = (peopleCount: number) => | ||
publicApi.get<PosePickResponse>(`/pose/pick/${peopleCount}`); | ||
|
||
export const usePosePickQuery = ( | ||
peopleCount: number, | ||
options?: UseQueryOptions<PosePickResponse> | ||
) => useQuery<PosePickResponse>(['posePick', peopleCount], () => getPosePick(peopleCount), options); | ||
export const getPoseDetail = (poseId: number) => publicApi.get(`/pose/${poseId}`); | ||
|
||
export const getPoseTalk = () => publicApi.get<PoseTalkResponse>('/pose/talk'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './apis'; | ||
export * from './queries'; | ||
export * from './type'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { UseQueryOptions, useQuery } from '@tanstack/react-query'; | ||
|
||
import { | ||
type PosePickResponse, | ||
type PoseTalkResponse, | ||
getPoseDetail, | ||
getPosePick, | ||
getPoseTalk, | ||
} from '.'; | ||
|
||
export const usePoseDetailQuery = (poseId: number) => | ||
useQuery(['poseId', poseId], () => getPoseDetail(poseId)); | ||
|
||
export const usePosePickQuery = ( | ||
peopleCount: number, | ||
options?: UseQueryOptions<PosePickResponse> | ||
) => | ||
useQuery<PosePickResponse>(['posePick', peopleCount], () => getPosePick(peopleCount), { | ||
enabled: false, | ||
...options, | ||
}); | ||
|
||
export const usePoseTalkQuery = (options?: UseQueryOptions<PoseTalkResponse>) => | ||
useQuery<PoseTalkResponse>(['poseTalk'], getPoseTalk, { enabled: false, ...options }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export interface PosePickResponse { | ||
poseInfo: { | ||
createdAt: string; | ||
frameCount: number; | ||
imageKey: string; | ||
peopleCount: number; | ||
poseId: number; | ||
source: string; | ||
sourceUrl: string; | ||
tagAttributes: string; | ||
updatedAt: string; | ||
}; | ||
} | ||
|
||
export interface PoseTalkResponse { | ||
poseWord: { | ||
content: string; | ||
createdAt: string; | ||
updateAt: string; | ||
wordId: number; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,60 @@ | ||
'use client'; | ||
|
||
import Image from 'next/image'; | ||
import { useEffect, useRef, useState } from 'react'; | ||
import Lottie from 'react-lottie-player'; | ||
|
||
import { usePoseTalkQuery } from '@/apis'; | ||
import { BottomFixedButton } from '@/components/Button'; | ||
|
||
import lottieTalkAfterClick from '#/lotties/talk_after_click.json'; | ||
import lottieTalkBeforeClick from '#/lotties/talk_before_click.json'; | ||
|
||
interface TalkSectionProps {} | ||
export default function TalkSection() { | ||
return <section></section>; | ||
const [isFirstLoading, setIsFirstLoading] = useState<boolean>(true); | ||
const [isLoading, setIsLoading] = useState<boolean>(false); | ||
const [talkWord, setTalkWord] = useState<string>('포즈로 말해요'); | ||
const { refetch } = usePoseTalkQuery({ | ||
onSuccess: (data) => { | ||
setIsFirstLoading(false); | ||
setIsLoading(true); | ||
setTimeout(() => { | ||
setIsLoading(false); | ||
setTalkWord(data.poseWord.content); | ||
}, 3000); | ||
}, | ||
}); | ||
|
||
const handleTalkClick = () => { | ||
refetch(); | ||
}; | ||
|
||
return ( | ||
<section className="flex flex-col items-center"> | ||
<h1>{talkWord}</h1> | ||
{isFirstLoading && ( | ||
<Lottie | ||
loop | ||
animationData={lottieTalkBeforeClick} | ||
play | ||
style={{ width: '100%', height: '100%' }} | ||
/> | ||
)} | ||
{isLoading && ( | ||
<Lottie | ||
loop | ||
animationData={lottieTalkAfterClick} | ||
play | ||
style={{ width: '100%', height: '100%' }} | ||
/> | ||
)} | ||
{!isFirstLoading && !isLoading && ( | ||
<Image src="/lotties/talk_after_loading.png" width={360} height={10} alt="lottie" /> | ||
)} | ||
<BottomFixedButton className="bg-main-violet text-white" onClick={handleTalkClick}> | ||
제시어 뽑기 | ||
</BottomFixedButton> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters