Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/app/(crew)/crew/detail/[id]/_components/create-gathering.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
'use client';

import { useRouter } from 'next/navigation';
import { useDisclosure } from '@mantine/hooks';
import { useAuthStore } from '@/src/store/use-auth-store';
import CreateGatheringModalContainer from '@/src/app/(crew)/crew/_components/create-gathering-modal/container';
import Button from '@/src/components/common/input/button';
import { CreateGatheringRequestType } from '@/src/types/gathering-data';

export default function CreateGathering() {
const { isAuth } = useAuthStore();
const router = useRouter();
const [opened, { open, close }] = useDisclosure(false);

const handleButtonClick = () => {
if (isAuth) {
open(); // 로그인 상태일 경우 모달 열기
} else {
router.push('/login'); // 비로그인 상태일 경우 로그인 페이지로 이동
}
};

const initialValue: CreateGatheringRequestType = {
title: '',
introduce: '',
Expand All @@ -19,7 +31,7 @@ export default function CreateGathering() {

return (
<>
<Button type="button" className="btn-filled px-4" onClick={open}>
<Button type="button" className="btn-filled px-4" onClick={handleButtonClick}>
약속 만들기
</Button>
<CreateGatheringModalContainer opened={opened} close={close} data={initialValue} />
Expand Down
12 changes: 11 additions & 1 deletion src/app/_components/hero/hero-crew.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import Image from 'next/image';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { Button } from '@mantine/core';
import { useAuthStore } from '@/src/store/use-auth-store';
import ImgHeroCrew from '@/public/assets/icons/ic-dumbbell.svg';

export default function HeroCrew() {
const { isAuth, logout } = useAuthStore();
const router = useRouter();

const handleLogout = () => {
logout();
router.push('/');
};

return (
<section className="pb-3 md:pb-4 lg:pb-12.5">
<div className="flex items-end justify-between">
Expand All @@ -20,7 +30,7 @@ export default function HeroCrew() {
</div>
<Button
component={Link}
href="/crew/create"
href={isAuth ? '/crew/create' : '/login'}
className="-translate-y-1 items-center rounded-xl bg-blue-500 py-2 text-sm font-semibold md:h-11 md:text-lg md:font-bold"
>
크루 만들기
Expand Down
4 changes: 3 additions & 1 deletion src/components/common/crew-list/crew-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export default function CrewCard({
inWhere,
}: CrewCardProps) {
const [prefetched, setPrefetched] = useState(new Set());
const CREWPAGE = `/crew/detail/${id}`;
// NOTE: api연결 후 되돌리기
// const CREWPAGE = `/crew/detail/${id}`;
const CREWPAGE = `/crew/detail/1`;
Comment on lines +40 to +42
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

하드코딩된 ID 값을 원래대로 되돌려주세요.

현재 모든 크루 카드가 ID가 1인 상세 페이지로 리디렉션되고 있습니다. 이는 사용자가 선택한 특정 크루의 상세 정보를 볼 수 없게 만드는 심각한 문제입니다.

API 연결 후 수정 예정이라는 주석이 있지만, 이러한 임시 변경은 다음과 같은 문제를 야기할 수 있습니다:

  • 사용자가 잘못된 크루 정보를 보게 됨
  • 크루 상세 페이지로의 올바른 네비게이션이 불가능
  • 사용자 경험 저하

다음과 같이 수정해주세요:

-  // NOTE: api연결 후 되돌리기
-  // const CREWPAGE = `/crew/detail/${id}`;
-  const CREWPAGE = `/crew/detail/1`;
+  const CREWPAGE = `/crew/detail/${id}`;

만약 API 연결이 아직 준비되지 않았다면, 임시 데이터(mock data)를 사용하는 것을 고려해보세요.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// NOTE: api연결 후 되돌리기
// const CREWPAGE = `/crew/detail/${id}`;
const CREWPAGE = `/crew/detail/1`;
const CREWPAGE = `/crew/detail/${id}`;

const router = useRouter();

const handleCardClick = () => {
Expand Down