diff --git a/bun.lockb b/bun.lockb index f295bb2..c35e0ae 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index d62caca..b10bea3 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "db:migrate": "drizzle-kit migrate", "db:push": "drizzle-kit push", "db:studio": "drizzle-kit studio", - "dev": "next dev --turbo", + "dev": "next dev", "lint": "next lint", "start": "next start" }, @@ -29,7 +29,7 @@ "@tanstack/eslint-plugin-query": "^5.43.1", "@tanstack/react-query": "^5.45.0", "@tanstack/react-table": "^8.19.2", - "@vercel/postgres": "^0.9.0", + "@vercel/postgres": "^0.8.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "drizzle-orm": "^0.31.2", @@ -67,11 +67,8 @@ "ct3aMetadata": { "initVersion": "7.34.0" }, - "packageManager": "pnpm@9.4.0", "trustedDependencies": [ "@clerk/shared", - "bufferutil", - "canvas", "esbuild", "utf-8-validate" ] diff --git a/src/app/@modal/(.)whishper/recording/[name]/page.tsx b/src/app/@modal/(.)whishper/recording/[name]/page.tsx index c80345b..dc0a6cb 100644 --- a/src/app/@modal/(.)whishper/recording/[name]/page.tsx +++ b/src/app/@modal/(.)whishper/recording/[name]/page.tsx @@ -1,13 +1,14 @@ import { Modal } from "@/app/@modal/(.)paperless/document/[id]/modal"; +import AudioPreview from "@/components/audio-preview"; export default function ModalAudioPreview({ params, }: { - params: { id: number }; + params: { name: string }; }) { return ( -
Test
+
); } diff --git a/src/app/actions.ts b/src/app/actions.ts index 654e94f..c229080 100644 --- a/src/app/actions.ts +++ b/src/app/actions.ts @@ -40,9 +40,7 @@ export async function setUserProperty( export async function getUserData() { const { userId } = auth(); - if (!userId) { - return null; - } + if (!userId) return null; const userData = await db.query.users.findFirst({ where: (model, { eq }) => eq(model.userId, userId), diff --git a/src/app/page.tsx b/src/app/page.tsx index 3a6b813..a39c3c9 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,7 +1,8 @@ import OpenExternalLink from "@/components/external-link"; -import Link from "next/link"; +import { getUserData } from "./actions"; + +export default async function HomePage() { -export default function HomePage() { return (
@@ -14,7 +15,6 @@ export default function HomePage() { to get started.
Or sign in to access the dashboard.
- testing
); diff --git a/src/app/whishper/page.tsx b/src/app/whishper/page.tsx index 5deeebe..0bf6164 100644 --- a/src/app/whishper/page.tsx +++ b/src/app/whishper/page.tsx @@ -192,7 +192,11 @@ function RecordingsList() { return ( <>

Search Results

- + ); } @@ -200,11 +204,13 @@ function RecordingsList() { interface DataTableProps { data: TData[]; userData: UsersTableType; + query: string; } function DataTable({ data, userData, + query, }: DataTableProps) { const columns: ColumnDef[] = [ { @@ -215,7 +221,9 @@ function DataTable({ }, header: "Name", cell: ({ getValue, row }) => ( - + {getValue() as string} ), diff --git a/src/components/audio-preview.tsx b/src/components/audio-preview.tsx index b38091b..097be07 100644 --- a/src/components/audio-preview.tsx +++ b/src/components/audio-preview.tsx @@ -6,11 +6,15 @@ import { QueryClientProvider, QueryClient, } from "@tanstack/react-query"; +import LoadingSpinner from "./loading-spinner"; +import { UsersTableType } from "@/server/db/schema"; const queryClient = new QueryClient(); -async function getRecording(name: string) { - const userData = await getUserData(); +async function getRecording( + name: string, + userData: UsersTableType, +): Promise { if (!userData) { console.error("Error getting user data"); return null; @@ -19,9 +23,13 @@ async function getRecording(name: string) { try { const url = `${userData.whishperURL}/api/documents/${name}/download/`; const response = await fetch(url); + console.log(response); if (response.ok) { const blob = await response.blob(); return URL.createObjectURL(blob); + } else { + console.error("Failed to fetch recording"); + return null; } } catch (error) { console.error("An error occurred:", error); @@ -29,21 +37,32 @@ async function getRecording(name: string) { } } -function AudioPreview(props: { name: string }) { - const { data: url, isLoading } = useQuery({ +function Player(props: { name: string }) { + const user = useQuery({ queryKey: ["audioURL", props.name], queryFn: async () => { - return getRecording(props.name); + return getUserData; }, }); - return

{url}

; + const url = useQuery({ + queryKey: ["audioURL", props.name], + queryFn: async () => { + return getRecording(props.name, user.data); + }, + }); + + if (user.isLoading ?? url.isLoading) { + return Loading ...; + } + + return

{url.data}

; } -export default function Page(props: { name: string }) { +export default function AudioPreview(props: { name: string }) { return ( - + ); }