Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat/#102] 공연 정보 입력 뷰 구현 #109

Merged
merged 21 commits into from
Jul 14, 2024
Merged

Conversation

imddoy
Copy link
Contributor

@imddoy imddoy commented Jul 11, 2024

📌 관련 이슈번호

🎟️ PR 유형

어떤 변경 사항이 있나요?

  • 새 기능 추가
  • 버그 수정
  • CSS 등 사용자 UI 디자인 변경
  • 리팩토링

✅ Key Changes

이번 PR에서 작업한 내용을 간략히 설명해주세요

  1. 등록하기 뷰 구현

📢 To Reviewers

  • 워낙 페이지가 길기도 하고.... 컴포넌트 새로 만들것도 많아서.... 어쩌다 보니 길어졌는데 죄송합니다....ㅜㅜ

📸 스크린샷

아 영상 기껏찍었는데 용량크다고 안된다네요...
image
image
image
image
image
아직 준혁오빠 체크 쇽샥못해서 버튼 비활성화 되어있어요

🔗 참고 자료

@github-actions github-actions bot added the ✨ FEAT 기능 구현 label Jul 11, 2024
Copy link

PR 작성하느라 고생 많았어요!! 라벨 잘 지정되었는지 확인 한 번 해 주기 🫶

@imddoy imddoy changed the title Feat/#102/gig register [Feat/#102] 공연 정보 입력 뷰 구현 Jul 12, 2024
Copy link
Contributor

@sinji2102 sinji2102 left a comment

Choose a reason for hiding this comment

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

확인했을 때 큰 문제 없어보여서 일단 어푸하겠습니다,,,

Comment on lines 148 to 153
// const castFilled = gigInfo.castList.every(
// (cast) => cast.castName && cast.castRole && cast.castPhoto
// );
// const staffFilled = gigInfo.staffList.every(
// (staff) => staff.staffName && staff.staffRole && staff.staffPhoto
// );
Copy link
Contributor

Choose a reason for hiding this comment

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

p5) 주석 지워주세욥 ~~ 🫶

Copy link
Contributor Author

Choose a reason for hiding this comment

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

그거 공연진 입력하고 나서 쓰일 것 같아서 일부러 남겨뒀어용...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이제는 지웠어여

Copy link
Contributor

Choose a reason for hiding this comment

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

쪠고!

Comment on lines 157 to 159
// &&
// castFilled &&
// staffFilled
Copy link
Contributor

Choose a reason for hiding this comment

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

p5) 여기두 주석 지워주세욥 ~~ 🫶

Copy link
Contributor Author

Choose a reason for hiding this comment

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

얘두요..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

얘두 이제 지웠어요

Copy link
Contributor

Choose a reason for hiding this comment

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

감삼미당

<S.Divider />

<InputRegisterBox title="유의사항">
<TextArea
Copy link
Contributor

Choose a reason for hiding this comment

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

p4) 현재 figma와 비교했을 때 유의사항 TextArea가 상단이 조금 높은 거 같은데 한 번 확인해 주세요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

헤헤 고쳤어용~

Copy link
Contributor

@ocahs9 ocahs9 left a comment

Choose a reason for hiding this comment

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

채현이 코드 작성 고생했어! 많은 상태들이 엮여 있어서 생각보다 오래 걸리고 힘들었을텐데 적절하게 typing으로 나누면서 잘 작성했네 👍 나도 활용해야 해서 좀 자세히 보긴 했는데, 당장은 아니더라도 보완할 점이 보여서 남겨둘게 !

우선, 스텝 1에서 포스터를 등록해야 "다음"버튼이 활성화하는 것은 좋은데 만약 해당 포스터를 삭제했을 경우, 새롭게 등록하지 않아도 "다음" 버튼이 활성화되어 있더라고.

그리고, 스텝 2에서 아무것도 입력 안해도 "다음" 버튼 활성화되어 있는 것은 좋은데,
아래의 사진처럼 출연진 사진을 올렸다가
image

삭제하면,
image
버튼이 비활성화되더라고. 너무 세세한 부분 같아서 지금을 일단 참고만 하고, 만약 여유있을 때 수정하면 될 거 같아! 아니면 2차 스프린트 때..?

여튼 고생 많았어~~

Comment on lines +93 to +96
const [bankOpen, setBankOpen] = useState(false);
const [bankInfo, setBankInfo] = useState("");
const [isChecked, setIsChecked] = useState(false);
const [isFree, setIsFree] = useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

p5) state가 위의 gigInfo랑 이 4개밖에 존재하지 않는 줄 알고 어떻게 관리했나 봤는데 gigInfo를 객체 상태로 하나로 관리하고, handleEvent.ts 파일의 isAllFieldsFilled 를 통해 한번에 관리하시던데 꽤 좋은 것 같아요 👍

Comment on lines +104 to +114
useEffect(() => {
if (isFree) {
setGigInfo((prev) => ({
...prev,
ticketPrice: "0",
accountNumber: "",
bankName: "",
}));
setBankInfo("");
}
}, [isFree]);
Copy link
Contributor

Choose a reason for hiding this comment

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

p5) isFree는 boolean으로 토글되도록 만들고, 여기서는 따로 ticketPrice : 0 으로 설정해주는 거 좋네요!

Comment on lines +15 to +27
const file = e.target.files?.[0];
if (file) {
setPostImg(file);

const fileReader = new FileReader();
fileReader.onload = function (event) {
const imageUrl = event.target?.result as string;
setPreviewImg(imageUrl);
onImageUpload(imageUrl);
};

fileReader.readAsDataURL(file);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

p5) 사실 이 부분 이해하고 싶어서 좀 찾아봤는데,

FileReader는 파일을 읽기 위한 API를 제공하는 객체, File 은사용자가 파일 입력 필드에서 선택한 파일이나 드래그 앤 드롭을 통해 업로드한 파일 객체 (prop으로 사용하기도 함), readAsDataURL 는 파일을 base64 인코딩된 데이터 URL로 변환하는 코드라고 하더라구요. event.target?.result as string 은 FileReader가 파일을 읽고 나서 결과 데이터를 저장하는 속성에 타입 단언을 하는 코드라는 것도 처음 알아서, 생각보다 이해에 오래 걸렸던 것 같아요!

코드 잘 작성하셨네요 ~! 고생하셨습니다 !

Comment on lines 130 to 154
export const isAllFieldsFilled = (gigInfo: GigInfo, isFree: boolean) => {
const requiredFields = [
"performanceTitle",
"genre",
"runningTime",
"performanceDescription",
"performanceAttentionNote",
"posterImage",
"performanceTeamName",
"performanceVenue",
"performanceContact",
"performancePeriod",
"ticketPrice",
"totalScheduleCount",
];

if (!isFree) {
requiredFields.push("bankName", "accountNumber");
}
const scheduleFilled = gigInfo.scheduleList.every(
(schedule) => schedule.performanceDate && schedule.totalTicketCount && schedule.scheduleNumber
);

return requiredFields.every((field) => gigInfo[field as keyof GigInfo]) && scheduleFilled;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

p5) 이게 너무 좋은 것 같아요! 사실 이 부분 보면서 많이 배웠습니다 .
every() 를 사용해서 전부 해당하는지 확인 후 불리언 값 리턴하는 거.. 👍👍

Copy link
Member

@pepperdad pepperdad left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

Comment on lines 270 to 282
<InputAccountWrapper>
<InputBank bankOpen={bankOpen} onClick={() => handleBankOpen(setBankOpen, isFree)}>
{bankInfo}
</InputBank>
<TextField
name="accountNumber"
value={accountNumber}
onChange={(e) => handleChange(e, setGigInfo)}
filter={numericFilter}
disabled={isFree}
placeholder="입금 받으실 계좌번호를 (-)제외 숫자만 입력해주세요."
/>
</InputAccountWrapper>
Copy link
Member

Choose a reason for hiding this comment

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

p3) 무료 공연일 때, 여기 없어야할 것 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

반영했습니다~

Comment on lines +200 to +211
<TimePickerRegisterBox title="회차별 시간대">
{scheduleList.map((schedule, index) => (
<div key={index}>
<S.InputDescription>{index + 1}회차</S.InputDescription>
<Spacing marginBottom={"1"} />
<TimePicker
value={schedule.performanceDate}
onChangeValue={(date) => handleDateChange(index, date, setGigInfo)}
/>
</div>
))}
</TimePickerRegisterBox>
Copy link
Member

Choose a reason for hiding this comment

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

p3) press 될 때, 파란색으로 변하는데 배포상태에서 확인해야할 것 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정했습니다

genre,
runningTime,
performanceDescription,
bankName,
Copy link
Member

Choose a reason for hiding this comment

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

p5) bankName 얘는 어디서 사용될까요!?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

으익 지웠습니다


interface TimePickerRegisterBoxProps {
title: string;
marginBottom?: number;
Copy link
Member

Choose a reason for hiding this comment

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

p4) 요기 marginBottom number인데 아래에는 string이에용

Copy link
Contributor Author

Choose a reason for hiding this comment

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

저기서 쓴 marginBottom 은 <S.TimePickerRegisterBox $marginBottom={marginBottom}>
여기에 썻고 number인데 <Spacing marginBottom={"1.4"} />이거 말씀하신걸까여...?
이름 다르게 할까요??

];

if (!isFree) {
requiredFields.push("bankName", "accountNumber");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
requiredFields.push("bankName", "accountNumber");
requiredFields = [...requiredFields, "bankName", "accountNumber"];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

새로 배열을 만들기는 코드가 복잡해질 것 같아서

const requiredFields = [
    "performanceTitle",
    "genre",
    "runningTime",
    "performanceDescription",
    "performanceAttentionNote",
    "posterImage",
    "performanceTeamName",
    "performanceVenue",
    "performanceContact",
    "performancePeriod",
    "ticketPrice",
    "totalScheduleCount",
    ...(!isFree ? ["bankName", "accountNumber"] : []),
  ];

이렇게 반영했습니다

Copy link
Member

Choose a reason for hiding this comment

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

p5) 👍

Copy link

@imddoy imddoy merged commit 56796d0 into develop Jul 14, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ FEAT 기능 구현
Projects
Status: 🎉Done
Development

Successfully merging this pull request may close these issues.

[ Feat ] 공연 정보 입력하기 뷰 구현
4 participants