Skip to content

Commit

Permalink
Merge pull request #211 from hyeonjuuu/ts/mypage
Browse files Browse the repository at this point in the history
  • Loading branch information
uniS2 authored Jan 12, 2024
2 parents 2ee9ad2 + ca0dda8 commit cc2a921
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 20 deletions.
5 changes: 4 additions & 1 deletion src/components/TripCalendar/TripCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import '@/styles/calendar.css';
import { DateStore } from '@/store/dateStore';
import { getTripDateKo } from '@/utils';

export default function TripCalendar() {
function TripCalendar() {
const { tripDate, setDate } = DateStore();

console.log(tripDate);

return (
<>
<Calendar
Expand Down Expand Up @@ -57,3 +59,4 @@ export default function TripCalendar() {
</>
);
}
export default TripCalendar;
3 changes: 2 additions & 1 deletion src/components/TripEdit/SelectHotelMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';

const { kakao } = window;

export default function SelectHotelMap({
function SelectHotelMap({
hotelList,
placeList,
width = 'w-full',
Expand Down Expand Up @@ -67,3 +67,4 @@ export default function SelectHotelMap({

return <div id="map" style={{ width: '100%', height: '400px' }}></div>;
}
export default SelectHotelMap;
8 changes: 6 additions & 2 deletions src/pages/MyPage/BookmarkPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import MyPageTab from '@/components/MyPage/MyPageTab';
import BookmarkList from '@/components/MyPage/BookmarkList';
import Profile from '@/components/MyPage/Profile';
import MyPageHeader from '@/components/PageHeader';
import { ItemType, getPocketHostImageURL } from '@/utils';
import {
ItemType,
getPocketHostImageURL,
getPocketHostProfileURL,
} from '@/utils';
import pocketbase from '@/api/pocketbase';
import MyPageTabInfo from '@/components/MyPage/MyPageTabInfo';
import { Helmet } from 'react-helmet-async';
Expand All @@ -25,7 +29,7 @@ function BookmarkPage() {
</span>
{user.profile ? (
<img
src={getPocketHostImageURL(user)}
src={getPocketHostProfileURL(user)}
alt={`${user.username}의 프로필`}
className="h-[4.375rem] w-[4.375rem] rounded-full border-[0.0938rem] border-contentsSecondary"
/>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/TripCalendarPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ export default function TripCalendarPage() {
question={'언제 떠나시나요?'}
guide={'여행 일자를 선택하세요.'}
/>
{/* <TripCalendar /> */}
<TripCalendar />
{Array.isArray(tripDate) ? (
<Link to={`/tripedit/${data.id}`}>
{/* <ButtonLarge
<ButtonLarge
onClick={() => updateMyScheduleTitle(data.id, tripDate)}
>
선택 완료
</ButtonLarge> */}
</ButtonLarge>
</Link>
) : (
<ButtonLarge>선택 완료</ButtonLarge>
Expand Down
9 changes: 6 additions & 3 deletions src/pages/TripEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ const fetchMySchedule = async (userId: string) => {
});
return response[0];
};
/* const getRecommends = async (userId: string) => {
const getRecommends = async (userId: string) => {
return await pocketbase.collection('recommends').getFullList();
}; */
};

/* -------------------------------------------------------------------------- */

Expand Down Expand Up @@ -64,6 +64,8 @@ function TripEditPage() {
} = ScheduleStore();
const hotelList: any = Object.values(hotelPositions); //$ ListData 추후 지정
const placeList: any = Object.values(placePositions); //$ ListData 추후 지정
console.log(placeList);

// const removeSchedule = TripScheduleStore((state) => state.reset);
const id = useId();

Expand Down Expand Up @@ -146,7 +148,8 @@ function TripEditPage() {
</div>
))}

<div className={toggleSchedule ? 'pt-0' : 'py-10'}>
{/* <div className={toggleSchedule ? 'pt-0' : 'py-10'}> */}
<div>
<ButtonMedium menu="저장" fill={true} text="저장" />
<ButtonMedium
menu="저장"
Expand Down
5 changes: 3 additions & 2 deletions src/store/scheduleStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ type Position = {
};

type ScheduleState = {
placePositions: Position[][];
hotelPositions: Position[][];
// placePositions: Position[][];
placePositions: any;
hotelPositions: any;
resetHotelPositions: () => void;
resetPlacePositions: () => void;
addPlacePositions: (placePosition: Position, index: number) => void;
Expand Down
28 changes: 20 additions & 8 deletions src/utils/getTripDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,29 @@ export function getTripDate(date: string) {
}

export function getTripDateKo(dates: Date) {
const month = dates.getMonth() + 1;
const date = dates.getDate();
const day = dayText[dates.getDay()];
const month = dates?.getMonth() + 1;
const date = dates?.getDate();
const day = dayText[dates?.getDay()];
return `${month}${date}${day}`;
}

export function getTripDateUTC(dates: Date) {
let dateUTC = new Date(
`${String(dates).slice(0, 15)} 12:00:00`
).toISOString();
return `${dateUTC.slice(0, 10)} 12:00:00.123Z`;
// export function getTripDateUTC(dates: Date) {
// let dateUTC = new Date(
// `${String(dates).slice(0, 15)} 12:00:00`
// ).toISOString();
// return `${dateUTC.slice(0, 10)} 12:00:00.123Z`;
// }

export function getTripDateUTC(dates: Date | undefined) {
// 1. 날짜가 유효한지 확인
if (!dates || isNaN(dates.getTime())) {
// 유효하지 않은 경우 에러 처리 또는 기본 값 반환
return '1970-01-01T00:00:00.123Z';
}

// 2. 표준 포맷 사용
const dateUTC = new Date(dates).toISOString();
return dateUTC;
}

export function getTripDateDot(dates: Date) {
Expand Down

0 comments on commit cc2a921

Please sign in to comment.