From 0b73e98141a8a81bd13255a1ef51c6cbcdd04202 Mon Sep 17 00:00:00 2001 From: i30101 Date: Thu, 2 Apr 2026 12:52:32 -0400 Subject: [PATCH] refactord NavbarActions --- .../listings/detail/ListingDetail.tsx | 16 ++--- .../components/listings/detail/SubletMap.tsx | 5 +- frontend/components/navbar/Navbar.tsx | 15 ++--- frontend/components/navbar/NavbarActions.tsx | 58 +++++++++---------- frontend/lib/constants.ts | 1 - 5 files changed, 42 insertions(+), 53 deletions(-) diff --git a/frontend/components/listings/detail/ListingDetail.tsx b/frontend/components/listings/detail/ListingDetail.tsx index fb61972..612d439 100644 --- a/frontend/components/listings/detail/ListingDetail.tsx +++ b/frontend/components/listings/detail/ListingDetail.tsx @@ -56,10 +56,8 @@ export const ListingDetail = ({ listing, initialIsFavorited }: Props) => { toggleFavoriteMutation.mutate(!isFavorited); }; - const subletCoords = - listingType === "sublet" ? listing.additional_data : null; - const hasLocation = - subletCoords?.latitude != null && subletCoords?.longitude != null; + const subletCoords = listingType === "sublet" ? listing.additional_data : null; + const hasLocation = subletCoords?.latitude != null && subletCoords?.longitude != null; return (
@@ -94,13 +92,11 @@ export const ListingDetail = ({ listing, initialIsFavorited }: Props) => {

{"Where you'll be living"}

- Approximate location shown. The exact location will be shared once you connect with the owner. + Approximate location shown. The exact location will be shared once you connect + with the owner.

-
- +
+ )} - import("@/components/listings/detail/SubletMapContent").then((m) => m.SubletMapContent), - { ssr: false }, + () => import("@/components/listings/detail/SubletMapContent").then((m) => m.SubletMapContent), + { ssr: false } ); export const SubletMap = ({ latitude, longitude }: Props) => { diff --git a/frontend/components/navbar/Navbar.tsx b/frontend/components/navbar/Navbar.tsx index c56a614..4163aaa 100644 --- a/frontend/components/navbar/Navbar.tsx +++ b/frontend/components/navbar/Navbar.tsx @@ -46,15 +46,12 @@ export const Navbar = () => { )} - {createNewConfig && ( - - )} + diff --git a/frontend/components/navbar/NavbarActions.tsx b/frontend/components/navbar/NavbarActions.tsx index 7607f49..915c0d4 100644 --- a/frontend/components/navbar/NavbarActions.tsx +++ b/frontend/components/navbar/NavbarActions.tsx @@ -6,16 +6,14 @@ import { Button } from "@/components/ui/button"; import { UserProfileDropdown } from "./UserProfileDropdown"; interface Props { - createNewText: string; - createNewHref: string; + createNewConfig: { text: string; href: string } | undefined; mobileShowHamburger: boolean; isMobileMenuOpen: boolean; onToggleMobileMenu: () => void; } export const NavbarActions = ({ - createNewText, - createNewHref, + createNewConfig, mobileShowHamburger, isMobileMenuOpen, onToggleMobileMenu, @@ -61,33 +59,33 @@ export const NavbarActions = ({ return (
- {/* desktop only new listing button */} - { - - } + {createNewConfig && ( + <> + {/* desktop only new listing button */} + - {/* mobile only new listing button (icon only) */} - { - - } + {/* mobile only new listing button (icon only) */} + + + )} {/* notification bell */}