Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

[Feat] Challenge search (#1259)

__aadamwc12e9d38e25a
diff --git a/.env.example b/.env.example
index a7f248be..1dac9833 100644
--- a/.env.example
+++ b/.env.example
@@ -11,3 +11,7 @@ UPLOADTHING_APP_ID=
# NEXTAUTH_SECRET=""
NEXTAUTH_URL="http://localhost:3000"
+# Algolia
+NEXT_PUBLIC_ALGOLIA_APP_ID=
+NEXT_PUBLIC_ALGOLIA_API_KEY=
+
diff --git a/LOCAL.md b/LOCAL.md
index 5b4929cf..e29f84c8 100644
--- a/LOCAL.md
+++ b/LOCAL.md
@@ -80,7 +80,16 @@ NEXTAUTH_SECRET="for local use you can just use a garble of letters"
NEXTAUTH_URL="http://localhost:3000"
```
-### 5. Install dependencies
+### 5. Setup algolia for search
+
+Go to [algolia.com](https://www.algolia.com/apps/) and create a project, then copy in the secrets into your `.env`.
+
+```
+NEXT_PUBLIC_ALGOLIA_APP_ID=APP_ID
+NEXT_PUBLIC_ALGOLIA_API_KEY=API_KEY
+```
+
+### 6. Install dependencies
Use `pnpm` to install dependencies.
@@ -88,14 +97,14 @@ Use `pnpm` to install dependencies.
pnpm install
```
-### 6. Push Database Schema and Seed
+### 7. Push Database Schema and Seed
```
pnpm db:push
pnpm db:seed
```
-### 7. Running the dev server
+### 8. Running the dev server
Finally, you can run the dev server:
diff --git a/apps/web/global.d.ts b/apps/web/global.d.ts
index d3dcceab..ed7b2c6b 100644
--- a/apps/web/global.d.ts
+++ b/apps/web/global.d.ts
@@ -14,5 +14,7 @@ declare namespace NodeJS {
RESEND_API_KEY: string;
EDGE_CONFIG: string;
STAGING?: string;
+ NEXT_PUBLIC_ALGOLIA_APP_ID: string;
+ NEXT_PUBLIC_ALGOLIA_API_KEY: string;
}
}
diff --git a/apps/web/package.json b/apps/web/package.json
index ab2efb83..87feb642 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -42,6 +42,7 @@
"@vercel/analytics": "^1.1.1",
"@vercel/edge-config": "^0.2.1",
"@vercel/toolbar": "^0.1.1",
+ "algoliasearch": "^4.20.0",
"bad-words": "^3.0.4",
"clsx": "^2.0.0",
"cmdk": "^0.2.0",
@@ -60,6 +61,8 @@
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "18.2.0",
"react-hook-form": "^7.45.1",
+ "react-instantsearch": "^7.3.0",
+ "react-instantsearch-nextjs": "^0.1.5",
"react-intersection-observer": "^9.5.2",
"react-markdown": "^8.0.7",
"react-select": "^5.7.4",
diff --git a/apps/web/src/components/Navigation/index.tsx b/apps/web/src/components/Navigation/index.tsx
index 85be64b6..ba44d892 100644
--- a/apps/web/src/components/Navigation/index.tsx
+++ b/apps/web/src/components/Navigation/index.tsx
@@ -19,6 +19,8 @@ import { getScopedI18n } from '~/locales/server';
import { MobileNav } from './mobile-nav';
import { NavLink } from './nav-link';
import { Badge } from '@repo/ui/components/badge';
+import { Search } from '../search/search';
+import { Suspense } from 'react';
export function getAdminUrl() {
// reference for vercel.com
@@ -88,6 +90,9 @@ export async function Navigation() {
<div className="flex">
<div className="flex items-center justify-end gap-2">
+ <Suspense>
+ <Search />
+ </Suspense>
<ThemeButton />
{featureFlags?.enableLogin ? <LoginButton /> : null}
<MobileNav>
diff --git a/apps/web/src/components/search/search-content.tsx b/apps/web/src/components/search/search-content.tsx
new file mode 100644
index 00000000..36139204
--- /dev/null
+++ b/apps/web/src/components/search/search-content.tsx
@@ -0,0 +1,236 @@
+import { DialogClose } from '@radix-ui/react-dialog';
+import type { Challenge } from '@repo/db/types';
+import { DifficultyBadge } from '@repo/ui/components/difficulty-badge';
+import Link from 'next/link';
+import { Highlight } from 'react-instantsearch';
+import { SearchBoxContextProvider, useSearchBox } from './searchbox.context';
+import { useSearchResult, useSearchStatus, type Result } from './search-provider';
+import { useRecentSearchesStorage } from './use-recent-searches-storage';
+import { Text } from '@repo/ui/components/typography/typography';
+import { SearchIcon, Loader2 as LoaderIcon, X as XIcon } from '@repo/ui/icons';
+import { ScrollArea, ScrollBar } from '@repo/ui/components/scroll-area';
+
+function useRecentSearches() {
+ return useRecentSearchesStorage<Challenge>();
+}
+
+type OnClick = () => void;
+
+interface HitsProps {
+ onClick: OnClick;
+}
+
+function Results({ onClick }: HitsProps) {
+ const { query, results } = useSearchResult();
+
+ if (!query) {
+ return (
+ <div className="mb-6 flex flex-col">
+ <RecentSearches onClick={onClick} />
+ </div>
+ );
+ }
+
+ if (results.length === 0) {
+ return (
+ <div className="flex h-full flex-grow flex-col justify-between">
+ <Text intent="leading" className="my-8 flex items-center justify-center">
+ No results found for "<strong className="max-w-[50%] md:max-w-[400px]">{query}</strong>"
+ </Text>
+ <ProposedPhrases />
+ </div>
+ );
+ }
+
+ return (
+ <div className="mb-6 flex flex-col">
+ {results.map((result) => (
+ <Result key={result.id} result={result} onClick={onClick} />
+ ))}
+ </div>
+ );
+}
+
+function Result({ result, onClick }: { result: Result; onClick: OnClick }) {
+ const { onAdd } = useRecentSearches();
+ if (result.status !== 'ACTIVE') return null;
+
+ return (
+ <Link
+ prefetch={false}
+ onClick={() => {
+ onClick();
+ onAdd(result);
+ }}
+ href={`/challenge/${result.slug}`}
+ className="focus-visible:ring-ring hover:bg-foreground/10 flex w-full flex-col items-start justify-center gap-2 overflow-hidden border-b p-6 transition-colors"
+ >
+ <div className="flex items-start gap-2">
+ <DifficultyBadge difficulty={result.difficulty} className="w-[80px] justify-center" />
+ <Highlight
+ attribute="name"
+ hit={result}
+ classNames={{
+ root: 'text-sm text-foreground/60',
+ highlighted: 'font-medium bg-transparent text-foreground',
+ }}
+ />
+ </div>
+ </Link>
+ );
+}
+
+function ProposedPhrases() {
+ const { setQuery } = useSearchBox();
+
+ const updateQuery = (query: string) => () => {
+ setQuery(query);
+ };
+
+ return (
+ <div className="flex flex-col">
+ <span className="text-muted-foreground border-b px-4 pb-4">Try searching for:</span>
+ <button
+ onClick={updateQuery('Easy')}
+ className="focus-visible:ring-ring hover:bg-foreground/10 flex w-full flex-col items-start justify-center gap-2 overflow-hidden border-b p-6 transition-colors"
+ >
+ Easy
+ </button>
+ <button
+ onClick={updateQuery('Extreme')}
+ className="focus-visible:ring-ring hover:bg-foreground/10 flex w-full flex-col items-start justify-center gap-2 overflow-hidden border-b p-6 transition-colors"
+ >
+ Extreme
+ </button>
+ </div>
+ );
+}
+
+function Topbar() {
+ const { query, setQuery } = useSearchBox();
+ const { status } = useSearchStatus();
+
+ const isLoading = status === 'loading';
+
+ return (
+ <div className="relative flex w-full items-center gap-2 border-b p-4">
+ {isLoading ? (
+ <LoaderIcon className="h-6 w-6 animate-spin" />
+ ) : (
+ <SearchIcon className="h-6 w-6" />
+ )}
+ <input
+ aria-label="Search for a challenge"
+ type="search"
+ className="focus-visible:ring-ring placeholder:text-muted-foreground flex h-10 w-full flex-grow rounded-md bg-transparent px-2 text-sm outline-none"
+ placeholder="Search for a challenge..."
+ value={query}
+ onChange={(event) => {
+ setQuery(event.currentTarget.value);
+ }}
+ />
+ <DialogClose className="hidden md:block">
+ <kbd className="bg-muted dark:group-hover:bg-muted-foreground pointer-events-none hidden h-8 select-none items-center gap-1 rounded border px-1.5 font-mono text-[10px] font-medium opacity-100 sm:flex">
+ <span className="text-xs">esc</span>
+ </kbd>
+ </DialogClose>
+ </div>
+ );
+}
+
+function RecentSearches({ onClick }: { onClick: OnClick }) {
+ const { getItems, onAdd, onRemove } = useRecentSearches();
+
+ const results = getItems();
+
+ if (results.length === 0) {
+ return (
+ <div className="flex h-full flex-grow flex-col justify-between">
+ <Text intent="leading" className="my-8 flex items-center justify-center">
+ No recent searches
+ </Text>
+ </div>
+ );
+ }
+
+ return (
+ <div className="flex flex-col">
+ <span className="text-muted-foreground border-b p-4">Recent</span>
+ {results.map((result) => (
+ <div
+ key={result.id}
+ className="hover:bg-foreground/10 focus-within:bg-foreground/10 flex items-center justify-between border-b px-6 transition-colors "
+ >
+ <Link
+ prefetch={false}
+ onClick={() => {
+ onClick();
+ onAdd(result);
+ }}
+ href={`/challenge/${result.slug}`}
+ className="flex w-full items-center gap-2 overflow-hidden py-6 focus:outline-none"
+ >
+ <DifficultyBadge difficulty={result.difficulty} className="w-[80px] justify-center" />
+ <p className="text-foreground/60 text-sm">{result.name}</p>
+ </Link>
+ <button onClick={() => onRemove(result.id)}>
+ <XIcon className="h-6 w-6" />
+ <span className="sr-only">Remove {result.name}</span>
+ </button>
+ </div>
+ ))}
+ </div>
+ );
+}
+
+function Footer() {
+ return (
+ <footer className="flex h-[60px] items-center justify-end gap-2 border-t p-4">
+ <Text
+ intent="leading"
+ className="text-foreground/60 flex select-none items-center justify-center text-sm"
+ >
+ Powered by
+ </Text>
+ <a
+ href="https://www.algolia.com/"
+ rel="noopener noreferrer"
+ target="_blank"
+ className="text-[#003dff]"
+ >
+ <svg
+ fill="currentColor"
+ width="77"
+ height="19"
+ aria-label="Algolia"
+ role="img"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 2196.2 500"
+ >
+ <path d="M1070.38,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z" />
+ <rect x="1845.88" y="104.73" width="62.58" height="277.9" rx="5.9" ry="5.9" />
+ <path d="M1851.78,71.38h50.77c3.26,0,5.9-2.64,5.9-5.9V5.9c0-3.62-3.24-6.39-6.82-5.83l-50.77,7.95c-2.87,.45-4.99,2.92-4.99,5.83v51.62c0,3.26,2.64,5.9,5.9,5.9Z" />
+ <path d="M1764.03,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z" />
+ <path d="M1631.95,142.72c-11.14-12.25-24.83-21.65-40.78-28.31-15.92-6.53-33.26-9.85-52.07-9.85-18.78,0-36.15,3.17-51.92,9.85-15.59,6.66-29.29,16.05-40.76,28.31-11.47,12.23-20.38,26.87-26.76,44.03-6.38,17.17-9.24,37.37-9.24,58.36,0,20.99,3.19,36.87,9.55,54.21,6.38,17.32,15.14,32.11,26.45,44.36,11.29,12.23,24.83,21.62,40.6,28.46,15.77,6.83,40.12,10.33,52.4,10.48,12.25,0,36.78-3.82,52.7-10.48,15.92-6.68,29.46-16.23,40.78-28.46,11.29-12.25,20.05-27.04,26.25-44.36,6.22-17.34,9.24-33.22,9.24-54.21,0-20.99-3.34-41.19-10.03-58.36-6.38-17.17-15.14-31.8-26.43-44.03Zm-44.43,163.75c-11.47,15.75-27.56,23.7-48.09,23.7-20.55,0-36.63-7.8-48.1-23.7-11.47-15.75-17.21-34.01-17.21-61.2,0-26.89,5.59-49.14,17.06-64.87,11.45-15.75,27.54-23.52,48.07-23.52,20.55,0,36.63,7.78,48.09,23.52,11.47,15.57,17.36,37.98,17.36,64.87,0,27.19-5.72,45.3-17.19,61.2Z" />
+ <path d="M894.42,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z" />
+ <path d="M2133.97,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z" />
+ <path d="M1314.05,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-11.79,18.34-19.6,39.64-22.11,62.59-.58,5.3-.88,10.68-.88,16.14s.31,11.15,.93,16.59c4.28,38.09,23.14,71.61,50.66,94.52,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47h0c17.99,0,34.61-5.93,48.16-15.97,16.29-11.58,28.88-28.54,34.48-47.75v50.26h-.11v11.08c0,21.84-5.71,38.27-17.34,49.36-11.61,11.08-31.04,16.63-58.25,16.63-11.12,0-28.79-.59-46.6-2.41-2.83-.29-5.46,1.5-6.27,4.22l-12.78,43.11c-1.02,3.46,1.27,7.02,4.83,7.53,21.52,3.08,42.52,4.68,54.65,4.68,48.91,0,85.16-10.75,108.89-32.21,21.48-19.41,33.15-48.89,35.2-88.52V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,64.1s.65,139.13,0,143.36c-12.08,9.77-27.11,13.59-43.49,14.7-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-1.32,0-2.63-.03-3.94-.1-40.41-2.11-74.52-37.26-74.52-79.38,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33Z" />
+ <path d="M249.83,0C113.3,0,2,110.09,.03,246.16c-2,138.19,110.12,252.7,248.33,253.5,42.68,.25,83.79-10.19,120.3-30.03,3.56-1.93,4.11-6.83,1.08-9.51l-23.38-20.72c-4.75-4.21-11.51-5.4-17.36-2.92-25.48,10.84-53.17,16.38-81.71,16.03-111.68-1.37-201.91-94.29-200.13-205.96,1.76-110.26,92-199.41,202.67-199.41h202.69V407.41l-115-102.18c-3.72-3.31-9.42-2.66-12.42,1.31-18.46,24.44-48.53,39.64-81.93,37.34-46.33-3.2-83.87-40.5-87.34-86.81-4.15-55.24,39.63-101.52,94-101.52,49.18,0,89.68,37.85,93.91,85.95,.38,4.28,2.31,8.27,5.52,11.12l29.95,26.55c3.4,3.01,8.79,1.17,9.63-3.3,2.16-11.55,2.92-23.58,2.07-35.92-4.82-70.34-61.8-126.93-132.17-131.26-80.68-4.97-148.13,58.14-150.27,137.25-2.09,77.1,61.08,143.56,138.19,145.26,32.19,.71,62.03-9.41,86.14-26.95l150.26,133.2c6.44,5.71,16.61,1.14,16.61-7.47V9.48C499.66,4.25,495.42,0,490.18,0H249.83Z" />
+ </svg>
+ </a>
+ </footer>
+ );
+}
+
+export function SearchContent({ onClick }: { onClick: OnClick }) {
+ return (
+ <SearchBoxContextProvider>
+ <Topbar />
+ <ScrollArea className="max-h h-[50vh] xl:max-h-[40vh]">
+ <Results onClick={onClick} />
+ <ScrollBar className="z-30" />
+ </ScrollArea>
+ <Footer />
+ </SearchBoxContextProvider>
+ );
+}
diff --git a/apps/web/src/components/search/search-provider.tsx b/apps/web/src/components/search/search-provider.tsx
new file mode 100644
index 00000000..481ce380
--- /dev/null
+++ b/apps/web/src/components/search/search-provider.tsx
@@ -0,0 +1,46 @@
+import * as React from 'react';
+
+import type { Challenge } from '@repo/db/types';
+import algoliasearch from 'algoliasearch/lite';
+import { useHits, useInstantSearch, useSearchBox } from 'react-instantsearch';
+import { InstantSearchNext } from 'react-instantsearch-nextjs';
+
+const searchClient = algoliasearch(
+ // eslint-disable-next-line @typescript-eslint/dot-notation
+ process.env['NEXT_PUBLIC_ALGOLIA_APP_ID'],
+ // eslint-disable-next-line @typescript-eslint/dot-notation
+ process.env['NEXT_PUBLIC_ALGOLIA_API_KEY'],
+);
+
+const INDEX_NAME = 'typehero';
+
+export function SearchProvider({ children }: { children: React.ReactNode }) {
+ return (
+ <InstantSearchNext searchClient={searchClient} indexName={INDEX_NAME}>
+ {children}
+ </InstantSearchNext>
+ );
+}
+
+export function useSearchStatus() {
+ const { status } = useInstantSearch();
+ return { status };
+}
+
+export function useSearchResult() {
+ const { hits, results } = useHits<Challenge>();
+ const query = results?.query;
+
+ return { results: hits, query };
+}
+export type Result = ReturnType<typeof useSearchResult>['results'][number];
+
+export function useSearchProviderInput() {
+ const { query, refine } = useSearchBox();
+
+ const update = (newQuery: string) => {
+ refine(newQuery);
+ };
+
+ return { query, update };
+}
diff --git a/apps/web/src/components/search/search.tsx b/apps/web/src/components/search/search.tsx
new file mode 100644
index 00000000..e62e1cbe
--- /dev/null
+++ b/apps/web/src/components/search/search.tsx
@@ -0,0 +1,51 @@
+'use client';
+
+import * as React from 'react';
+import { Button } from '@repo/ui/components/button';
+import { Dialog, DialogContent, DialogTrigger } from '@repo/ui/components/dialog';
+import { SearchProvider } from './search-provider';
+import { SearchContent } from './search-content';
+
+export function Search() {
+ const [open, setOpen] = React.useState(false);
+
+ React.useEffect(() => {
+ const down = (e: KeyboardEvent) => {
+ if (e.key === 'k' && (e.metaKey || e.ctrlKey)) {
+ e.preventDefault();
+ setOpen((open) => !open);
+ }
+ };
+
+ document.addEventListener('keydown', down);
+ return () => document.removeEventListener('keydown', down);
+ }, []);
+
+ return (
+ <Dialog open={open} onOpenChange={setOpen}>
+ <DialogTrigger asChild>
+ <Button
+ variant="outline"
+ className="text-muted-foreground w-30 group relative justify-start text-sm sm:pr-12 md:w-40 lg:w-64"
+ onClick={() => setOpen(true)}
+ >
+ <span className="sm:hidden">Search</span>
+ <span className="hidden w-20 truncate text-left sm:inline-block md:w-full">
+ Search Challenges...
+ </span>
+ <kbd className="bg-muted dark:group-hover:bg-muted-foreground top-50% pointer-events-none absolute right-1.5 hidden h-5 select-none items-center gap-1 rounded border px-1.5 font-mono text-[10px] font-medium opacity-100 sm:flex">
+ <span className="text-xs">⌘</span>K
+ </kbd>
+ </Button>
+ </DialogTrigger>
+ <SearchProvider>
+ <DialogContent
+ className="max-h-[80vh] max-w-full gap-0 overflow-hidden rounded-sm p-0 sm:rounded-sm md:max-w-[75vw] lg:max-w-[60vw] xl:max-h-[60vh]"
+ displayX={false}
+ >
+ <SearchContent onClick={() => setOpen(false)} />
+ </DialogContent>
+ </SearchProvider>
+ </Dialog>
+ );
+}
diff --git a/apps/web/src/components/search/searchbox.context.tsx b/apps/web/src/components/search/searchbox.context.tsx
new file mode 100644
index 00000000..b581bb81
--- /dev/null
+++ b/apps/web/src/components/search/searchbox.context.tsx
@@ -0,0 +1,47 @@
+import { debounce } from 'lodash';
+import * as React from 'react';
+import { useSearchProviderInput } from './search-provider';
+
+interface SearchBoxContext {
+ query: string;
+ setQuery: (query: string) => void;
+}
+
+const searchBoxContext = React.createContext({} as SearchBoxContext);
+
+export function SearchBoxContextProvider({ children }: { children: React.ReactNode }) {
+ const { query, update } = useSearchProviderInput();
+ const [inputValue, setInputValue] = React.useState(query);
+ const debouncedRefine = React.useRef(
+ debounce((newQuery: string) => update(newQuery), 300),
+ ).current;
+
+ const setQuery = React.useCallback(
+ (newQuery: string) => {
+ setInputValue(newQuery);
+ debouncedRefine(newQuery);
+ },
+ [debouncedRefine],
+ );
+
+ return (
+ <searchBoxContext.Provider
+ value={{
+ query: inputValue,
+ setQuery,
+ }}
+ >
+ {children}
+ </searchBoxContext.Provider>
+ );
+}
+
+export function useSearchBox() {
+ const ctx = React.useContext(searchBoxContext);
+
+ if (!ctx) {
+ throw new Error('useSearch must be used within SearchContextProvider');
+ }
+
+ return ctx;
+}
diff --git a/apps/web/src/components/search/use-recent-searches-storage.tsx b/apps/web/src/components/search/use-recent-searches-storage.tsx
new file mode 100644
index 00000000..0e7cb608
--- /dev/null
+++ b/apps/web/src/components/search/use-recent-searches-storage.tsx
@@ -0,0 +1,48 @@
+import { useLocalStorage } from '~/utils/useLocalStorage';
+
+const SEARCH_LOCAL_STORAGE_KEY = '__TYPEHERO_SEARCH__';
+
+interface UseRecentSearchesStorageProps<Item extends { id: number | string }> {
+ limit?: number;
+}
+
+export function useRecentSearchesStorage<Item extends { id: number | string }>({
+ limit = 5,
+}: UseRecentSearchesStorageProps<Item> = {}) {
+ const [storage, setStorage] = useLocalStorage(SEARCH_LOCAL_STORAGE_KEY, '[]');
+
+ const getItems = () => {
+ return JSON.parse(storage) as Item[];
+ };
+
+ return {
+ getItems,
+ onAdd(item: Item) {
+ try {
+ const items = getItems();
+ const exists = items.some((i) => i.id === item.id);
+
+ if (exists) {
+ return;
+ }
+
+ if (items.length >= limit) {
+ items.pop();
+ }
+
+ setStorage(JSON.stringify([item, ...items]));
+ } catch (error) {
+ console.error(error);
+ }
+ },
+ onRemove(item: Item['id']) {
+ try {
+ const items = getItems();
+ const newItems = items.filter((i) => i.id !== item);
+ setStorage(JSON.stringify(newItems));
+ } catch (error) {
+ console.error(error);
+ }
+ },
+ };
+}
diff --git a/packages/ui/src/icons.ts b/packages/ui/src/icons.ts
index 5ebc2730..227943d0 100644
--- a/packages/ui/src/icons.ts
+++ b/packages/ui/src/icons.ts
@@ -72,4 +72,5 @@ export {
History,
ArrowLeft,
RectangleVertical,
+ SearchIcon,
} from 'lucide-react';
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 2c92652c..ad05bed8 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -291,6 +291,9 @@ importers:
'@vercel/toolbar':
specifier: ^0.1.1
version: 0.1.1(patch_hash=mukejyv3x4f3mriytfjb3reaxi)([email protected])
+ algoliasearch:
+ specifier: ^4.20.0
+ version: 4.20.0
bad-words:
specifier: ^3.0.4
version: 3.0.4
@@ -345,6 +348,12 @@ importers:
react-hook-form:
specifier: ^7.45.1
version: 7.45.1([email protected])
+ react-instantsearch:
+ specifier: ^7.3.0
+ react-instantsearch-nextjs:
+ specifier: ^0.1.5
react-intersection-observer:
specifier: ^9.5.2
version: 9.5.2([email protected])
@@ -730,7 +739,7 @@ importers:
dependencies:
'@next/eslint-plugin-next':
specifier: canary
- version: 13.4.20-canary.0
+ version: 14.0.4-canary.42
'@repo/tsconfig':
specifier: workspace:*
version: link:../config-typescript
@@ -742,7 +751,7 @@ importers:
'@vercel/style-guide':
specifier: ^4.0.2
eslint:
specifier: ^8.45.0
version: 8.45.0
@@ -810,6 +819,111 @@ packages:
resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==}
engines: {node: '>=0.10.0'}
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-uujahcBt4DxduBTvYdwO3sBfHuJvJokiC3BP1+O70fglmE1ShkH8lpXqZBac1rrU3FnNYSUs4pL9lBdTKeRPOQ==}
+ dependencies:
+ '@algolia/cache-common': 4.20.0
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-vCfxauaZutL3NImzB2G9LjLt36vKAckc6DhMp05An14kVo8F1Yofb6SIl6U3SaEz8pG2QOB9ptwM5c+zGevwIQ==}
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-Wm9ak/IaacAZXS4mB3+qF/KCoVSBV6aLgIGFEtQtJwjv64g4ePMapORGmCyulCFwfePaRAtcaTbMcJF+voc/bg==}
+ dependencies:
+ '@algolia/cache-common': 4.20.0
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-GGToLQvrwo7am4zVkZTnKa72pheQeez/16sURDWm7Seyz+HUxKi3BM6fthVVPUEBhtJ0reyVtuK9ArmnaKl10Q==}
+ dependencies:
+ '@algolia/client-common': 4.20.0
+ '@algolia/client-search': 4.20.0
+ '@algolia/transporter': 4.20.0
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-EIr+PdFMOallRdBTHHdKI3CstslgLORQG7844Mq84ib5oVFRVASuuPmG4bXBgiDbcsMLUeOC6zRVJhv1KWI0ug==}
+ dependencies:
+ '@algolia/client-common': 4.20.0
+ '@algolia/client-search': 4.20.0
+ '@algolia/requester-common': 4.20.0
+ '@algolia/transporter': 4.20.0
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-P3WgMdEss915p+knMMSd/fwiHRHKvDu4DYRrCRaBrsfFw7EQHon+EbRSm4QisS9NYdxbS04kcvNoavVGthyfqQ==}
+ dependencies:
+ '@algolia/requester-common': 4.20.0
+ '@algolia/transporter': 4.20.0
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-N9+zx0tWOQsLc3K4PVRDV8GUeOLAY0i445En79Pr3zWB+m67V+n/8w4Kw1C5LlbHDDJcyhMMIlqezh6BEk7xAQ==}
+ dependencies:
+ '@algolia/client-common': 4.20.0
+ '@algolia/requester-common': 4.20.0
+ '@algolia/transporter': 4.20.0
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-zgwqnMvhWLdpzKTpd3sGmMlr4c+iS7eyyLGiaO51zDZWGMkpgoNVmltkzdBwxOVXz0RsFMznIxB9zuarUv4TZg==}
+ dependencies:
+ '@algolia/client-common': 4.20.0
+ '@algolia/requester-common': 4.20.0
+ '@algolia/transporter': 4.20.0
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-FQzvOCgoFXAbf5Y6mYozw2aj5KCJoA3m4heImceldzPSMbdyS4atVjJzXKMsfX3wnZTFYwkkt8/z8UesLHlSBQ==}
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-xouigCMB5WJYEwvoWW5XDv7Z9f0A8VoXJc3VKwlHJw/je+3p2RcDXfksLI4G4lIVncFUYMZx30tP/rsdlvvzHQ==}
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-THlIGG1g/FS63z0StQqDhT6bprUczBI8wnLT3JWvfAQDZX5P6fCg7dG+pIrUBpDIHGszgkqYEqECaKKsdNKOUA==}
+ dependencies:
+ '@algolia/logger-common': 4.20.0
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-HbzoSjcjuUmYOkcHECkVTwAelmvTlgs48N6Owt4FnTOQdwn0b8pdht9eMgishvk8+F8bal354nhx/xOoTfwiAw==}
+ dependencies:
+ '@algolia/requester-common': 4.20.0
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-9h6ye6RY/BkfmeJp7Z8gyyeMrmmWsMOCRBXQDs4mZKKsyVlfIVICpcSibbeYcuUdurLhIlrOUkH3rQEgZzonng==}
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-ocJ66L60ABSSTRFnCHIEZpNHv6qTxsBwJEPfYaSBsLQodm0F9ptvalFkHMpvj5DfE22oZrcrLbOYM2bdPJRHng==}
+ dependencies:
+ '@algolia/requester-common': 4.20.0
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-Lsii1pGWOAISbzeyuf+r/GPhvHMPHSPrTDWNcIzOE1SG1inlJHICaVe2ikuoRjcpgxZNU54Jl+if15SUCsaTUg==}
+ dependencies:
+ '@algolia/cache-common': 4.20.0
+ '@algolia/logger-common': 4.20.0
+ '@algolia/requester-common': 4.20.0
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-/+7jh7cd5rR2yQC7ME4SDcnAMiD1Ofn5Qq+E7afTJx9XSMOHkLR77/o6YcuJ60TfD1S+9lr7yjBLACon8gOuzQ==}
+ dependencies:
+ '@algolia/ui-components-shared': 1.2.2
+ '@babel/runtime': 7.22.6
+ dev: false
+
+ /@algolia/[email protected]:
+ resolution: {integrity: sha512-FYwEG5sbr8p4V8mqP0iUaKgmWfcrMXRXwp7e6iBuB65P/7QyL8pT4I6/iGb85Q5mNH+UtYYSmLZhKjEblllKEQ==}
+ dev: false
+
resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==}
engines: {node: '>=10'}
@@ -2347,8 +2461,8 @@ packages:
glob: 7.1.7
dev: true
- resolution: {integrity: sha512-vFC1meiw/awh2xJZMWaoECsfZbgkt2fF3HIg8f2fSM/w41Z86L1SS7SjKmpbbD87yq3tiqgqHmFv0JCych4g4g==}
+ resolution: {integrity: sha512-+Ra4gKjzmdpe5QraVqoMxLLq9eomi3m23NJnmKyRp/1AeFJyCUysHv98tuko8An7pYEhp9jKnK3u9YhZN7K1mg==}
dependencies:
glob: 7.1.7
dev: false
@@ -4652,6 +4766,10 @@ packages:
'@types/ms': 0.7.31
dev: false
+ resolution: {integrity: sha512-udCxb8DvjcDKfk1WTBzDsxFbLgYxmQGKrE/ricoMqHRNjSlSUCcamVTA5lIQqzY10mY5qCY0QDwBfFEwhfoDPw==}
+ dev: false
+
resolution: {integrity: sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==}
dependencies:
@@ -4667,6 +4785,10 @@ packages:
resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==}
+ resolution: {integrity: sha512-N6gwM01mKhooXaw+IKbUH7wJcIJCn8U60VoaVvom5EiQjmfgevhQ+0+/r17beXW5j8ad2x+WPr0iyOUodCw4/w==}
+ dev: false
+
resolution: {integrity: sha512-SvQi0L/lNpThgPoleH53cdjB3y9zpLlVjRbqB3rH8hx1jiRSBGAhyjV3H+URFjNVRqt2EdYNrbZE5IsGlNfpRg==}
dependencies:
@@ -4679,6 +4801,10 @@ packages:
'@types/unist': 3.0.0
dev: false
+ resolution: {integrity: sha512-/uRaY3HGPWyLqOyhgvW9Aa43BNnLZrNeQxl2p8wqId4UHMfPKolSB+U7BlZyO1ng7MkLnyEAItsBzCG0SDhqrA==}
+ dev: false
+
resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==}
@@ -4748,6 +4874,10 @@ packages:
resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==}
+ resolution: {integrity: sha512-3Gnx08Ns1sEoCrWssEgTSJs/rsT2vhGP+Ja9cnnk9k4ALxinORlQneLXFeFKOTJMOeZUFD1s7w+w2AphTpvzZw==}
+ dev: false
+
resolution: {integrity: sha512-GRaAEriuT4zp9N4p1i8BDBYmEyfo+xQ3yHjJU4eiK5NDa1RmUZG+unZABUTK4/Ox/M+GaHwb6Ow8rUITrtjszA==}
dependencies:
@@ -5063,7 +5193,7 @@ packages:
yoga-wasm-web: 0.3.0
dev: false
resolution: {integrity: sha512-FroL+oOePzhw7n/I+f7zr4WNroGHT/+2TlW6WH9+CVSjMNsEyu7Qstj2mI5gWIBjT1Y2ZImKPppCzI2cIYmNZw==}
engines: {node: '>=16'}
peerDependencies:
@@ -5083,7 +5213,7 @@ packages:
dependencies:
'@babel/core': 7.22.10
'@babel/eslint-parser': 7.22.10(@babel/[email protected])([email protected])
- '@next/eslint-plugin-next': 13.4.20-canary.0
+ '@next/eslint-plugin-next': 14.0.4-canary.42
'@rushstack/eslint-patch': 1.3.2
'@typescript-eslint/eslint-plugin': 5.59.1(@typescript-eslint/[email protected])([email protected])([email protected])
'@typescript-eslint/parser': 5.62.0([email protected])([email protected])
@@ -5347,6 +5477,34 @@ packages:
uri-js: 4.4.1
dev: true
+ resolution: {integrity: sha512-DGUnK3TGtDQsaUE4ayF/LjSN0DGsuYThB8WBgnnDY0Wq04K6lNVruO3LfqJOgSfDiezp+Iyt8Tj4YKHi+/ivSA==}
+ peerDependencies:
+ algoliasearch: '>= 3.1 < 6'
+ dependencies:
+ '@algolia/events': 4.0.1
+ algoliasearch: 4.20.0
+ dev: false
+
+ resolution: {integrity: sha512-y+UHEjnOItoNy0bYO+WWmLWBlPwDjKHW6mNHrPi0NkuhpQOOEbrkwQH/wgKFDLh7qlKjzoKeiRtlpewDPDG23g==}
+ dependencies:
+ '@algolia/cache-browser-local-storage': 4.20.0
+ '@algolia/cache-common': 4.20.0
+ '@algolia/cache-in-memory': 4.20.0
+ '@algolia/client-account': 4.20.0
+ '@algolia/client-analytics': 4.20.0
+ '@algolia/client-common': 4.20.0
+ '@algolia/client-personalization': 4.20.0
+ '@algolia/client-search': 4.20.0
+ '@algolia/logger-common': 4.20.0
+ '@algolia/logger-console': 4.20.0
+ '@algolia/requester-browser-xhr': 4.20.0
+ '@algolia/requester-common': 4.20.0
+ '@algolia/requester-node-http': 4.20.0
+ '@algolia/transporter': 4.20.0
+ dev: false
+
resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
engines: {node: '>=8'}
@@ -8221,6 +8379,14 @@ packages:
resolution: {integrity: sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==}
dev: false
+ resolution: {integrity: sha512-RqGs4wavGYJWE07t35JQccByczmNUXQT0E12ZYV1VKYu5UiAU9lsos/yBAcf840+zrUQQxgVduCR5/B8nNtibg==}
+ hasBin: true
+ dependencies:
+ mkdirp: 0.3.0
+ nopt: 1.0.10
+ dev: false
+
resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==}
dependencies:
@@ -8231,6 +8397,10 @@ packages:
resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==}
dev: false
+ resolution: {integrity: sha512-983Vyg8NwUE7JkZ6NmOqpCZ+sh1bKv2iYTlUkzlWmA5JD2acKoxd4KVxbMmxX/85mtfdnDmTFoNKcg5DGAvxNQ==}
+ dev: false
+
resolution: {integrity: sha512-fI0yyNlIeSboxU+jnrA4v8qj4+M8SI9/q6AKYdwCY2qki22UtKCDTxvagHniECu7sa5/o2zFRdLleA67035lsA==}
dependencies:
@@ -8358,6 +8528,27 @@ packages:
resolution: {integrity: sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==}
dev: false
+ resolution: {integrity: sha512-u/xeCT1DaxPioJnSm3hV4lNAojlhbjGrpX5fHO6+RJjpDFv/MgYxiIOdaIRowmt5F0v/3QCm+Un5f4jy1/+emA==}
+ peerDependencies:
+ algoliasearch: '>= 3.1 < 6'
+ dependencies:
+ '@algolia/events': 4.0.1
+ '@algolia/ui-components-highlight-vdom': 1.2.2
+ '@algolia/ui-components-shared': 1.2.2
+ '@types/dom-speech-recognition': 0.0.1
+ '@types/google.maps': 3.54.10
+ '@types/hogan.js': 3.0.5
+ '@types/qs': 6.9.10
+ algoliasearch: 4.20.0
+ algoliasearch-helper: 3.15.0([email protected])
+ hogan.js: 3.0.2
+ htm: 3.1.1
+ preact: 10.16.0
+ qs: 6.9.7
+ search-insights: 2.11.0
+ dev: false
+
resolution: {integrity: sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==}
engines: {node: '>= 0.4'}
@@ -9549,6 +9740,11 @@ packages:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
+ resolution: {integrity: sha512-OHsdUcVAQ6pOtg5JYWpCBo9W/GySVuwvP9hueRMW7UqshC0tbfzLv8wjySTPm3tfUZ/21CE9E1pJagOA91Pxew==}
+ deprecated: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
+ dev: false
+
resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==}
hasBin: true
@@ -9757,6 +9953,13 @@ packages:
resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==}
+ resolution: {integrity: sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==}
+ hasBin: true
+ dependencies:
+ abbrev: 1.1.1
+ dev: false
+
resolution: {integrity: sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==}
engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
@@ -10507,6 +10710,11 @@ packages:
side-channel: 1.0.4
dev: false
+ resolution: {integrity: sha512-IhMFgUmuNpyRfxA90umL7ByLlgRXu6tIfKPpF5TmcfRLlLCckfP/g3IQmju6jjpu+Hh8rA+2p6A27ZSPOOHdKw==}
+ engines: {node: '>=0.6'}
+ dev: false
+
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
@@ -10633,6 +10841,45 @@ packages:
react: 18.2.0
dev: false
+ resolution: {integrity: sha512-v66mG+Io/Mmd5LQaoQXxGD/acHnLIM1Cq/uzlcC0VbFji7JXoJhChRPUcA+z5fGDaidBxdJOPRtQjJpTQ+/h8g==}
+ peerDependencies:
+ algoliasearch: '>= 3.1 < 5'
+ react: '>= 16.8.0 < 19'
+ dependencies:
+ '@babel/runtime': 7.22.6
+ algoliasearch: 4.20.0
+ algoliasearch-helper: 3.15.0([email protected])
+ instantsearch.js: 4.60.0([email protected])
+ react: 18.2.0
+ use-sync-external-store: 1.2.0([email protected])
+ dev: false
+
+ resolution: {integrity: sha512-PP740tSDNN9wPb8Kva2QAnjI8gtsVnErtZV9kDR2M7DmSM2USJ0GqDis/UBWk2bx5oAA2I1mz1LtM7uGI+URyQ==}
+ peerDependencies:
+ next: '>= 13.4 && < 15'
+ react-instantsearch: '>= 7.1.0 && < 8'
+ dependencies:
+ dev: false
+
+ resolution: {integrity: sha512-X0ZKDMP7DDKkRqnM99JbpsqASXDBVCUSpEYmPPhDx/PFGUzOu9yAFNCBkpJxfIf2A3nL/Z1QQDXuUYRdBgVCsg==}
+ peerDependencies:
+ algoliasearch: '>= 3.1 < 5'
+ react: '>= 16.8.0 < 19'
+ react-dom: '>= 16.8.0 < 19'
+ dependencies:
+ '@babel/runtime': 7.22.6
+ algoliasearch: 4.20.0
+ instantsearch.js: 4.60.0([email protected])
+ react: 18.2.0
+ react-dom: 18.2.0([email protected])
+ react-instantsearch-core: 7.3.0([email protected])([email protected])
+ dev: false
+
resolution: {integrity: sha512-EmoV66/yvksJcGa1rdW0nDNc4I1RifDWkT50gXSFnPLYQ4xUptuDD4V7k+Rj1OgVAlww628KLGcxPXFlOkkU/Q==}
peerDependencies:
@@ -11234,6 +11481,10 @@ packages:
ajv: 6.12.6
ajv-keywords: 3.5.2([email protected])
+ resolution: {integrity: sha512-Uin2J8Bpm3xaZi9Y8QibSys6uJOFZ+REMrf42v20AA3FUDUrshKkMEP6liJbMAHCm71wO6ls4mwAf7a3gFVxLw==}
+ dev: false
+
resolution: {integrity: sha512-DEL/RW/f4qLw/NrVg97xKaEBC8IpzIG2fvxnzCp3Z4yk4jQ3MXom+Imav9wApjxX2dfS3eW7x0DXafJr85i39A==}
dependencies:
diff --git a/turbo.json b/turbo.json
index 24e3dbbf..d08c93a2 100644
--- a/turbo.json
+++ b/turbo.json
@@ -1,5 +1,6 @@
{
"experimentalSpaces": { "id": "space_CWwpUyi1jEpIayj8iSDdz2Ze" },
+ "globalEnv": ["NEXT_PUBLIC_ALGOLIA_APP_ID", "NEXT_PUBLIC_ALGOLIA_API_KEY"],
"pipeline": {
"build": {
"dependsOn": ["^build", "@repo/db#db:generate"],
@@ -26,7 +27,9 @@
"CI",
"MAILCHIMP_API_KEY",
"MAILCHIMP_AUDIENCE_ID",
- "MAILCHIMP_API_SERVER"
+ "MAILCHIMP_API_SERVER",
+ "NEXT_PUBLIC_ALGOLIA_API_KEY",
+ "NEXT_PUBLIC_ALGOLIA_APP_ID"
]
},
"topo": {