Skip to content

Commit

Permalink
Merge pull request TEAM-BEAT#456 from TEAM-BEAT/feat/TEAM-BEAT#455/Mo…
Browse files Browse the repository at this point in the history
…difyGig

[Feat/TEAM-BEAT#455] 공연 등록, 수정 변경사항 반영
  • Loading branch information
imddoy authored Dec 9, 2024
2 parents 1306e19 + 7ada53d commit c37fa02
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/pages/gig/components/peopleCard/PeopleCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface PeopleCardProps {
const PeopleCard = ({ photo, role, name }: PeopleCardProps) => {
return (
<S.PeopleCardContainer>
<S.PeopleCardPhoto src={photo} />
{photo && <S.PeopleCardPhoto src={photo} />}
<S.PeopleCardTextBox>
<S.PeopleCardRole>{role}</S.PeopleCardRole>
<S.PeopleCardName>{name}</S.PeopleCardName>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/modifyManage/ModifyMaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ const ModifyManageMaker = ({

useEffect(() => {
const allCastFieldsFilled = castModifyRequests.every(
(cast) => cast.castName && cast.castRole && cast.castPhoto
(cast) => cast.castName && cast.castRole
);

const allStaffFieldsFilled = staffModifyRequests.every(
(staff) => staff.staffName && staff.staffRole && staff.staffPhoto
(staff) => staff.staffName && staff.staffRole
);

setIsButtonDisabled(
Expand Down
27 changes: 18 additions & 9 deletions src/pages/modifyManage/ModifyManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,16 @@ const ModifyManage = () => {
const extractUrls = (data: PresignedResponse) => {
//앞부분(유효한 부분)만 떼어내서 저장(뒷 부분은 사진이 뜨는 url이 아님)
posterUrls = Object.values(data.poster).map((url) => url.split("?")[0]);
castUrls = Object.values(data.cast).map((url) => url.split("?")[0]);
staffUrls = Object.values(data.staff).map((url) => url.split("?")[0]);
castUrls = Object.values(data.cast).map((url) => (url !== "" ? url.split("?")[0] : null));
staffUrls = Object.values(data.staff).map((url) => (url !== "" ? url.split("?")[0] : null));
performanceUrls = Object.values(data.performance).map((url) => url.split("?")[0]);

return [...posterUrls, ...castUrls, ...staffUrls, ...performanceUrls];
return [
...posterUrls,
...castUrls.filter((url) => url !== null),
...staffUrls.filter((url) => url !== null),
...performanceUrls,
];
};

//배열 형태로 추출된 모든 presignedUrls
Expand All @@ -346,8 +351,12 @@ const ModifyManage = () => {
//기존에 갖고 있던 이미지들의 주소들 -> files
const files = [
dataState.posterImage,
...dataState.castModifyRequests.map((cast) => cast.castPhoto),
...dataState.staffModifyRequests.map((staff) => staff.staffPhoto),
...dataState.castModifyRequests
.map((cast) => cast.castPhoto)
.filter((photo) => photo !== ""),
...dataState.staffModifyRequests
.map((staff) => staff.staffPhoto)
.filter((photo) => photo !== ""),
...dataState.performanceImageModifyRequests.map((obj) => obj.performanceImage),
];

Expand Down Expand Up @@ -400,7 +409,7 @@ const ModifyManage = () => {
castModifyRequests: dataState.castModifyRequests.map((cast, index) => {
const modifiedCast = {
...cast,
castPhoto: castUrls[index] || cast.castPhoto,
castPhoto: cast.castPhoto === "" ? "" : castUrls[index] || cast.castPhoto,
};
if (modifiedCast.castId === -1) {
delete modifiedCast.castId; // castId가 -1인 경우 castId를 삭제(새롭게 추가된 경우에는 id 안보내야 함)
Expand All @@ -410,7 +419,7 @@ const ModifyManage = () => {
staffModifyRequests: dataState.staffModifyRequests.map((staff, index) => {
const modifiedStaff = {
...staff,
staffPhoto: staffUrls[index] || staff.staffPhoto,
staffPhoto: staff.staffPhoto === "" ? "" : staffUrls[index] || staff.staffPhoto,
};
if (modifiedStaff.staffId === -1) {
delete modifiedStaff.staffId; // staffId가 -1인 경우 staffId를 삭제(새롭게 추가된 경우에는 id 안보내야 함)
Expand Down Expand Up @@ -661,7 +670,7 @@ const ModifyManage = () => {
value={dataState.performanceDescription}
onChange={(e) => handleInputChange("performanceDescription", e.target.value)}
placeholder="공연을 예매할 예매자들에게 공연을 소개해주세요."
maxLength={500}
maxLength={1500}
/>
</InputModifyManageBox>
<S.Divider />
Expand Down Expand Up @@ -747,7 +756,7 @@ const ModifyManage = () => {
value={dataState.performanceAttentionNote}
onChange={(e) => handleInputChange("performanceAttentionNote", e.target.value)}
placeholder="입장 안내, 공연 중 인터미션, 공연장 반입금지 물품, 촬영 가능 여부, 주차 안내 등 예매자들이 꼭 알고 있어야할 유의사항을 입력해주세요."
maxLength={250}
maxLength={1500}
/>
</InputModifyManageBox>
<S.Divider />
Expand Down
23 changes: 14 additions & 9 deletions src/pages/register/Register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,23 @@ const Register = () => {
if (isSuccess) {
const extractUrls = (data: PresignedResponse) => {
posterUrls = Object.values(data.poster).map((url) => url.split("?")[0]);
castUrls = Object.values(data.cast).map((url) => url.split("?")[0]);
staffUrls = Object.values(data.staff).map((url) => url.split("?")[0]);
castUrls = Object.values(data.cast).map((url) => (url !== "" ? url.split("?")[0] : null));
staffUrls = Object.values(data.staff).map((url) => (url !== "" ? url.split("?")[0] : null));
performanceUrls = Object.values(data.performance).map((url) => url.split("?")[0]);

return [...posterUrls, ...castUrls, ...staffUrls, ...performanceUrls];
return [
...posterUrls,
...castUrls.filter((url) => url !== null),
...staffUrls.filter((url) => url !== null),
...performanceUrls,
];
};
const S3Urls = extractUrls(data);

const files = [
gigInfo.posterImage,
...gigInfo.castList.map((cast) => cast.castPhoto),
...gigInfo.staffList.map((staff) => staff.staffPhoto),
...gigInfo.castList.map((cast) => cast.castPhoto).filter((photo) => photo !== ""),
...gigInfo.staffList.map((staff) => staff.staffPhoto).filter((photo) => photo !== ""),
...gigInfo.performanceImageList.map((image) => image.performanceImage),
];

Expand All @@ -228,11 +233,11 @@ const Register = () => {
posterImage: posterUrls[0],
castList: gigInfo.castList.map((cast, index) => ({
...cast,
castPhoto: castUrls[index] || cast.castPhoto,
castPhoto: cast.castPhoto === "" ? "" : castUrls[index] || cast.castPhoto,
})),
staffList: gigInfo.staffList.map((staff, index) => ({
...staff,
staffPhoto: staffUrls[index] || staff.staffPhoto,
staffPhoto: staff.staffPhoto === "" ? "" : staffUrls[index] || staff.staffPhoto,
})),
scheduleList: gigInfo.scheduleList.map((schedule) => {
const date = dayjs(schedule.performanceDate).toDate();
Expand Down Expand Up @@ -448,7 +453,7 @@ const Register = () => {
value={performanceDescription}
onChange={(e) => handleChange(e, setGigInfo)}
placeholder="공연을 예매할 예매자들에게 공연을 소개해주세요."
maxLength={500}
maxLength={1500}
/>
</InputRegisterBox>
<S.Divider />
Expand Down Expand Up @@ -512,7 +517,7 @@ const Register = () => {
value={performanceAttentionNote}
onChange={(e) => handleChange(e, setGigInfo)}
placeholder="입장 안내, 공연 중 인터미션, 공연장 반입금지 물품, 촬영 가능 여부, 주차 안내 등 예매자들이 꼭 알고 있어야할 유의사항을 입력해주세요."
maxLength={500}
maxLength={1500}
/>
</InputRegisterBox>
<S.Divider />
Expand Down
8 changes: 2 additions & 6 deletions src/pages/register/RegisterMaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@ const RegisterMaker = ({
const [isButtonDisabled, setIsButtonDisabled] = useState(true);

useEffect(() => {
const allCastFieldsFilled = castList.every(
(cast) => cast.castName && cast.castRole && cast.castPhoto
);
const allCastFieldsFilled = castList.every((cast) => cast.castName && cast.castRole);

const allStaffFieldsFilled = staffList.every(
(staff) => staff.staffName && staff.staffRole && staff.staffPhoto
);
const allStaffFieldsFilled = staffList.every((staff) => staff.staffName && staff.staffRole);

setIsButtonDisabled(
!(
Expand Down

0 comments on commit c37fa02

Please sign in to comment.