Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/api/Myplace/myPlace.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface SavedPlaceItem {
placeName: string;
likeCount: number;
themeName: string;
regionName: string;
savedAt: string;
}
export interface SavedPlacePage {
Expand All @@ -54,9 +55,9 @@ export async function savePlace(payload: SavePlaceRequest): Promise<SaveToggleRe
//저장 OFF
export async function unsavePlace(payload: {
contentId: string;
regionName?: string;
regionName: string;
themeName?: string;
cnctrLevel?: number;
cnctrLevel: number;
}) {
const res = await api.delete<SaveToggleResponse>('/my/places/save', {
data: payload,
Expand Down
36 changes: 15 additions & 21 deletions src/component/common/Card/PlaceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,36 @@ export default function PlaceCard({
onClick,
}: PlaceCardProps) {
const showCount = typeof quietLevel === 'number' && quietLevel !== -1;

return (
<div
className="bg-yellow2 flex h-19 w-full max-w-[430px] cursor-pointer items-start rounded-[10px] px-3 py-2 transition-all hover:scale-[1.01] hover:shadow-md active:scale-95"
onClick={onClick}
className="bg-yellow2 flex h-19 w-full max-w-[430px] cursor-pointer items-stretch overflow-hidden rounded-[10px] px-3 py-2 transition-all hover:scale-[1.01] hover:shadow-md active:scale-95"
>
{/*썸네일*/}
<div className="bg-gray1 flex aspect-square w-15 flex-shrink-0 items-center justify-center overflow-hidden rounded-[5px]">
<div className="bg-gray1 relative h-full w-15 shrink-0 overflow-hidden rounded-[5px]">
{imgUrl ? (
<img src={imgUrl} className="h-full w-full object-cover" />
) : (
<ImageIcon className="h-8 w-8" />
<div className="flex h-full w-full items-center justify-center">
<ImageIcon className="h-8 w-8" />
</div>
)}
</div>

{/*텍스트*/}
<div className="ml-4 flex w-full min-w-0 flex-col">
<div className="flex items-start justify-between gap-2">
<p className="text-caption4 max-w-[20ch] truncate">{title}</p>
</div>

{/*뱃지 2개*/}
<div className="mt-4.5 flex shrink-0 gap-4 pr-12">
<Badge
type="default"
color="green"
{...(showCount ? { count: quietLevel } : {})} // -1이면 count prop 자체를 전달하지 않음
>
<div className="ml-4 flex min-w-0 flex-1 flex-col">
<p className="text-caption4 line-clamp-2 min-h-[40px] leading-5">{title}</p>
<div className="flex min-w-0 shrink-0 flex-nowrap gap-2 overflow-hidden pr-10">
<Badge type="default" color="green" {...(showCount ? { count: quietLevel } : {})}>
{showCount ? '한적함' : '정보없음'}
</Badge>

<Badge type="default" color="red">
{theme}
<span className="block max-w-[16ch] truncate">{theme}</span>
</Badge>
</div>
</div>

<div className="flex flex-col items-end justify-between gap-2">
<div className="flex h-full flex-col items-end justify-between">
{showRemoveButton ? (
<button
onClick={(e) => {
Expand All @@ -75,8 +69,8 @@ export default function PlaceCard({
) : (
<div className="h-4 w-3" />
)}
{/*좋아요 수*/}
<div className="text-caption5 mt-5 ml-5 flex items-center justify-center gap-[3px]">

<div className="text-caption5 flex items-center gap-[3px]">
<HeartFillIcon className="h-3 w-3" />
<span className="w-[3ch] leading-none whitespace-nowrap tabular-nums">
{likeCount > 99 ? '99+' : likeCount}
Expand Down
6 changes: 0 additions & 6 deletions src/constants/MyTravel.tsx

This file was deleted.

3 changes: 1 addition & 2 deletions src/pages/home/Homepage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function HomePage() {
내가 원하는 조용한 여행지,
<br /> 이제 손쉽게 찾을 수 있어요.
</div>
<Button variant="sm" className="mt-5" onClick={() => navigate('/explore/Filter')}>
<Button variant="sm" className="mt-5" onClick={() => navigate('/search')}>
바로가기
</Button>
</div>
Expand Down Expand Up @@ -77,7 +77,6 @@ export default function HomePage() {
</div>
</div>
<Footer />
{/*Todo: 추후 홈 메인 내용 확정 되면 구현....*/}
</div>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/home/MyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default function MyPage() {
)}
</div>

<div className="text-green1 mt-6 flex flex-col gap-6 px-8">
<div className="text-green1 mt-6 flex flex-1 flex-col gap-6 px-8">
<div>
<label htmlFor="email" className="text-title4 text-green1 mb-1 block">
이메일
Expand Down Expand Up @@ -219,7 +219,7 @@ export default function MyPage() {
{saveMsg && <p className="text-caption2 text-green-muted mt-2">{saveMsg}</p>}
</div>
{/*회원 탈퇴*/}
<div className="mt-40 px-6 pb-24">
<div className="mt-auto px-6 pb-10">
<div className="border-t border-gray-200/70 pt-4">
<div className="flex items-center justify-between">
<span className="text-caption2 text-green-muted">
Expand Down
7 changes: 6 additions & 1 deletion src/pages/home/MyTravelList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ const MyTravelList = () => {
const snapshot = items;
setItems((prev) => prev.filter((it) => it.contentId !== item.contentId));
try {
await unsavePlace({ contentId: String(item.contentId) });
await unsavePlace({
contentId: item.contentId,
themeName: item.themeName,
cnctrLevel: item.cnctrLevel,
regionName: item.regionName ?? '여행지',
});
} catch (e) {
console.error('[MyTravelList][unsavePlace]', e);
// 롤백
Expand Down