-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: 1차 UT QA 홈 페이지 반영 #58
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
080aa82
feat: Toast 컴포넌트 추가
suminhan123 73149f4
feat: useToast 훅 생성 및 페이지 호출
suminhan123 d197fd7
style: Toast layout 에 위치해 스타일 적용
suminhan123 0ec23d0
Merge branch 'main' into feat/#53
suminhan123 d2cfac2
feat: 전역 상태 toast 추가
suminhan123 47e4449
feat: 작성한 특정 회차 회고 focus 기능 추가
suminhan123 b71d4f8
feat: useSearchParams 위해 suspense 추가
suminhan123 476fba6
fix: merge conflict 해결
suminhan123 a92fff7
feat: 리뷰 반영
suminhan123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
6 changes: 3 additions & 3 deletions
6
src/app/(route)/report/components/CharacterSelectBottomSheet/CharacterSelectBottomSheet.tsx
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
4 changes: 2 additions & 2 deletions
4
src/app/(route)/report/components/CharacterSelectButton/CharacterSelectButton.tsx
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
5 changes: 3 additions & 2 deletions
5
src/app/(route)/report/components/CharacterSelectLayout/CharacterSelectLayout.tsx
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { PropsWithChildren } from 'react'; | ||
import { Suspense } from 'react'; | ||
|
||
export default function ReportQuestionsLayout({ children }: PropsWithChildren) { | ||
return <Suspense>{children}</Suspense>; | ||
} |
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,18 +1,31 @@ | ||
'use client'; | ||
|
||
import { useEffect, useState } from 'react'; | ||
import { useEffect, useRef, useState } from 'react'; | ||
import { useSearchParams } from 'next/navigation'; | ||
import dayjs from 'dayjs'; | ||
|
||
import { Card } from '@/components/Card'; | ||
import styles from './page.module.scss'; | ||
import CharacterSelectLayout from '../components/CharacterSelectLayout'; | ||
import { useGetCharacters } from '@/query-hooks/useCharacter'; | ||
import { useMemberStore } from '@/stores'; | ||
import type { CharacterItem } from '@/query-hooks/useCharacter/types'; | ||
import { useGetSubmissions } from '@/query-hooks/useSurvey'; | ||
import { useMemberStore } from '@/stores'; | ||
|
||
import CharacterSelectLayout from '../components/CharacterSelectLayout'; | ||
|
||
import styles from './page.module.scss'; | ||
|
||
export default function ReportQuestions() { | ||
const [open, setOpen] = useState(false); | ||
const searchParams = useSearchParams(); | ||
|
||
const focusIndex = searchParams.get('focus') ? Number(searchParams.get('focus')) - 1 : null; | ||
const cardRefs = useRef<(HTMLDivElement | null)[]>([]); | ||
|
||
useEffect(() => { | ||
if (focusIndex !== null && cardRefs.current[focusIndex]) { | ||
cardRefs.current[focusIndex]?.scrollIntoView({ behavior: 'smooth', block: 'start' }); | ||
} | ||
}, [focusIndex]); | ||
const [selectedCharacter, setSelectedCharacter] = useState<CharacterItem>({ ordinalNumber: 0, bundleId: 0 }); | ||
|
||
const { data: characterData = { characters: [] } } = useGetCharacters({ memberId: useMemberStore().getMemberId() }); | ||
|
@@ -49,12 +62,16 @@ export default function ReportQuestions() { | |
<div className={styles.contentContainer}> | ||
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. 수민이 작업과 아주 무관하게.. 카드 개수가 많아지면 맨 아래 카드가 안보이는 오류가 있는 것 같당 |
||
{submissionData.surveyRecords.map((question, index) => ( | ||
<Card | ||
ref={(el) => { | ||
cardRefs.current[index] = el; | ||
}} | ||
key={index} | ||
count={index + 1} | ||
date={formatDate(question.submittedAt)} | ||
question={question.question} | ||
answer={question.answer} | ||
retrospective={question.retrospective} | ||
isOpen={focusIndex === index} | ||
className={styles.card} | ||
/> | ||
))} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
.viewport { | ||
list-style: none; | ||
z-index: 100; | ||
outline: none; | ||
} | ||
|
||
.root { | ||
background: rgba(68, 73, 83, 0.95); | ||
border-radius: 0.75rem; | ||
z-index: 100; | ||
position: absolute; | ||
bottom: 4.25rem; | ||
width: calc(100% - 2.5rem); | ||
padding-left: 1.7188rem; | ||
padding-right: 1.7188rem; | ||
text-align: center; | ||
height: 4.5rem; | ||
left: 50%; | ||
transform: translateX(-50%); | ||
@include flex-center; | ||
|
||
&[data-state='open'] { | ||
animation: slideIn 300ms ease-out; | ||
} | ||
|
||
&[data-state='closed'] { | ||
animation: slideOut 600ms ease-in; | ||
} | ||
|
||
&[data-swipe='move'] { | ||
transform: translateY(var(--radix-toast-swipe-move-y)); | ||
} | ||
|
||
&[data-swipe='cancel'] { | ||
transform: translateY(0); | ||
transition: transform 300ms ease-out; | ||
} | ||
|
||
&[data-swipe='end'] { | ||
animation: swipeOut 300ms ease-out; | ||
} | ||
} | ||
|
||
@keyframes slideIn { | ||
from { | ||
transform: translateX(-50%) translateY(5vh); | ||
} | ||
to { | ||
transform: translateX(-50%) translateY(0); | ||
} | ||
} | ||
|
||
@keyframes slideOut { | ||
from { | ||
transform: translateX(-50%) translateY(0); | ||
} | ||
to { | ||
transform: translateX(-50%) translateY(9.5vh); | ||
} | ||
} | ||
|
||
@keyframes swipeOut { | ||
from { | ||
transform: translateX(-50%) translateY(var(--radix-toast-swipe-end-y)); | ||
} | ||
to { | ||
transform: translateX(-50%) translateY(100%); | ||
} | ||
} | ||
.title { | ||
color: $white; | ||
@include subTitle4; | ||
} |
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,20 @@ | ||
'use client'; | ||
|
||
import { Toast as RadixToast } from 'radix-ui'; | ||
|
||
import { useToast } from '@/hooks'; | ||
|
||
import styles from './Toast.module.scss'; | ||
|
||
export default function Toast() { | ||
const { toast, updateToast } = useToast(); | ||
|
||
return ( | ||
<RadixToast.Provider swipeDirection="down" duration={1000}> | ||
<RadixToast.Root className={styles.root} open={toast.open} onOpenChange={updateToast}> | ||
<RadixToast.Title className={styles.title}>{toast.message}</RadixToast.Title> | ||
</RadixToast.Root> | ||
<RadixToast.Viewport className={styles.viewport} /> | ||
</RadixToast.Provider> | ||
); | ||
} |
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 @@ | ||
export { default as Toast } from './Toast'; |
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 +1,2 @@ | ||
export * from './usePreviousValue'; | ||
export * from './useToast'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
굿 나도 요렇게 바꿔야겠다 fallback으로 로딩뷰 여기다 넣어주는게 좀 더 깔끔할 수도 있겠다
페이지 전체적으로 이렇게 적용할 생각이야?
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.
next 에서 loading 페이지 만들어주면 next 자동으로 suspense 랑 fallback 알아서 해주는 걸루 알고있어! 그래서 로딩 관련해서는
loading.tsx
페이지만 적절히 만들어주면 될 거 같어