Skip to content

Commit

Permalink
임시 저장
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhello0507 committed Jan 20, 2025
1 parent 0987a3c commit 8b8393d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 23 deletions.
4 changes: 0 additions & 4 deletions src/component/dialog/KakaoMapDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ function KakaoMapDialog(

const ps = new kakao.maps.services.Places();
ps.keywordSearch(searchField.value, (data: any, status: any, pagination: any) => {
console.log(data);
console.log(status);
console.log(pagination);

if (status === kakao.maps.services.Status.OK) {

Expand Down Expand Up @@ -88,7 +85,6 @@ function KakaoMapDialog(
<p style="margin: 5px 0; font-size: 14px; color: #555;"><strong>경도:</strong> ${latLng.getLng().toFixed(6)}</p>
<a href="https://map.kakao.com/link/to/${address},${latLng.getLat()},${latLng.getLng()}" target="_blank" style="display: inline-block; margin-top: 10px; padding: 5px 10px; background: #007bff; color: #fff; text-decoration: none; border-radius: 5px;">길찾기</a>
</div>`;
console.log(selectedPlaceOverlay)
if (selectedPlaceOverlay) {
selectedPlaceOverlay.setContent(content);
selectedPlaceOverlay.setPosition(latLng);
Expand Down
4 changes: 2 additions & 2 deletions src/component/template/component/GalleryTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ function GallerySlide(
- (slideStyle === 'style1' ? (34 * 2) : 0)
+ (slideStyle === 'style1' ? 8 : 0); // 이미지 너비 - 간격
const index = Math.floor(scrollPosition / imageWidth);
console.log(`${scrollPosition}, ${imageWidth}`);
console.log(index);
// console.log(`${scrollPosition}, ${imageWidth}`);
// console.log(index);
setCurrentImageIndex(index); // 현재 스크롤된 이미지 인덱스를 상태에 저장
};

Expand Down
58 changes: 43 additions & 15 deletions src/page/invitation/design/InvitationDesign.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,40 @@ function InvitationDesign() {
(async () => {
try {
const {data} = await weddingApi.getWedding(url);
setWedding(data);
setMode('edit');
loadTemp(data);
} catch (error) {
console.error(error);
setMode('create');
}
})();
}, []);

const loadTemp = (alt: WeddingDto) => {
const temp = localStorage.getItem(`temp_Design_${url}`);
localStorage.removeItem(`temp_Design_${url}`);
if (temp === null) {
setWedding(alt);
return;
}

const isLoad = window.confirm('임시 저장된 디자인이 있습니다. 불러오시겠습니까?');
if (!isLoad) {
setWedding(alt);
return;
}

const wedding: WeddingDto = JSON.parse(temp);
console.log(wedding);
setWedding(wedding);
}

const onChangeWedding = (wedding: WeddingDto) => {
console.log(`야호 ${JSON.stringify(wedding, undefined, 2)}`)
localStorage.setItem(`temp_Design_${url}`, JSON.stringify(wedding));
setWedding(wedding);
}

const saveDesign = async () => {
// TODO: Validation
switch (mode) {
Expand Down Expand Up @@ -159,19 +184,19 @@ function InvitationDesign() {
case OptionType.Template:
children = <TemplateOption
template={wedding.template}
onChange={template => setWedding({...wedding, template})}
onChange={template => onChangeWedding({...wedding, template})}
/>;
break;
case OptionType.BaseInfo:
children = <BaseInfoOption
baseInfo={wedding.baseInfo}
onChange={baseInfo => setWedding({...wedding, baseInfo})}
onChange={baseInfo => onChangeWedding({...wedding, baseInfo})}
/>;
break;
case OptionType.WeddingSchedule:
children = <WeddingScheduleOption
weddingSchedule={wedding.weddingSchedule}
onChange={weddingSchedule => setWedding({
onChange={weddingSchedule => onChangeWedding({
...wedding,
weddingSchedule
})}
Expand All @@ -180,7 +205,7 @@ function InvitationDesign() {
case OptionType.WeddingLocation:
children = <WeddingPlaceOption
weddingPlace={wedding.weddingPlace}
onChange={weddingPlace => setWedding({
onChange={weddingPlace => onChangeWedding({
...wedding,
weddingPlace
})}
Expand All @@ -189,13 +214,13 @@ function InvitationDesign() {
case OptionType.Greeting:
children = <GreetingOption
greeting={wedding.greeting}
onChange={greeting => setWedding({...wedding, greeting})}
onChange={greeting => onChangeWedding({...wedding, greeting})}
/>;
break;
case OptionType.GuestComment:
children = <GuestCommentOption
guestComment={wedding.guestComment}
onChange={guestComment => setWedding({
onChange={guestComment => onChangeWedding({
...wedding,
guestComment
})}
Expand All @@ -204,48 +229,51 @@ function InvitationDesign() {
case OptionType.BaseMusic:
children = <BaseMusicOption
baseMusic={wedding.baseMusic}
onChange={baseMusic => setWedding({...wedding, baseMusic})}
onChange={baseMusic => onChangeWedding({...wedding, baseMusic})}
/>;
break;
case OptionType.LinkShare:
children = <LinkShareOption
linkShare={wedding.linkShare}
onChange={linkShare => setWedding({...wedding, linkShare})}
onChange={linkShare => onChangeWedding({...wedding, linkShare})}
/>;
break;
case OptionType.MoneyInfo:
children = <MoneyInfoOption
moneyInfo={wedding.moneyInfo}
onChange={moneyInfo => setWedding({...wedding, moneyInfo})}
onChange={moneyInfo => onChangeWedding({...wedding, moneyInfo})}
/>;
break;
case OptionType.Video:
children = <VideoOption
video={wedding.video}
onChange={video => setWedding({...wedding, video})}
onChange={video => onChangeWedding({...wedding, video})}
/>;
break;
case OptionType.Phone:
children = <PhoneOption
phone={wedding.phone}
onChange={phone => setWedding({...wedding, phone})}
onChange={phone => onChangeWedding({...wedding, phone})}
/>;
break;
case OptionType.Rsvp:
children = <RsvpOption
rsvp={wedding.rsvp}
onChange={rsvp => setWedding({...wedding, rsvp})}
onChange={rsvp => onChangeWedding({...wedding, rsvp})}
/>;
break;
case OptionType.Gallery:
children = <GalleryOption
imgList={wedding.imgList}
imgDesign={wedding.imgDesign}
onChangeImgDesign={imgDesign => setWedding({
onChangeImgDesign={imgDesign => onChangeWedding({
...wedding,
imgDesign
})}
onChangeImgList={imgList => setWedding({...wedding, imgList})}
onChangeImgList={imgList => onChangeWedding({
...wedding,
imgList
})}
/>
break;
}
Expand Down
2 changes: 0 additions & 2 deletions src/page/notification/NotificationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ function NotificationPage() {
} catch (error) {
}
})();
console.log(Cookies.get('accessToken'))
console.log(Cookies.get('refreshToken'))
}, []);

return (
Expand Down

0 comments on commit 8b8393d

Please sign in to comment.