Skip to content

Commit

Permalink
Fix: 충돌 에러 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
suehub committed Jan 16, 2024
2 parents 33a29c1 + fbd20b4 commit aae9215
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 41 deletions.
46 changes: 29 additions & 17 deletions src/@types/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,34 @@ export type subItemRes = {
data: {
tripId: number;
visitDate: string;
tripItems: TripItem[];
transportation: 'CAR' | 'PUBLIC_TRANSPORTATION';
tripItems: {
tripItemId: number;
tourItemId: number;
name: string;
thumbnailUrl: string;
category: string;
seqNum: number;
visitDate: string;
price: number;
}[];
} | null;
};

export type subPath = {
export type Paths = {
fromTripItemId: number;
toTripItemId: number;
fromSeqNum: number;
toSeqNum: number;
fromLongitude: string;
fromLatitude: string;
toLongitude: string;
toLatitude: string;
transportation: string;
pathInfo: {
price: number;
totalDistance: number;
totalTime: number;
}
}

export type TripItem = {
tripItemId: number;
tourItemId: number;
name: string;
thumbnailUrl: string;
category: string;
transportation: string;
seqNum: number;
visitDate: string;
price: number;
};
};

export type subPathRes = {
Expand All @@ -57,14 +56,16 @@ export type subPathRes = {
data: {
tripId: number;
visitDate: string;
transportation: 'CAR' | 'PUBLIC_TRANSPORTATION';
paths: {
fromTripItemId: number;
toTripItemId: number;
fromSeqNum: number;
toSeqNum: number;
fromLongitude: string;
fromLatitude: string;
toLongitude: string;
toLatitude: string;
transportation: string;
pathInfo: {
price: number;
totalDistance: number;
Expand Down Expand Up @@ -110,3 +111,14 @@ export type SocketContextType = {
tripBudget: subBudgetRes | null;
callBackPub: (callback: () => void) => void;
};

export type TripItem = {
tripItemId: number;
tourItemId: number;
name: string;
thumbnailUrl: string;
category: string;
seqNum: number;
visitDate: string;
price: number;
} | null;
5 changes: 2 additions & 3 deletions src/@types/socket.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ type subItemMessage = (response: {
data: {
tripId: number;
visitDate: string;
transportation: 'CAR' | 'PUBLIC_TRANSPORTATION';
tripItems: {
tripItemId: number;
tourItemId: number;
name: string;
thumbnailUrl: string;
category: string;
transportation: string;
seqNum: number;
visitDate: string;
price: number;
Expand All @@ -40,6 +40,7 @@ type subPathMessage = (response: {
data: {
tripId: number;
visitDate: string;
transportation: 'CAR' | 'PUBLIC_TRANSPORTATION';
paths: {
fromTripItemId: number;
toTripItemId: number;
Expand All @@ -49,7 +50,6 @@ type subPathMessage = (response: {
fromLatitude: string;
toLongitude: string;
toLatitude: string;
transportation: 'CAR' | 'PUBLIC_TRANSPORTATION';
pathInfo: {
price: number;
totalDistance: number;
Expand Down Expand Up @@ -120,7 +120,6 @@ interface pubUpdateTripItem {
}

interface pubUpdateTransportation {
tripId: number;
visitDate: string;
transportation: 'CAR' | 'PUBLIC_TRANSPORTATION';
}
Expand Down
6 changes: 3 additions & 3 deletions src/api/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ export const pubUpdateTripItem = (
});
};

// 여행 아이템 방문 교통 수단 변경 이벤트 발생시
// 여행 날짜별 교통 수단 변경 이벤트 발생시 (01/16 업데이트)
export const pubUpdateTransportation = (
pubUpdateTransportation: pubUpdateTransportation,
tripItemId: number,
trips: number,
) => {
socketClient.publish({
destination: `/pub/tripItems/${tripItemId}/updateTransportation`,
destination: `/pub/trips/${trips}/updateTransportation`,
body: JSON.stringify(pubUpdateTransportation),
});
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/MyTrip/MyTripAfterList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const MyTripAfterList: React.FC<MyTripIngListProps> = ({ myTripsData }) => {

return (
<>
<div className="mb-[15px] mt-[30px]">
<h1 className='"text-black text-lg font-bold'>지난 여행</h1>
<div className="mb-[10px] mt-[40px]">
<h1 className="text-xl font-bold text-stone-900">지난 여행</h1>
</div>
<div className="no-scrollbar grid grid-cols-1 gap-[5px] overflow-y-scroll">
{sortedTrips.map((myTripList: MyTripType) => (
Expand Down
4 changes: 2 additions & 2 deletions src/components/MyTrip/MyTripBeforeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const MyTripBeforeList: React.FC<MyTripIngListProps> = ({ myTripsData }) => {

return (
<>
<div className="mb-[15px] mt-[30px]">
<h1 className='"text-black text-lg font-bold'>다가오는 여행</h1>
<div className="mb-[10px] mt-[40px]">
<h1 className="text-xl font-bold text-stone-900">다가오는 여행</h1>
</div>
<div className="no-scrollbar grid grid-cols-1 gap-[5px] overflow-y-scroll">
{myTripsData.map((myTripList: MyTripType) => (
Expand Down
14 changes: 8 additions & 6 deletions src/components/MyTrip/MyTripIngItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,28 @@ const MyTripIngItem: React.FC<MyTripItemProps> = ({ myTripList }) => {

return (
<div
className="relative flex h-16 w-full cursor-pointer items-center rounded-lg border border-solid border-cyan-400 px-3"
className="relative flex h-16 w-full cursor-pointer items-center rounded-2xl border border-solid border-cyan-400 bg-cyan-400 px-3"
onClick={() => navigate(`/trip/${tripId}`)}>
<div className="flex">
<div>
<img
className="rounded-1 h-10 min-h-10 w-10 rounded-lg object-cover"
className="h-10 min-h-10 w-10 rounded-3xl rounded-lg object-cover"
src={tripThumbnailUrl}
alt="여행지 이미지"
/>
</div>
<div className="absolute right-3 top-[20px] inline-flex h-[22px] w-[54px] items-center justify-center gap-[8px] rounded-2xl border border-solid border-cyan-400 bg-cyan-400 px-[8px] py-[10px] pt-[12px]">
<span className="text-xs font-semibold text-white">{tripStatus}</span>
<div className="absolute right-3 top-[20px] inline-flex h-[22px] w-[54px] items-center justify-center gap-[8px] rounded-2xl border border-solid border-cyan-400 bg-white px-[8px] py-[10px] pt-[13px]">
<span className="text-xs font-semibold text-cyan-400">
{tripStatus}
</span>
</div>
<div className="ml-[15px] flex max-w-[300px] flex-col items-start justify-between gap-[15px] ">
<div className="mt-[4px] ">
<div className="w-56 truncate text-sm font-bold text-black ">
<div className="w-56 truncate text-sm font-bold text-white ">
{tripName}
</div>

<div className="text-xs font-medium tracking-tight text-zinc-500">
<div className="text-xs font-semibold text-white">
{startDate.replace(/-/g, '.')} ~{' '}
{endDate.replace(/-/g, '.').split('2024.')} ({tripDuration})
</div>
Expand Down
10 changes: 5 additions & 5 deletions src/components/MyTrip/MyTripItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ const MyTripItem: React.FC<MyTripItemProps> = ({ myTripList }) => {
</div>
<div className="ml-[10px] flex w-full flex-col items-start justify-between ">
<div className="mt-[1px] ">
<div className="truncate text-[15px] text-base font-bold text-black">
<div className="truncate text-[15px] text-base font-semibold text-stone-900">
{tripName}
</div>
<div className="text-sm font-medium tracking-tight text-zinc-500">
{startDate.replace(/-/g, '.')} ~{' '}
<div className="text-sm font-normal text-zinc-500">
{startDate.replace(/-/g, '.')} -{' '}
{endDate.replace(/-/g, '.').split('2024.')} ({tripDuration})
</div>
</div>

<div className="mb-[5px] flex text-xs font-normal text-zinc-500">
<UserIcon size={13} fill="gray4" />
<span className="ml-[4px]">{numberOfPeople}명과 공유중</span>
<UserIcon size={13} fill="#888" color="none" />
<span>{numberOfPeople}명과 공유중</span>
</div>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/components/Plan/PlanItemBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ type PlanItemBoxProps = {
};

const PlanItemBox = ({ item }: PlanItemBoxProps) => {
if (!item) {
return <div>error...</div>;
}

return (
<>
<div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Plan/TripMap.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { subPath } from '@/@types/service';
import { Paths } from '@/@types/service';
import { Map, MapMarker, Polyline, useKakaoLoader } from 'react-kakao-maps-sdk';

const VITE_KAKAO_MAP_API_KEY = import.meta.env.VITE_KAKAO_MAP_API_KEY;

const TripMap = ({ paths }: { paths: subPath[] }) => {
const TripMap = ({ paths }: { paths: Paths[] }) => {
const firstPath = paths[0];
const latitude = firstPath?.fromLatitude;
const longitude = firstPath?.fromLongitude;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/create/createTrip.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const CreateTrip = () => {
queryFn: () => getMemberTrips(),
});

const MY_TRIP_NUMBER = data?.data.numberOfElements + 1;
const MY_TRIP_NUMBER = data?.numberOfElements + 1;
const defaultTitle = `나의 여정 ${MY_TRIP_NUMBER}`;

const handleSubmit = async () => {
Expand Down

0 comments on commit aae9215

Please sign in to comment.