fix(fe): disable access to problem create page#3596
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the MiddleBanner component by removing the 'use client' directive, commenting out the unused Link import, and replacing the active "Create Problem" button with a disabled, invisible dummy button (opacity-0) and commented-out code. The reviewer recommends removing the unnecessary dummy button and commented-out code to keep the codebase clean. Additionally, the reviewer highlights a critical security/UX concern: simply hiding or disabling the button on the UI does not prevent users from directly navigating to the /problem/create route, so proper route protection (such as a redirect or notFound()) should be implemented on the page level.
| <Button | ||
| disabled | ||
| className="bg-color-common-100 hover:bg-color-neutral-99 hidden h-12 w-fit rounded-full px-6 py-3 opacity-0 md:flex" | ||
| > | ||
| <span className="text-sub3_sb_16 text-color-common-0"> | ||
| 문제 생성 바로가기 | ||
| </span> | ||
| </Button> |
There was a problem hiding this comment.
1. 불필요한 더미 버튼 제거
레이아웃 유지를 위해 opacity-0 속성을 가진 더미 버튼을 추가하셨습니다. 하지만 부모 컨테이너가 flex-col justify-center 구조이므로, 버튼이 없어도 텍스트가 세로 중앙에 자연스럽게 정렬됩니다. 불필요한 더미 엘리먼트는 렌더링 성능과 코드 가독성에 좋지 않으므로 제거하는 것을 권장합니다.
또한, 위쪽에 주석 처리된 <Button> 및 <Link> 코드 블록도 Git 이력을 통해 언제든지 복구할 수 있으므로 주석으로 남겨두기보다는 완전히 삭제하는 것이 깔끔합니다.
2. 실제 페이지 접근 제어 필요 (중요)
메인 페이지에서 버튼을 숨기거나 비활성화하는 것만으로는 사용자가 /problem/create 경로로 직접 접속하는 것을 막을 수 없습니다. PR의 목적인 **"완성되지 않은 경로에 대한 사용자 접근 제한"**을 확실히 달성하려면, 해당 페이지 컴포넌트(apps/frontend/app/(client)/(main)/(create)/problem/create/page.tsx) 내부에서 Next.js의 notFound()를 호출하거나 메인 페이지로 리다이렉트(redirect('/'))하는 로직을 추가해야 합니다.
| import { Button } from '@/components/shadcn/button' | ||
| import Link from 'next/link' | ||
|
|
||
| // import Link from 'next/link' |
|
✅ Syncing Preview App Succeeded Application: |
Description
대회 전에 완성되지 않은 problem/create 경로에 대한 사용자 접근을 막습니다.
Additional context
메인페이지의 문제 생성 바로가기 버튼을 숨김 처리 했습니다.
closes TAS-2727
Before submitting the PR, please make sure you do the following
fixes #123).