Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
5cc6746
๐Ÿ› Fix: ๋“œ๋กญ๋‹ค์šด ๊ฐ’ ์„ ํƒ์‹œ ํฌ์ปค์Šค ์•„์›ƒ ๋˜๋„๋ก ์ˆ˜์ •
yulrang Nov 8, 2024
f1fe204
๐Ÿ› Fix: ํ…์ŠคํŠธ ์ˆ˜์ •(์•ฝ์† ์žก๊ธฐ > ์•ฝ์† ๋งŒ๋“ค๊ธฐ)
yulrang Nov 8, 2024
af9fb91
๐Ÿ› Fix: ํฌ๋ฃจ ์ƒ์„ฑ์‹œ ๋””ํ…Œ์ผ ํŽ˜์ด์ง€๋กœ ์ด๋™, ๋ฆฌํŒฉํ† ๋ง
yulrang Nov 8, 2024
80f8554
๐Ÿ› Fix: ์—๋Ÿฌ์ƒํƒœ์ธ๋ฐ ์ƒˆ๋กœ ๊ฐ’ ์ฑ„์šธ ๋•Œ ์—๋Ÿฌ ํ•ด์ œํ•˜๊ธฐ, ๋ฆฌํŒฉํ† ๋ง
yulrang Nov 8, 2024
63a8e1c
๐Ÿ› Fix: ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ ๋‚ ์งœ ์„ ํƒ ์˜ค๋ฅ˜ ์ˆ˜์ •
yulrang Nov 8, 2024
9657201
๐Ÿ› Fix: ์Šคํฌ๋กค๋ฐ” ๋‘๊ฐœ๋กœ ๋ณด์ด๋Š” ๋ฌธ์ œ ์ˆ˜์ •
yulrang Nov 8, 2024
43cdfa7
๐Ÿšจ Fix: ๋ฆฐํŠธ ์˜ค๋ฅ˜ ์ œ๊ฑฐ
yulrang Nov 8, 2024
0683f5a
๐Ÿ› Fix: ๋ฒ„ํŠผ ๋งํฌ๋กœ ๊ต์ฒด
yulrang Nov 8, 2024
c408058
๐Ÿ› Fix: isToday ํ•จ์ˆ˜ ๊ฐœ์„ , ๋ฐ์ดํ„ฐ ํ•œ๊ตญ์‹œ๊ฐ„ ๊ธฐ์ค€์œผ๋กœ ๋ณ€๊ฒฝ
yulrang Nov 9, 2024
f101987
๐Ÿ› Fix: ํผ ๋™์ž‘ ๊ฐœ์„ 
yulrang Nov 9, 2024
7b68352
๐Ÿ› Fix: ์ด์ „๋‚ ์งœ ์„ ํƒ ๋ฐฉ์ง€, isToday ๋‚ ์งœ ๋น„๊ต ์ˆ˜์ •
yulrang Nov 9, 2024
51cfe2f
๐Ÿ› Fix: MockData ๋‚ ์งœ ํ˜•์‹ ์ˆ˜์ •
yulrang Nov 9, 2024
80d21ef
๐Ÿ› Fix: ์ด๋ฏธ์ง€ ํŒŒ์ผ ํ˜•์‹ ์ œํ•œ, ํฌ๊ธฐ ์ œํ•œ
yulrang Nov 11, 2024
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
505 changes: 415 additions & 90 deletions mock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const nextConfig = {
{
key: 'Access-Control-Allow-Origin',
value:
process.env.NEXT_PUBLIC_API_URL || 'https://foggy-sideways-saltasaurus.glitch.me/',
process.env.NEXT_PUBLIC_API_BASE_URL || 'https://foggy-sideways-saltasaurus.glitch.me/',

},
{ key: 'Access-Control-Allow-Methods', value: 'GET,OPTIONS,PATCH,DELETE,POST,PUT' },
Expand Down
40 changes: 32 additions & 8 deletions src/app/(crew)/crew/_components/create-crew-form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export default function CreateCrewForm({
control,
handleSubmit,
setValue,
getValues,
trigger,
clearErrors,
formState: { errors, isValid },
formState: { errors, isValid, isSubmitting },
} = useForm<CreateCrewRequestTypes>({
defaultValues: data,
mode: 'onBlur',
Expand Down Expand Up @@ -89,6 +89,10 @@ export default function CreateCrewForm({
{...field}
id="crew-title"
variant="filled"
onChange={(e) => {
field.onChange(e);
if (errors.title) trigger('title'); // ์ž…๋ ฅ ์ค‘์ผ ๋•Œ ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ ํŠธ๋ฆฌ๊ฑฐ
}}
error={errors.title?.message}
placeholder="ํฌ๋ฃจ๋ช…์„ 20์ž ์ด๋‚ด๋กœ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."
maxLength={20}
Expand Down Expand Up @@ -125,6 +129,7 @@ export default function CreateCrewForm({
field.onChange(value);
handleMainCategoryChange(value);
}}
error={errors.mainCategory?.message}
/>
)}
/>
Expand All @@ -139,11 +144,11 @@ export default function CreateCrewForm({
placeholder="์„ธ๋ถ€ ์นดํ…Œ๊ณ ๋ฆฌ"
data={categoryData[categoryIndex]?.items || []}
className="flex-1"
error={errors.subCategory?.message}
/>
)}
/>
</div>
{errors.mainCategory && <p className="text-red-500">{errors.mainCategory.message}</p>}
</div>

<div className="flex flex-col gap-3">
Expand All @@ -153,12 +158,29 @@ export default function CreateCrewForm({
<Controller
name="imageUrl"
control={control}
rules={{ required: '์ด๋ฏธ์ง€๋ฅผ ์„ ํƒํ•ด์ฃผ์„ธ์š”.' }}
rules={{
required: '์ด๋ฏธ์ง€๋ฅผ ์„ ํƒํ•ด์ฃผ์„ธ์š”.',
validate: {
fileSize: (file) =>
file && file instanceof File && file.size <= 5242880
? true
: 'ํŒŒ์ผ ํฌ๊ธฐ๋Š” 5MB ์ดํ•˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค.',
fileType: (file) =>
file &&
file instanceof File &&
['image/jpeg', 'image/jpg', 'image/png'].includes(file.type)
? true
: 'JPG, PNG ํŒŒ์ผ๋งŒ ์—…๋กœ๋“œ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.',
},
}}
render={({ field }) => (
<FileInputWrap
{...field}
sample={ImgCrewSamples}
onChange={(newValue) => field.onChange(newValue)}
onChange={(newValue) => {
field.onChange(newValue);
if (newValue instanceof File) trigger('imageUrl');
}}
/>
)}
/>
Expand Down Expand Up @@ -189,12 +211,14 @@ export default function CreateCrewForm({
field.onChange(value);
handleMainLocationChange(value);
}}
error={errors.mainLocation?.message}
/>
)}
/>
<Controller
name="subLocation"
control={control}
rules={{ required: '์‹œ/๊ตฐ/๊ตฌ๋ฅผ ์„ ํƒํ•ด์ฃผ์„ธ์š”.' }}
Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

์—๋Ÿฌ ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ ๋ฐฉ์‹์˜ ์ผ๊ด€์„ฑ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ ์œ„์น˜ ๊ด€๋ จ ํ•„๋“œ๋“ค์˜ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ ๋ฐฉ์‹์ด ์ผ๊ด€์ ์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค:

  • mainLocation์€ ํ•˜๋‹จ์— ๋ณ„๋„๋กœ ํ‘œ์‹œ
  • subLocation์€ ๋“œ๋กญ๋‹ค์šด ๋‚ด๋ถ€์— ํ‘œ์‹œ

๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ†ต์ผ๋œ ๋ฐฉ์‹์œผ๋กœ ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

-          {errors.mainLocation && <p className="text-red-500">{errors.mainLocation.message}</p>}
+          <div className="flex flex-col gap-1">
+            {errors.mainLocation && <p className="text-red-500 text-sm">{errors.mainLocation.message}</p>}
+            {errors.subLocation && <p className="text-red-500 text-sm">{errors.subLocation.message}</p>}
+          </div>

Also applies to: 219-219

render={({ field }) => (
<DropDown
{...field}
Expand All @@ -203,11 +227,11 @@ export default function CreateCrewForm({
placeholder="์‹œ/๊ตฐ/๊ตฌ"
data={regionData[regionIndex]?.areas || []}
className="flex-1"
error={errors.subLocation?.message}
/>
)}
/>
</div>
{errors.mainLocation && <p className="text-red-500">{errors.mainLocation.message}</p>}
</div>

<div className="flex flex-col gap-3">
Expand All @@ -230,6 +254,7 @@ export default function CreateCrewForm({
variant="filled"
min={4}
max={20}
error={errors.totalCount?.message}
classNames={{
input:
'h-11 py-2.5 px-4 bg-gray-100 placeholder:text-gray-400 font-pretendard text-base font-medium rounded-xl',
Expand All @@ -238,13 +263,12 @@ export default function CreateCrewForm({
/>
)}
/>
{errors.totalCount && <p className="text-red-500">{errors.totalCount.message}</p>}
</div>

<div className="flex justify-between gap-4 pt-18">
<Button
type="submit"
disabled={!isValid}
disabled={!isValid || isSubmitting}
className="btn-filled h-11 flex-1 text-base font-medium disabled:bg-gray-200"
>
{isEdit ? '์ˆ˜์ •' : 'ํ™•์ธ'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const initialValue: CreateGatheringRequestType = {
introduce: '',
dateTime: '',
location: '',
totalCount: 0,
totalCount: 2,
imageUrl: null,
};

Expand Down Expand Up @@ -41,7 +41,7 @@ const Template: StoryFn<CreateGatheringRequestType> = function CreateCrewPageSto
opened={createModalOpened}
onClose={closeCreateModal}
centered
title="์•ฝ์† ์žก๊ธฐ"
title="์•ฝ์† ๋งŒ๋“ค๊ธฐ"
styles={{
root: { '--modal-size': '520px' },
content: { boxShadow: '0 25px 50px -12px rgba(0,0,0,0.1)', borderRadius: '12px' },
Expand Down
Loading