diff --git a/src/app/whishper/page.tsx b/src/app/whishper/page.tsx index 401095a..a757f36 100644 --- a/src/app/whishper/page.tsx +++ b/src/app/whishper/page.tsx @@ -3,7 +3,7 @@ import { SignedIn, SignedOut } from "@clerk/nextjs"; import { usePathname, useRouter, useSearchParams } from "next/navigation"; import { useForm } from "react-hook-form"; -import { z } from "zod"; +import { array, z } from "zod"; import { Button } from "@/components/ui/button"; import { Form, @@ -24,7 +24,11 @@ import { } from "@tanstack/react-query"; import { getUserData } from "../actions"; import LoadingSpinner from "@/components/loading-spinner"; -import { WhishperRecordingsType } from "@/types"; +import type { WhishperRecordingsType } from "@/types"; +import OpenInternalLink from "@/components/internal-link"; +import OpenExternalLInk from "@/components/external-link"; + +const queryClient = new QueryClient(); async function getWhishperRecordings(query: string) { const userData = await getUserData(); @@ -34,14 +38,14 @@ async function getWhishperRecordings(query: string) { const response = await fetch(`${userData.whishperURL}/api/transcriptions`); const data = (await response.json()) as WhishperRecordingsType; - - console.log(data); - - return data; + const lowerCaseQuery = query.toLowerCase(); + return data.filter( + (item) => + item.fileName.toLowerCase().includes(lowerCaseQuery) || + item.result.text.toLowerCase().includes(lowerCaseQuery), + ); } -const queryClient = new QueryClient(); - function SearchForm() { const formSchema = z.object({ query: z.string().min(3).max(256), @@ -121,6 +125,10 @@ function RecordingsList() { }, }); + if (!query) { + return