From f6c7c593d9e3d9d9cede98a55bde65b3ce919e67 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Mon, 4 Aug 2025 00:20:59 +0200 Subject: [PATCH] Move search bar to top --- app/page.tsx | 6 +-- app/profiles/ProfileFilters.tsx | 62 ++++++++------------------ app/profiles/page.tsx | 77 +++++++++++++++++++++++++-------- tailwind.config.ts | 2 +- 4 files changed, 80 insertions(+), 67 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index fb081c1e..111a1c18 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -4,14 +4,12 @@ import ProfilePage from "@/app/profiles/page"; export const dynamic = "force-dynamic"; // This disables SSG and ISR -import Link from "next/link"; - export default function HomePage() { const profilePage = () => { return (
- +
) } @@ -38,7 +36,7 @@ export default function HomePage() { BayesBond

- Tired of swiping? Just search what you are looking for! + Tired of swiping? Just search what you're looking for!

{profilePage()} diff --git a/app/profiles/ProfileFilters.tsx b/app/profiles/ProfileFilters.tsx index 69569c81..1d1d431f 100644 --- a/app/profiles/ProfileFilters.tsx +++ b/app/profiles/ProfileFilters.tsx @@ -223,11 +223,21 @@ export function ProfileFilters({filters, onFilterChange, onShowFilters, onToggle max: number; } + const rangeStates = Object.fromEntries(rangeConfig.map(({id}) => { + const [minVal, setMinVal] = useState(undefined); + const [maxVal, setMaxVal] = useState(undefined); + return [id, { + minVal, + maxVal, + setMinVal, + setMaxVal, + }]; + })) + function getSlider({id, name, min, max}: Range) { const minStr = 'min' + capitalize(id); const maxStr = 'max' + capitalize(id); - const [minVal, setMinVal] = useState(undefined); - const [maxVal, setMaxVal] = useState(undefined); + const {minVal, maxVal, setMinVal, setMaxVal} = rangeStates[id]; return (
@@ -295,52 +305,10 @@ export function ProfileFilters({filters, onFilterChange, onShowFilters, onToggle ) } - const [text, setText] = useState(''); - return (
- {showFilters && ( -
-
- setText(e.target.value)} - onKeyDown={(e) => { - if (e.key === 'Enter') { - const value = (e.target as HTMLInputElement).value; - onFilterChange('searchQuery', value); - } - }} - /> - {filters.searchQuery && ( - - )} -
-
- - - -
-
- )} + {/*{showFilters && ()}*/} + )} +
+
+ + +
-
- All the profiles are searchable, simply filter them below to find your best connections! -
- -
+
{/* Filters Sidebar */} -
+
{/*// md:${showFilters ? 'w-80' : 'w-20'}*/} -
+
{loading ? ( -
+
) : error ? ( -
+

{error}

) : profiles.length > 0 ? ( -
+
{profiles.map(( user, idx diff --git a/tailwind.config.ts b/tailwind.config.ts index 6c61ce6d..77fe4d90 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -13,7 +13,7 @@ export default { foreground: "var(--foreground)", }, screens: { - 'xs': {'max': '450px'}, + 'xs': {'max': '500px'}, }, }, },