Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"type": "module",
"scripts": {
"dev": "VITE_APP_URL=\"http://localhost:3000\" dotenvx run --ignore MISSING_ENV_FILE -f ../../.env.supabase -f ../../.env.restate -f .env -- vite dev --port 3000",
"build": "vite build",
"build": "vite build && pagefind --site ./dist/client",
"serve": "vite preview",
"test": "playwright test",
"typecheck": "pnpm -F @hypr/web build && tsc --project tsconfig.json --noEmit",
"typecheck": "CI=true pnpm -F @hypr/web build && tsc --project tsconfig.json --noEmit",
"gen:agents": "node scripts/gen-agents.js"
},
"dependencies": {
Expand Down Expand Up @@ -77,6 +77,7 @@
"@vitejs/plugin-react": "^5.1.1",
"jsdom": "^27.2.0",
"netlify": "^23.11.1",
"pagefind": "^1.4.0",
"tanstack-router-sitemap": "^1.0.13",
"typescript": "^5.9.3",
"vite": "^7.2.4",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from "lucide-react";
import { useState } from "react";

import { Search } from "@/components/search";
import { useDocsDrawer } from "@/hooks/use-docs-drawer";
import { getPlatformCTA, usePlatform } from "@/hooks/use-platform";

Expand Down Expand Up @@ -176,6 +177,7 @@ export function Header() {
</div>

<nav className="hidden sm:flex items-center gap-2">
<Search />
<Link
to="/join-waitlist"
className="px-4 h-8 flex items-center text-sm text-neutral-600 hover:text-neutral-800 transition-all hover:underline decoration-dotted"
Expand Down
42 changes: 42 additions & 0 deletions apps/web/src/components/search.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { useEffect, useRef } from "react";

export function Search() {
const containerRef = useRef<HTMLDivElement>(null);

useEffect(() => {
let pagefindInstance: { destroy?: () => void } | null = null;

const loadPagefind = async () => {
if (!containerRef.current) return;

const linkId = "pagefind-ui-css";
if (!document.getElementById(linkId)) {
const link = document.createElement("link");
link.id = linkId;
link.rel = "stylesheet";
link.href = "/pagefind/pagefind-ui.css";
document.head.appendChild(link);
}

try {
const pagefindPath = "/pagefind/pagefind-ui.js";
const pagefindUI = await import(/* @vite-ignore */ pagefindPath);
pagefindInstance = new pagefindUI.PagefindUI({
element: containerRef.current,
showSubResults: true,
showImages: false,
});
} catch {}
};

loadPagefind();

return () => {
if (pagefindInstance?.destroy) {
pagefindInstance.destroy();
}
};
}, []);

return <div ref={containerRef} />;
}
3 changes: 2 additions & 1 deletion apps/web/src/env.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createEnv } from "@t3-oss/env-core";
import { z } from "zod";

const isCI = process.env.CI === "true";
const isDev = process.env.NODE_ENV === "development";

export const env = createEnv({
Expand Down Expand Up @@ -34,5 +35,5 @@ export const env = createEnv({

runtimeEnv: { ...process.env, ...import.meta.env },
emptyStringAsUndefined: true,
skipValidation: process.env.CI === "true",
skipValidation: isCI,
});
Loading
Loading