diff --git a/meshexplorer/package-lock.json b/meshexplorer/package-lock.json index 7084c47..9025870 100644 --- a/meshexplorer/package-lock.json +++ b/meshexplorer/package-lock.json @@ -25,6 +25,7 @@ "moment": "^2.30.1", "next": "15.3.8", "next-themes": "^0.4.6", + "nuqs": "^2.8.9", "qrcode": "^1.5.4", "react": "^19.0.0", "react-d3-tree": "^3.6.6", @@ -1585,6 +1586,12 @@ "integrity": "sha512-5EwMtOqvJMMa3HbmxLlF74e+3/HhwBTMcvt3nqVJgGCozO6hzIPOBlwm8mGVNR9SN2IJpxSnlxczyDjcn7qIyw==", "dev": true }, + "node_modules/@standard-schema/spec": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.0.0.tgz", + "integrity": "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==", + "license": "MIT" + }, "node_modules/@swc/counter": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", @@ -5767,6 +5774,43 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/nuqs": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/nuqs/-/nuqs-2.8.9.tgz", + "integrity": "sha512-8ou6AEwsxMWSYo2qkfZtYFVzngwbKmg4c00HVxC1fF6CEJv3Fwm6eoZmfVPALB+vw8Udo7KL5uy96PFcYe1BIQ==", + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/franky47" + }, + "peerDependencies": { + "@remix-run/react": ">=2", + "@tanstack/react-router": "^1", + "next": ">=14.2.0", + "react": ">=18.2.0 || ^19.0.0-0", + "react-router": "^5 || ^6 || ^7", + "react-router-dom": "^5 || ^6 || ^7" + }, + "peerDependenciesMeta": { + "@remix-run/react": { + "optional": true + }, + "@tanstack/react-router": { + "optional": true + }, + "next": { + "optional": true + }, + "react-router": { + "optional": true + }, + "react-router-dom": { + "optional": true + } + } + }, "node_modules/oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", diff --git a/meshexplorer/package.json b/meshexplorer/package.json index 8fc4802..c3475df 100644 --- a/meshexplorer/package.json +++ b/meshexplorer/package.json @@ -28,6 +28,7 @@ "moment": "^2.30.1", "next": "15.3.8", "next-themes": "^0.4.6", + "nuqs": "^2.8.9", "qrcode": "^1.5.4", "react": "^19.0.0", "react-d3-tree": "^3.6.6", diff --git a/meshexplorer/src/app/(app)/search/page.tsx b/meshexplorer/src/app/(app)/search/page.tsx index 355dc57..ac58953 100644 --- a/meshexplorer/src/app/(app)/search/page.tsx +++ b/meshexplorer/src/app/(app)/search/page.tsx @@ -8,7 +8,6 @@ import SearchResults from '@/components/SearchResults'; import RegionSelect from '@/components/RegionSelect'; import { LAST_SEEN_OPTIONS } from '@/components/ConfigContext'; import { useState, Suspense, useEffect } from 'react'; -import { useRouter } from 'next/navigation'; import { ChevronDownIcon } from '@heroicons/react/24/outline'; function SearchPageContent() { @@ -16,20 +15,14 @@ function SearchPageContent() { const { query, setQuery, setLimit, setExact, setIsRepeater } = useSearchQuery(); const [showFilters, setShowFilters] = useState(false); - // Helper function to check if exact search is enabled - const isExactEnabled = query.exact === true || (typeof query.exact === 'string' && (query.exact === 'true' || query.exact === '')); - - // Helper function to check if is_repeater search is enabled - const isRepeaterEnabled = query.is_repeater === true || (typeof query.is_repeater === 'string' && (query.is_repeater === 'true' || query.is_repeater === '')); - // Always use config values for region and lastSeen const searchParams = { query: query.q, region: config.selectedRegion, lastSeen: config.lastSeen, limit: query.limit || 50, - exact: isExactEnabled, - is_repeater: isRepeaterEnabled, + exact: query.exact, + is_repeater: query.is_repeater, }; const { data, isLoading, error } = useMeshcoreSearch({ @@ -144,7 +137,7 @@ function SearchPageContent() { setExact(e.target.checked)} className="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" /> @@ -163,7 +156,7 @@ function SearchPageContent() { setIsRepeater(e.target.checked)} className="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" /> diff --git a/meshexplorer/src/app/layout.tsx b/meshexplorer/src/app/layout.tsx index 1bb4ce2..dad11b2 100644 --- a/meshexplorer/src/app/layout.tsx +++ b/meshexplorer/src/app/layout.tsx @@ -3,6 +3,7 @@ import { Geist, Geist_Mono } from "next/font/google"; import "./globals.css"; import { ConfigProvider } from "@/components/ConfigContext"; import { QueryProvider } from "@/components/QueryProvider"; +import { NuqsAdapter } from "nuqs/adapters/next/app"; const geistSans = Geist({ variable: "--font-geist-sans", @@ -42,11 +43,13 @@ export default function RootLayout({ style={{ '--header-height': '64px' } as React.CSSProperties} >