-
Notifications
You must be signed in to change notification settings - Fork 1
Fix/130 QA사항 수정/리팩토링 #136
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/130 QA사항 수정/리팩토링 #136
Changes from 2 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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -87,9 +87,11 @@ function ReviewSection({ | |||||
| <div className='relative min-h-350'> | ||||||
| <ReviewTitle reviewCount={reviewCount} rating={rating} /> | ||||||
|
|
||||||
| <div className='pointer-events-none absolute inset-0 z-10 flex items-center justify-center'> | ||||||
| <div className='flex items-center justify-center font-bold'> | ||||||
| <p>작성된 리뷰가 없습니다</p> | ||||||
| <div className='pointer-events-none absolute inset-0 z-10 flex h-full items-center justify-center select-none'> | ||||||
| <div className='flex max-w-md items-center justify-center rounded-md bg-white px-20 py-20 shadow-2xl ring-1 ring-gray-200 select-none'> | ||||||
| <p className='text-md text-center font-bold text-gray-800'> | ||||||
| 작성된 후기가 없습니다 | ||||||
| </p> | ||||||
| </div> | ||||||
| </div> | ||||||
| </div> | ||||||
|
|
@@ -98,20 +100,20 @@ function ReviewSection({ | |||||
| } | ||||||
|
|
||||||
| if (isError) { | ||||||
| throw new Error('에러발생'); | ||||||
| throw new Error('리뷰섹션에서 에러가 발생했습니다.'); | ||||||
| } | ||||||
|
|
||||||
| return ( | ||||||
| <div className='mt-10 flex flex-col space-y-8'> | ||||||
| <ReviewTitle reviewCount={reviewCount} rating={rating} /> | ||||||
|
|
||||||
| <div className='relative min-h-350'> | ||||||
| <div className='pointer-events-none relative min-h-350 select-none'> | ||||||
|
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. 사용자 상호작용 제한을 재검토해주세요.
다음과 같이 수정하는 것을 제안합니다: - <div className='pointer-events-none relative min-h-350 select-none'>
+ <div className={`relative min-h-350 ${!user ? 'pointer-events-none select-none' : ''}`}>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| <div className={user ? '' : 'blur-sm'}>{ReviewComponent()}</div> | ||||||
|
|
||||||
| {!user && ( | ||||||
| <div className='pointer-events-none absolute inset-0 z-10 flex items-center justify-center'> | ||||||
| <div className='rounded-md bg-white/70 px-4 py-2 shadow-md'> | ||||||
| <p className='text-sm font-semibold text-gray-700'> | ||||||
| <div className='pointer-events-none absolute inset-0 z-10 flex h-full items-center justify-center select-none'> | ||||||
| <div className='flex max-w-md items-center justify-center rounded-md bg-white px-20 py-20 shadow-2xl ring-1 ring-gray-200 select-none'> | ||||||
| <p className='text-md text-center font-bold text-gray-800'> | ||||||
| 로그인 후 리뷰 전체 내용을 확인할 수 있어요 | ||||||
| </p> | ||||||
| </div> | ||||||
|
|
||||||
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,7 @@ import { uploadImage } from '../../utils/uploadImage'; | |||||||||||||||||||||||||||||||||||||||||
| import { ActivityDetailEdit, Schedule } from '@/types/activityDetailType'; | ||||||||||||||||||||||||||||||||||||||||||
| import { AxiosError } from 'axios'; | ||||||||||||||||||||||||||||||||||||||||||
| import { toast } from 'sonner'; | ||||||||||||||||||||||||||||||||||||||||||
| import { notFound } from 'next/navigation'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| interface SubImageType { | ||||||||||||||||||||||||||||||||||||||||||
| id?: number; | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -32,14 +33,26 @@ export const useEditActivityForm = () => { | |||||||||||||||||||||||||||||||||||||||||
| const [originalSchedules, setOriginalSchedules] = useState<Schedule[]>([]); | ||||||||||||||||||||||||||||||||||||||||||
| const [dates, setDates] = useState<Schedule[]>([]); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| const { data, isLoading, isError } = useQuery<ActivityDetailEdit, Error>({ | ||||||||||||||||||||||||||||||||||||||||||
| const { data, isLoading, status, isError, error } = useQuery< | ||||||||||||||||||||||||||||||||||||||||||
| ActivityDetailEdit, | ||||||||||||||||||||||||||||||||||||||||||
| Error | ||||||||||||||||||||||||||||||||||||||||||
| >({ | ||||||||||||||||||||||||||||||||||||||||||
| queryKey: ['edit-activity', id], | ||||||||||||||||||||||||||||||||||||||||||
| queryFn: async () => { | ||||||||||||||||||||||||||||||||||||||||||
| const res = await privateInstance.get(`/activities/${id}`); | ||||||||||||||||||||||||||||||||||||||||||
| return res.data; | ||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||
| enabled: !!id, | ||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||
| if (status === 'error') { | ||||||||||||||||||||||||||||||||||||||||||
| const axiosError = error as AxiosError; | ||||||||||||||||||||||||||||||||||||||||||
| const httpStatus = axiosError.response?.status; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| if (httpStatus === 404) { | ||||||||||||||||||||||||||||||||||||||||||
| console.log('404 에러임'); | ||||||||||||||||||||||||||||||||||||||||||
| notFound(); | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+47
to
+55
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. 404 에러 처리 로직의 위치를 수정해주세요. 현재 에러 처리 로직이 컴포넌트 본문 외부에 위치하여 렌더링 중에 실행됩니다. 이는 React의 규칙을 위반하고 예상치 못한 동작을 일으킬 수 있습니다. 다음과 같이 수정하여 에러 처리를 useEffect 내부로 이동시키거나 별도의 효과로 분리하는 것을 권장합니다: - if (status === 'error') {
- const axiosError = error as AxiosError;
- const httpStatus = axiosError.response?.status;
-
- if (httpStatus === 404) {
- console.log('404 에러임');
- notFound();
- }
- }
+ useEffect(() => {
+ if (status === 'error') {
+ const axiosError = error as AxiosError;
+ const httpStatus = axiosError.response?.status;
+
+ if (httpStatus === 404) {
+ console.log('Activity not found (404)');
+ notFound();
+ }
+ }
+ }, [status, error]);추가 개선사항:
📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||||||||||||||||||
| if (data) { | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ export default function ModalContent({ | |
| const { isOpen } = useModalContext(); | ||
| const [isMounted, setIsMounted] = useState(false); | ||
|
|
||
| const zIndexClass = zIndex ? `z-[${zIndex}]` : 'z-50'; | ||
| const zIndexClass = zIndex ? `z-[${zIndex}]` : 'z-999'; | ||
|
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. 🛠️ Refactor suggestion z-index 값 관리 체계화 필요 z-index를 50에서 999로 크게 증가시킨 것은 즉각적인 레이어링 문제는 해결할 수 있지만, 향후 유지보수에 어려움을 줄 수 있습니다. z-index 값들을 체계적으로 관리하는 것을 권장합니다:
- const zIndexClass = zIndex ? `z-[${zIndex}]` : 'z-999';
+ const zIndexClass = zIndex ? `z-[${zIndex}]` : 'z-200';🤖 Prompt for AI Agents |
||
|
|
||
| useEffect(() => { | ||
| setIsMounted(true); | ||
|
|
||
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.
🧹 Nitpick (assertive)
버튼 요소에 type 속성 추가 필요
정적 분석 도구가 지적한 대로 버튼 요소에 명시적인
type속성이 필요합니다. 폼 내부에서 의도하지 않은 제출을 방지하기 위해type="button"을 추가해야 합니다.다음과 같이 수정하세요:
Also applies to: 75-81
🧰 Tools
🪛 Biome (2.1.2)
[error] 67-73: Provide an explicit type prop for the button element.
The default type of a button is submit, which causes the submission of a form when placed inside a
formelement. This is likely not the behaviour that you want inside a React application.Allowed button types are: submit, button or reset
(lint/a11y/useButtonType)
🤖 Prompt for AI Agents