diff --git a/website/nix/foverrides.nix b/website/nix/foverrides.nix index 3202a99..cdca645 100644 --- a/website/nix/foverrides.nix +++ b/website/nix/foverrides.nix @@ -55,16 +55,23 @@ in # nextjs writes in node_mdules built = { - override.copyTree = true; + override = { - # nextjs chaches some stuff in $HOME - override.preBuild = '' - export HOME=./home + copyTree = true; - ${hooks.prepare} + # nextjs chaches some stuff in $HOME + preBuild = '' + export HOME=./home + + ${hooks.prepare} - ls -la src/models/data - ''; + ls -la src/models/data + ''; + postBuild = '' + npx pagefind --site ./out + ls -la out + ''; + }; tree = let diff --git a/website/src/app/f/[...path]/page.tsx b/website/src/app/f/[...path]/page.tsx index 3953b45..41aab9f 100644 --- a/website/src/app/f/[...path]/page.tsx +++ b/website/src/app/f/[...path]/page.tsx @@ -91,8 +91,6 @@ export default async function Page(props: { params: { path: string[] } }) { meta?.signature || (item && findType(item)) || "" ); - console.log(meta); - const position = meta?.content_meta?.position || meta?.attr_position || @@ -171,7 +169,7 @@ export default async function Page(props: { params: { path: string[] } }) { {!position && (
- Noogle's tip + {"Noogle's tip"}

diff --git a/website/src/components/PagefindResults.tsx b/website/src/components/PagefindResults.tsx index 22f155e..77f45ca 100644 --- a/website/src/components/PagefindResults.tsx +++ b/website/src/components/PagefindResults.tsx @@ -55,7 +55,7 @@ export function PagefindResults() { const { search } = usePagefindSearch(); useEffect(() => { const init = async () => { - console.log({ search }); + console.log({ search, term, filters: { from, to } }); if (search) { let raw = await search(term, { filters: { from, to } }); setSearchResults(raw?.results || []); diff --git a/website/src/components/filter.tsx b/website/src/components/filter.tsx index 7029e9a..f740338 100644 --- a/website/src/components/filter.tsx +++ b/website/src/components/filter.tsx @@ -77,7 +77,6 @@ export const Filter = (props: FilterProps) => { try { const f = await pagefind.filters(); setFilters(f); - console.log({ f }); } catch (e) { console.log(e); } diff --git a/website/src/components/search.tsx b/website/src/components/search.tsx deleted file mode 100644 index 69587cf..0000000 --- a/website/src/components/search.tsx +++ /dev/null @@ -1,74 +0,0 @@ -"use client"; -import React, { useState } from "react"; - -export default function SearchPage() { - const [query, setQuery] = React.useState(""); - const [results, setResults] = React.useState([]); - - React.useEffect(() => { - async function loadPagefind() { - // @ts-ignore - if (typeof window.pagefind === "undefined") { - try { - // @ts-ignore - window.pagefind = await import( - // @ts-expect-error pagefind.js generated after build - /* webpackIgnore: true */ "/pagefind/pagefind.js" - ); - // @ts-ignore - console.log("setup:", window?.pagefind); - } catch (e) { - // @ts-ignore - window.pagefind = { search: () => ({ results: [] }) }; - } - } - } - loadPagefind(); - }, []); - - async function handleSearch() { - // @ts-ignore - console.log("searching", window?.pagefind); - // @ts-ignore - if (window.pagefind) { - // @ts-ignore - const search = await window.pagefind.search(query); - setResults(search.results); - } - } - - return ( -

- setQuery(e.target.value)} - onInput={handleSearch} - /> -
- {results.map((result, index) => ( - // @ts-ignore - - ))} -
-
- ); -} - -function Result({ result }: any) { - const [data, setData] = useState(null); - - React.useEffect(() => { - async function fetchData() { - const data = await result.data(); - setData(data); - } - fetchData(); - }, [result]); - - if (!data) return null; - - // @ts-ignore - return
{`${data.url}`}
; -}