Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 8 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ const config: StorybookConfig = {
name: '@storybook/nextjs-vite',
options: {},
},
staticDirs: ['..\\public'],
// staticDirs: ['../public'],
async viteFinal(config, { configType }) {
if (configType === 'PRODUCTION') {
config.base = '/storybook/';
}
return config;
},
};

export default config;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"build": "next build && storybook build -o public/storybook",
"start": "next start",
"lint": "next lint",
"type-check": "tsc --noEmit",
Expand Down
2 changes: 1 addition & 1 deletion src/app/(app)/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function SegmentError({ error, reset }: ErrorPageProps) {
}, [error]);

return (
<div className='flex-col-center gap-8 bg-white py-50 text-center text-gray-800'>
<div className='flex-col-center min-h-screen gap-8 bg-white py-50 text-center text-gray-800'>
<h2 className='font-size-20 tablet:font-size-30 flex-center font-bold'>
<TriangleAlert className='mr-8 size-30' />
콘텐츠를 불러오지 못했습니다.
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/test/error/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function GET(request: NextRequest) {
);
case '409':
return NextResponse.json(
{ message: '이미 사용 중인 이름입니다.' },
{ message: '이미 사용 중인 이메일입니다.' },
{ status: 409 },
);
case '500':
Expand Down
2 changes: 1 addition & 1 deletion src/app/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function GlobalError({ error, reset }: ErrorPageProps) {
}, [error]);

return (
<div className='flex-col-center gap-8 bg-red-50 p-50 text-center text-red-800'>
<div className='flex-col-center min-h-screen gap-8 bg-red-50 p-50 text-center text-red-800'>
<h1 className='font-size-25 tablet:font-size-30 flex-center font-bold'>
<ErrorIcon className='mr-8 size-30' />
문제가 발생했습니다.
Expand Down
12 changes: 12 additions & 0 deletions src/app/storybook/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use client';

import { useRouter } from 'next/navigation';
import { useEffect } from 'react';

export default function StorybookRedirect() {
const router = useRouter();
useEffect(() => {
router.replace('/storybook/index.html');
}, []);
return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ import TriangleArrow from '@/shared/assets/icons/TriangleArrow';

interface ExpandableReviewProps {
text: string;
maxHeight?: number;
}

export default function ExpandableReview({ text }: ExpandableReviewProps) {
export default function ExpandableText({
text,
maxHeight = 1000,
}: ExpandableReviewProps) {
const [isExpanded, setIsExpanded] = useState(false);
const [showToggle, setShowToggle] = useState(false);
const contentRef = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -45,15 +49,12 @@ export default function ExpandableReview({ text }: ExpandableReviewProps) {
<div
ref={contentRef}
className={`font-size-16 relative overflow-hidden font-medium break-words whitespace-pre-line text-gray-950 transition-all duration-900 ease-in-out ${
isExpanded ? 'max-h-[1000px] opacity-80' : 'max-h-[120px] opacity-100'
isExpanded
? `max-h-[${maxHeight}px] opacity-80`
: `max-h-[120px] opacity-100`
}`}
>
{text}

{/* 말줄임용 그라디언트 */}
{!isExpanded && showToggle && (
<div className='pointer-events-none absolute bottom-0 left-0 h-10 w-full bg-gradient-to-t from-white via-white/100 to-transparent transition-opacity duration-500' />
)}
</div>

{/* 더보기 버튼 */}
Expand Down
8 changes: 5 additions & 3 deletions src/domain/Activity/components/detail/Review/ReviewCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Star } from 'lucide-react';

import ExpandableReview from '@/domain/Activity/components/detail/Review/ExpandableReview';
import ExpandableText from '@/domain/Activity/components/detail/Review/ExpandableText';
import Avatar from '@/shared/components/ui/avatar';

import { Review } from '../../../types/detail/types';
import { getTimeAgo } from '../../../utils/getTimeAgo';
Expand Down Expand Up @@ -37,8 +38,9 @@ export default function ReviewCard(review: Review) {

return (
<article className='flex h-fit flex-col gap-[1.2rem] rounded-4xl bg-white p-20 shadow-[0_4px_20px_rgba(0,0,0,0.05)]'>
<div className='flex flex-col gap-4'>
<div className='flex flex-col gap-10'>
<div className='flex items-center justify-start gap-10'>
<Avatar profileImageUrl={user.profileImageUrl} />
<span className='font-size-16 font-bold text-gray-950'>
{user.nickname}
</span>
Expand All @@ -61,7 +63,7 @@ export default function ReviewCard(review: Review) {
})}
</div>
</div>
<ExpandableReview text={content} />
<ExpandableText text={content} />
</article>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default function ActivityDropdown({
try {
await deleteActivity(id);
queryClient.invalidateQueries({ queryKey: activitiesKeys.all });
queryClient.invalidateQueries({ queryKey: ['carousel-activities'] });
router.push('/activities');
} catch (e) {
console.error(e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ExpandableText from '@/domain/Activity/components/detail/Review/ExpandableText';

/**
* DescriptionSection
* 체험 상세 페이지에서 체험 설명을 보여주는 컴포넌트
Expand All @@ -16,9 +18,7 @@ export default function DescriptionSection({
return (
<section className='flex w-full flex-col gap-8 border-b border-gray-100 pb-40'>
<h2 className='font-size-18 font-bold'>체험 설명</h2>
<p className='font-size-16 font-medium break-words whitespace-pre-line'>
{description}
</p>
<ExpandableText text={description} />
</section>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default function DeleteMyActivityModal({
},
onSettled: () => {
queryClient.invalidateQueries({ queryKey: ['my-activities'] });
queryClient.invalidateQueries({ queryKey: ['carousel-activities'] });
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@ export default function DayCell({
status: 'declined',
}),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['reservationsBySchedule'] });
queryClient.invalidateQueries({
queryKey: [
'allReservationsByDate',
selectedActivityId,
day.format('YYYY-MM-DD'),
],
});
queryClient.invalidateQueries({ queryKey: ['schedules'] });
queryClient.invalidateQueries({ queryKey: ['reservationDashboard'] });
},
Expand Down
24 changes: 9 additions & 15 deletions src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from 'next/server';

import setAuthCookies from '@/domain/Auth/utils/setAuthCookies';
import { ERROR_CODES, ROUTES } from '@/shared/constants/routes';

import { BRIDGE_API } from './shared/constants/bridgeEndpoints';
Expand Down Expand Up @@ -139,21 +140,14 @@ export async function middleware(request: NextRequest) {
signal: AbortSignal.timeout(30000),
});

const finalResponse = new NextResponse(response.body, {
status: response.status,
statusText: response.statusText,
headers: response.headers,
});

finalResponse.cookies.set('accessToken', newAccessToken, {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
path: '/',
maxAge: 60 * 60,
sameSite: 'lax',
});

return finalResponse;
return setAuthCookies(
new NextResponse(response.body, {
status: response.status,
statusText: response.statusText,
headers: response.headers,
}),
tokens,
);
} else {
console.log(
'[Middleware] Refresh Token 만료 또는 갱신 실패. 로그인 페이지로 리다이렉트합니다.',
Expand Down
8 changes: 8 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"rewrites": [
{
"source": "/storybook",
"destination": "/_next/static/storybook/index.html"
}
]
}
Loading