Skip to content
Merged
9 changes: 7 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ import { HomeLandingRender } from "@/src/shared/ui/globalRender/globalRender";
import { FrameBottomNav } from "@/src/shared/ui/bottomNavigation/frameBottomNavigation";
import { ClientOnly } from "@/src/shared/ui/clientOnly/clientOnly";



export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: "pinhouse",
description: "pinhosue-fe",
icons: {
icon: "/BrandLogo.svg",
},
};

export default function RootLayout({
Expand Down
3 changes: 3 additions & 0 deletions public/BrandLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/entities/listings/hooks/useListingDetailHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export const useListingRouteDetail = <T, TParam extends object>({

export const useListingFilterDetail = <T>() => {
return useQuery<IResponse<T>, Error, T>({
queryKey: ["pinpoint"],
queryKey: ["pinpointSettings"],
staleTime: 1000 * 60 * 5,
placeholderData: previousData => previousData,
queryFn: () => PostBasicRequest<T, IResponse<T>, {}, IResponse<T>>(endPoint["pinpoint"], "get"),
Expand Down
10 changes: 9 additions & 1 deletion src/features/home/hooks/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { useRouter } from "next/navigation";
import { useHomeSheetStore } from "@/src/features/home/model/homeStore";
import { useOAuthStore } from "@/src/features/login/model";
import { PinPointPlace } from "@/src/entities/listings/model/type";
import { useMemo } from "react";
import { homeSheetParseObject } from "@/src/features/listings/model";

export const useHomeGlobalSearch = (globalData?: GlobalListType): GlobalSearchSection[] => {
if (!globalData) return [];
Expand Down Expand Up @@ -36,7 +38,7 @@ export const useHomeGlobalSearch = (globalData?: GlobalListType): GlobalSearchSe
];
};

export const usePinhouseRouter = () => {
export const usePinhouseRouter = (searchParams: URLSearchParams) => {
const router = useRouter();
const closeSheet = useHomeSheetStore(s => s.closeSheet);
const replaceRouter = () => {
Expand All @@ -46,11 +48,17 @@ export const usePinhouseRouter = () => {

const handleSetPinpoint = () => {
router.push("/mypage/pinpoints");
closeSheet();
};

const mode = useMemo(() => {
return homeSheetParseObject(searchParams);
}, [searchParams]);

return {
replaceRouter,
handleSetPinpoint,
mode,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ import { cn } from "@/lib/utils";
type PinpointSelectedButtonType = {
mode: "pinpoints" | "maxTime";
handleSetPinpoint: () => void;
replaceRouter:() => void;
};

export const PinpointSelectedButton = ({ mode, handleSetPinpoint }: PinpointSelectedButtonType) => {
export const PinpointSelectedButton = ({
mode,
handleSetPinpoint,
replaceRouter,
}: PinpointSelectedButtonType) => {
return (
<div className="flex gap-3">
<Button
Expand All @@ -20,7 +25,11 @@ export const PinpointSelectedButton = ({ mode, handleSetPinpoint }: PinpointSele
>
핀포인트 설정
</Button>
<Button className="flex-1 bg-[#2E2A3B] text-sm font-medium text-white" radius="sm">
<Button
className="flex-1 bg-[#2E2A3B] text-sm font-medium text-white"
radius="sm"
onClick={replaceRouter}
>
저장하기
</Button>
</div>
Expand Down
40 changes: 11 additions & 29 deletions src/features/home/ui/components/homeFullSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
"use client";
import { homeSheetParseObject } from "@/src/features/listings/model";

import { AnimatePresence, motion } from "framer-motion";
import { useSearchParams } from "next/navigation";
import { useHomeSheetStore } from "../../model/homeStore";
import { useMemo } from "react";
import { PinpointRowBox } from "./pinpointRowBoxs";
import { MaxTimeSliderBox } from "./maxTime";
import { Button } from "@/src/shared/lib/headlessUi";
import { cn } from "@/lib/utils";
import { usePinhouseRouter } from "@/src/features/home/hooks/hooks";
import { PinpointSelectedButton } from "@/src/features/home/ui/components/components/pinpointSelectedButton";
import type { ReadonlyURLSearchParams } from "next/navigation";

export const HomeSheet = () => {
const open = useHomeSheetStore(s => s.open);
const searchParams = useSearchParams();
const mode = useMemo(() => {
return homeSheetParseObject(searchParams);
}, [searchParams]);
const { replaceRouter, handleSetPinpoint } = usePinhouseRouter();

const { replaceRouter, handleSetPinpoint, mode } = usePinhouseRouter(
searchParams as ReadonlyURLSearchParams
);

return (
<AnimatePresence>
Expand All @@ -38,7 +36,6 @@ export const HomeSheet = () => {
exit={{ y: "100%" }}
transition={{ type: "spring", stiffness: 260, damping: 30 }}
>
{/* <div className="mx-auto mb-3 mt-2 h-1.5 w-12 rounded-full bg-gray-300" /> */}

<div className="flex items-center justify-between">
<h2 className="text-lg font-bold">{mode?.label}</h2>
Expand All @@ -57,27 +54,12 @@ export const HomeSheet = () => {
{mode?.key === "pinpoints" && <PinpointRowBox />}
{mode?.key === "maxTime" && <MaxTimeSliderBox />}
{!mode ? null : (
<PinpointSelectedButton mode={mode?.key} handleSetPinpoint={handleSetPinpoint} />
<PinpointSelectedButton
mode={mode?.key}
handleSetPinpoint={handleSetPinpoint}
replaceRouter={replaceRouter}
/>
)}
{/*<div className="flex gap-3">*/}
{/* <Button*/}
{/* className={cn(*/}
{/* "flex-1 border-greyscale-grey-100 bg-white text-sm font-medium text-gray-800",*/}
{/* mode?.key === "maxTime" ? "hidden" : "block"*/}
{/* )}*/}
{/* variant="outline"*/}
{/* radius="sm"*/}
{/* onClick={handleSetPinpoint}*/}
{/* >*/}
{/* 핀포인트 설정*/}
{/* </Button>*/}
{/* <Button*/}
{/* className="flex-1 bg-[#2E2A3B] text-sm font-medium text-white"*/}
{/* radius="sm"*/}
{/* >*/}
{/* 저장하기*/}
{/* </Button>*/}
{/*</div>*/}
</motion.div>
</div>
</motion.div>
Expand Down
2 changes: 1 addition & 1 deletion src/features/home/ui/components/pinpointRowBoxs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PinpointRowBoxSkeleton } from "./skeleton/skeleton";
import { usePinpointRowBox } from "@/src/features/home/hooks/hooks";

export const PinpointRowBox = () => {
const { data, isLoading } = useListingFilterDetail<PinPointPlace>();
const { data } = useListingFilterDetail<PinPointPlace>();
const pin = data?.pinPoints ?? null;
const { pinpoints, pinPointId, onChangePinpoint } = usePinpointRowBox(pin);

Expand Down
9 changes: 3 additions & 6 deletions src/features/home/ui/homeHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ import { HomeScreenLogo } from "@/src/assets/icons/home/homeScreenLogo";
import { PinhouseLogo } from "@/src/assets/icons/logo";
import { useRouter } from "next/navigation";
import { SearchLine } from "@/src/assets/icons/home";
import { useHomeHeaderHooks } from "@/src/widgets/homeSection/hooks/homeHeaderHooks";

export const HomeHeader = () => {
const router = useRouter();

const pageRouter = () => {
router.push("/home/search");
};
const { onRouteChange } = useHomeHeaderHooks();

return (
<header className="flex items-center justify-between pt-5">
Expand All @@ -18,7 +15,7 @@ export const HomeHeader = () => {
</div>
<div className="flex items-center gap-3">
<button aria-label="검색">
<SearchLine onClick={pageRouter} />
<SearchLine onClick={onRouteChange} />
</button>
</div>
</header>
Expand Down
16 changes: 3 additions & 13 deletions src/features/home/ui/homeQuickStatsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,12 @@ import { useHomeMaxTime, useHomeSheetStore } from "../model/homeStore";
import { useRouter, useSearchParams } from "next/navigation";
import { useOAuthStore } from "../../login/model";
import { splitAddress, transTime } from "@/src/shared/lib/utils";
import { useHomeUseHooks } from "@/src/features/home/ui/homeUseHooks/homeUseHooks";

export const QuickStatsList = () => {
const openSheet = useHomeSheetStore(s => s.openSheet);
const { pinPointId, pinPointName } = useOAuthStore();
const { maxTime } = useHomeMaxTime();
const [line1, line2] = splitAddress(pinPointName ?? "핀포인트 이름 설정해주세요");
const searchParams = useSearchParams();
const router = useRouter();

const onSelectSection = (key: string) => {
const params = new URLSearchParams(searchParams.toString());
params.set("mode", key);
params.set("id", pinPointId ?? "");
router.push(`?${params.toString()}`, { scroll: false });
openSheet();
};
const { maxTime } = useHomeMaxTime();
const {line2, line1 , onSelectSection} = useHomeUseHooks();

return (
<div className="relative grid grid-cols-2 grid-rows-[auto,1fr] rounded-2xl bg-white p-4">
Expand Down
25 changes: 25 additions & 0 deletions src/features/home/ui/homeUseHooks/homeUseHooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { useHomeSheetStore } from "@/src/features/home/model/homeStore";
import { useOAuthStore } from "@/src/features/login/model";
import { splitAddress } from "@/src/shared/lib/utils";
import { useRouter, useSearchParams } from "next/navigation";

export const useHomeUseHooks = () => {
const openSheet = useHomeSheetStore(s => s.openSheet);
const { pinPointId, pinPointName } = useOAuthStore();
const [line1, line2] = splitAddress(pinPointName ?? "핀포인트 이름 설정해주세요");
const searchParams = useSearchParams();
const router = useRouter();
const onSelectSection = (key: string) => {
const params = new URLSearchParams(searchParams.toString());
params.set("mode", key);
params.set("id", pinPointId ?? "");
router.push(`?${params.toString()}`, { scroll: false });
openSheet();
};

return {
line1,
line2,
onSelectSection
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export const RoomTypeDetail = ({ listingId }: { listingId: string }) => {
{current?.thumbnail ? (
<img src={current.thumbnail} className="h-full w-full object-cover" />
) : (
<div className="absolute inset-0 flex flex-col items-center justify-center gap-2">
<CompareDefaultImage className="object-contain opacity-60" />
<div className="absolute inset-0 flex flex-col items-center justify-center">
<CompareDefaultImage className="object-contain opacity-60 h-30" />
<p className="text-xs text-greyscale-grey-400">도면 이미지를 준비하고 있어요</p>
</div>
)}
Expand Down
25 changes: 25 additions & 0 deletions src/features/listings/ui/listingsFilter/hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { useFilterSheetStore, useListingsFilterStore } from "@/src/features/listings/model";
import { useRouter, useSearchParams } from "next/navigation";

export const ListingHooks = () => {
const openSheet = useFilterSheetStore(state => state.openSheet);
const router = useRouter();
const searchParams = useSearchParams();
const params = new URLSearchParams(searchParams.toString());
const onOpenSheet = () => {
openSheet();
router.push(`listings?${params}`);
};

const hasSelectedFilters = useListingsFilterStore(state =>
[state.regionType, state.rentalTypes, state.supplyTypes, state.houseTypes].some(
list => list.length > 0
)
);

return {
openSheet,
hasSelectedFilters,
onOpenSheet,
};
};
21 changes: 4 additions & 17 deletions src/features/listings/ui/listingsFilter/listingsFilterPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
"use client";
import { useRouter, useSearchParams } from "next/navigation";

import { FILTER_OPTIONS, filterMap, getAllFilterIcon } from "../../model";
import { useFilterSheetStore, useListingsFilterStore } from "../../model/listingsStore";
import { useListingsFilterStore } from "../../model/listingsStore";
import { ListingTagButton } from "../listingsButton/listingsTagButton";
import { ListingHooks } from "@/src/features/listings/ui/listingsFilter/hooks";

export const ListingFilterPanel = () => {
const openSheet = useFilterSheetStore(state => state.openSheet);
const router = useRouter();
const searchParams = useSearchParams();
const params = new URLSearchParams(searchParams.toString());
params.set("tab", params.get("tab") ?? "region");
const onOpenSheet = () => {
openSheet();
router.push(`listings?${params}`);
};

const hasSelectedFilters = useListingsFilterStore(state =>
[state.regionType, state.rentalTypes, state.supplyTypes, state.houseTypes].some(
list => list.length > 0
)
);
const { onOpenSheet, hasSelectedFilters } = ListingHooks();

return (
<div className="relative w-full select-none border-b-[1px] px-1 py-1">
Expand Down
Loading