Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
6 changes: 5 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ const config: StorybookConfig = {
],
framework: {
name: '@storybook/nextjs',
options: {},
options: {
method: 'alphabetical',

storySort: {},
},
},
};

Expand Down
17 changes: 17 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,20 @@ export const decorators = [
(renderStory: any) => <ColorSchemeWrapper>{renderStory()}</ColorSchemeWrapper>,
(renderStory: any) => <MantineProvider>{renderStory()}</MantineProvider>,
];

export const parameters = {
options: {
storySort: {
method: 'alphabetical',
order: [
'common',
['button', 'calendar', 'image', 'input'],
'layout',
'auth',
'crew',
'gathering',
'review',
],
},
},
};
1 change: 0 additions & 1 deletion src/_apis/crew/crew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
CreateCrewRequestTypes,
CreateCrewResponseTypes,
EditCrewRequestTypes,
EditCrewResponseTypes,
} from '@/src/types/create-crew';

export async function createCrew(data: CreateCrewRequestTypes) {
Expand Down
1 change: 0 additions & 1 deletion src/_apis/image/get-image-url.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { fetchApi } from '@/src/utils/api';
import validateFile from '@/src/utils/validate-file';
import Toast from '@/src/components/common/toast';
import { GetImageUrlResponseTypes } from '@/src/types/create-crew';

export async function getImageUrl(
Expand Down
2 changes: 1 addition & 1 deletion src/app/(auth)/login/_component/login-form.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryFn } from '@storybook/react';
import LoginForm, { LoginFormValues } from './login-form';

const meta: Meta = {
title: 'Components/auth/LoginForm',
title: 'auth/login-form',
component: LoginForm,
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/(auth)/signup/_component/signup-form.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryFn } from '@storybook/react';
import SignupForm, { SignupFormValues } from './signup-form';

const meta: Meta = {
title: 'Components/auth/SignupForm',
title: 'auth/signup-form',
component: SignupForm,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import categoryData from '@/src/data/category.json';
import InternalCategory, { InternalCategoryProps } from '.';

const meta: Meta = {
title: 'Components/category/internal-category',
title: 'layout/category',
component: InternalCategory,
tags: ['autodocs'],
argTypes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const initialValue: CreateCrewRequestTypes = {
};

export default {
title: 'forms/create-crew-form',
title: 'crew/create-crew-form',
component: CreateCrewForm,
tags: ['autodocs'],
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const initialValue: CreateGatheringFormTypes = {
};

export default {
title: 'forms/create-gathering-form',
title: 'gathering/create-gathering-form',
component: CreateGatheringForm,
tags: ['autodocs'],
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CrewReviewData } from '@/src/mock/review-data';
import CrewReviewList from './crew-review-list';

const meta: Meta<typeof CrewReviewList> = {
title: 'Components/Detail/CrewReviewList',
title: 'crew/crew-review-list',
component: CrewReviewList,
parameters: {
layout: 'fulled',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
import DetailCrewPresenter from './detail-crew-presenter';

const meta: Meta<typeof DetailCrewPresenter> = {
title: 'Components/Detail/DetailCrewPresenter',
title: 'crew/crew-detail',
component: DetailCrewPresenter,
parameters: {
layout: 'fullscreen',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Meta, StoryFn } from '@storybook/react';
import GatheringDetailModalContainer, { GatheringDetailModalContainerProps } from './container';

const meta: Meta = {
title: 'components/gathering-detail-modal',
title: 'gathering/gathering-detail-modal',
component: GatheringDetailModalContainer,
argTypes: {
opened: { control: 'boolean' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meta, StoryFn } from '@storybook/react';
import RatingDisplay, { ReviewRateInfo } from './rating-display';

export default {
title: 'Components/Detail/RatingDisplay',
title: 'crew/crew-rating-display',
component: RatingDisplay,
tags: ['autodocs'],
argTypes: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client';

import { useEffect, useState } from 'react';
import CrewReviewList from './crew-review-list';
import RatingDisplay from './rating-display';
// import { useEffect, useState } from 'react';
// import CrewReviewList from './crew-review-list';
// import RatingDisplay from './rating-display';

export default function CrewReviewSection() {
// TODO: review ์ถ”ํ›„ ์ถ”๊ฐ€
Expand Down
2 changes: 1 addition & 1 deletion src/app/(crew)/crew/detail/[id]/edit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import IcoCreateCrew from '@/public/assets/icons/ic-create-crew.svg';

export default function EditCrewPage() {
const { id } = useParams();
const { data, isLoading, error } = useGetCrewDetailQuery(Number(id));
const { data, isLoading } = useGetCrewDetailQuery(Number(id));
Copy link

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue

์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋กœ์ง์ด ๋ˆ„๋ฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค

useGetCrewDetailQuery์—์„œ ์—๋Ÿฌ ์ฒ˜๋ฆฌ๊ฐ€ ์ œ๊ฑฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋ฐ์ดํ„ฐ fetching ์‹คํŒจ ์‹œ ์‚ฌ์šฉ์ž์—๊ฒŒ ์ ์ ˆํ•œ ํ”ผ๋“œ๋ฐฑ์„ ์ œ๊ณตํ•˜์ง€ ๋ชปํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์—๋Ÿฌ ์ฒ˜๋ฆฌ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

- const { data, isLoading } = useGetCrewDetailQuery(Number(id));
+ const { data, isLoading, error } = useGetCrewDetailQuery(Number(id));
+ if (error) {
+   return (
+     <div className="fixed inset-0 flex items-center justify-center">
+       <p className="text-red-500">๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š”๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ์‹œ๋„ํ•ด ์ฃผ์„ธ์š”.</p>
+     </div>
+   );
+ }
๐Ÿ“ 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
const { data, isLoading } = useGetCrewDetailQuery(Number(id));
const { data, isLoading, error } = useGetCrewDetailQuery(Number(id));
if (error) {
return (
<div className="fixed inset-0 flex items-center justify-center">
<p className="text-red-500">๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š”๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ์‹œ๋„ํ•ด ์ฃผ์„ธ์š”.</p>
</div>
);
}

const { isPending, mutate } = useEditCrewQuery(Number(id));
if (data === undefined) return null;

Expand Down
4 changes: 2 additions & 2 deletions src/app/(crew)/crew/detail/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getGatheringList } from '@/src/_apis/crew/crew-gathering-list-apis';
import CreateGathering from './_components/create-gathering';
import DetailCrew from './_components/detail-crew-container';
import GatheringListSection from './_components/gathering-list-section';
import CrewReviewSection from './_components/review-section';

// import CrewReviewSection from './_components/review-section';

interface CrewDetailPageProps {
params: { id: string };
Expand Down
1 change: 0 additions & 1 deletion src/app/(crew)/my-crew/hosted/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';

import { Loader } from '@mantine/core';
import { useGetMyCrewHostedQuery } from '@/src/_queries/crew/my-crew-hosted-list-query';
import { useInfiniteScroll } from '@/src/hooks/use-infinite-scroll';
import CrewCardList from '@/src/components/common/crew-list/crew-card-list';
Expand Down
1 change: 0 additions & 1 deletion src/app/(crew)/my-crew/joined/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';

import { Loader } from '@mantine/core';
import { useGetMyCrewJoinedQuery } from '@/src/_queries/crew/my-crew-joined-list-query';
import { useInfiniteScroll } from '@/src/hooks/use-infinite-scroll';
import CrewCardList from '@/src/components/common/crew-list/crew-card-list';
Expand Down
8 changes: 2 additions & 6 deletions src/app/(crew)/my-page/_components/profile-card/container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
import { useEffect, useState } from 'react';
import { toast } from 'react-toastify';
import { useRouter } from 'next/navigation';
import {
fetchUpdatedUser,
resetUserProfileImage,
updateUserProfile,
} from '@/src/_apis/auth/user-apis';
import { resetUserProfileImage, updateUserProfile } from '@/src/_apis/auth/user-apis';
import { useUser } from '@/src/_queries/auth/user-queries';
import { useAuth } from '@/src/hooks/use-auth';
import ProfileSkeleton from '@/src/components/common/skeleton/profile-skeleton';
Expand Down Expand Up @@ -50,7 +46,7 @@ export default function ProfileCard() {
const file = (event.target as HTMLInputElement)?.files?.[0];
if (file) {
if (file.size > 5 * 1024 * 1024) {
alert('5MB ์ดํ•˜์˜ ํŒŒ์ผ๋งŒ ์—…๋กœ๋“œ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.');
toast.error('5MB ์ดํ•˜์˜ ํŒŒ์ผ๋งŒ ์—…๋กœ๋“œ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.');
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/(crew)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useRef, useState } from 'react';
import Image from 'next/image';
import { Divider, Loader, Skeleton, TextInput } from '@mantine/core';
import { Divider, TextInput } from '@mantine/core';
import { useGetCrewListQuery } from '@/src/_queries/crew/crew-list-queries';
import regionData from '@/src/data/region.json';
import { useInfiniteScroll } from '@/src/hooks/use-infinite-scroll';
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/crew-list/crew-card-list.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ClientProvider from '@/src/components/client-provider';
import CrewCardList from './crew-card-list';

const meta: Meta = {
title: 'Components/CrewCardList/CrewCardList',
title: 'crew/crew-card-list',
component: CrewCardList,
parameters: {
layout: 'fullscreen',
Expand Down
13 changes: 0 additions & 13 deletions src/components/common/crew-list/crew-card.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';

import { useState } from 'react';
import Image from 'next/image';
import { useRouter } from 'next/navigation';
import ProgressBar from '@/src/components/common/progress-bar/index';
Expand All @@ -26,21 +25,9 @@ export default function CrewCard({
crewMembers,
inWhere,
}: CrewCardProps) {
const [prefetched, setPrefetched] = useState(new Set());
const CREWPAGE = `/crew/detail/${id}`;
const router = useRouter();

const handleCardClick = () => {
router.push(CREWPAGE);
};

const handleCardMouseUp = () => {
if (!prefetched.has(CREWPAGE)) {
router.prefetch(CREWPAGE);
setPrefetched(new Set(prefetched).add(CREWPAGE));
}
};

return (
<div
role="presentation"
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/crew-list/profiles.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react';
import Profiles from './profiles';

const meta: Meta = {
title: 'Components/CrewCardList/Profiles',
title: 'crew/crew-profiles',
component: Profiles,
parameters: {
layout: 'centered',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import GatheringCard from './container';
const queryClient = new QueryClient();

const meta: Meta<typeof GatheringCard> = {
title: 'Components/GatheringCard',
title: 'gathering/gathering-card',
component: GatheringCard,
parameters: {
layout: 'fullscreen',
Expand Down
1 change: 0 additions & 1 deletion src/components/common/gathering-card/presenter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { MouseEvent } from 'react';
import Image from 'next/image';
import { Badge } from '@mantine/core';
import { cn } from '@/src/utils/cn';
import { formatDate } from '@/src/utils/format-date';
import Button from '@/src/components/common/input/button';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Image from 'next/image';
import { Badge } from '@mantine/core';
import { formatDate } from '@/src/utils/format-date';
import { GatheringCardProps } from '@/src/types/gathering-data';
import IcoPerson from '@/public/assets/icons/ic-gathering-person.svg';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ClientProvider from '@/src/components/client-provider';
import ScheduledGatheringCard from './container';

const meta: Meta<typeof ScheduledGatheringCard> = {
title: 'Components/ScheduledGatheringCard',
title: 'gathering/scheduled-gathering-card',
component: ScheduledGatheringCard,
parameters: {
layout: 'fullscreen',
Expand Down
6 changes: 2 additions & 4 deletions src/components/common/header/header.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { useState } from 'react';
import type { Meta, StoryFn } from '@storybook/react';
import { QueryClient, QueryClientProvider, useQueryClient } from '@tanstack/react-query';
import { useAuth } from '@/src/hooks/use-auth';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import Header from '@/src/components/common/header/container';

const meta: Meta = {
title: 'Components/Header',
title: 'layout/header',
component: Header,
tags: ['autodocs'],
parameters: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/input/button/button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Meta, StoryFn } from '@storybook/react';
import Button, { ButtonProps } from './index';

const meta: Meta = {
title: 'Components/Button',
title: 'common/button/button',
tags: ['autodocs'],
component: Button,
argTypes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Meta } from '@storybook/react';
import FloatingButton, { FloatingButtonProps } from './floating-btn';

const meta: Meta<typeof FloatingButton> = {
title: 'Components/FloatingButton',
title: 'common/button/floating-button',
component: FloatingButton,
tags: ['autodocs'],
argTypes: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/input/button/like-btn.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
import LikeBtn from './like-btn';

const meta: Meta<typeof LikeBtn> = {
title: 'Components/LikeBtn',
title: 'common/button/like-button',
component: LikeBtn,
tags: ['autodocs'],
argTypes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const mockData = [
];

const meta: Meta = {
title: 'Components/input/calendar-filter',
title: 'common/calendar/calendar-filter',
component: CalendarFilter,
tags: ['autodocs'],
argTypes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Meta, StoryFn } from '@storybook/react';
import DateTimePicker, { DateTimePickerProps } from '.';

const meta: Meta = {
title: 'Components/input/date-time-picker',
title: 'common/calendar/date-time-picker',
component: DateTimePicker,
tags: ['autodocs'],
argTypes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Meta, StoryFn } from '@storybook/react';
import DropDown, { DropDownProps } from '.';

const meta: Meta = {
title: 'Components/input/drop-down',
title: 'common/drop-down',
component: DropDown,
tags: ['autodocs'],
argTypes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryFn } from '@storybook/react';
import FileInput, { FileInputProps } from '.';

const meta: Meta = {
title: 'Components/input/file-input',
title: 'common/image/image-input',
component: FileInput,
tags: ['autodocs'],
argTypes: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChangeEvent, useEffect, useRef, useState } from 'react';
import Image, { StaticImageData } from 'next/image';
import Image from 'next/image';
import IcoPlus from '@/public/assets/icons/ic-plus.svg';
import IcoX from '@/public/assets/icons/ic-x.svg';
import ImgCrewSampleUrls from '@/public/assets/images/crew-sample';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ImgCrewSampleUrls from '@/public/assets/images/crew-sample';
import FileSample, { FileSampleProps } from '.';

const meta: Meta = {
title: 'Components/input/file-sample',
title: 'common/image/image-sample',
component: FileSample,
argTypes: {
image: {
Expand All @@ -26,12 +26,12 @@ const meta: Meta = {
export default meta;

const Template: StoryFn<FileSampleProps> = function FileInputStory(args: FileSampleProps) {
const [selectedFile, setSelectedFile] = useState<string | null>(null);
const [isBlur, setIsBlur] = useState(false);

const handleFileChange = (file: string | null) => {
setSelectedFile(file);
setIsBlur(false); // ํŒŒ์ผ ์„ ํƒ ์‹œ ๋ธ”๋Ÿฌ ํ•ด์ œ
if (file) {
setIsBlur(false); // ํŒŒ์ผ ์„ ํƒ ์‹œ ๋ธ”๋Ÿฌ ํ•ด์ œ
}
};

return (
Expand Down
Loading
Loading