diff --git a/app/src/app/new/page.tsx b/app/src/app/new/page.tsx index 749ec1e..8c69326 100644 --- a/app/src/app/new/page.tsx +++ b/app/src/app/new/page.tsx @@ -1,3 +1,4 @@ +import NavigateBack from "@/components/NavigateBack"; import RecorderCard from "@/components/RecorderCard"; import { Metadata } from "next"; @@ -7,8 +8,13 @@ export const metadata: Metadata = { const page = () => { return ( -
- +
+
+ +
+
+ +
); }; diff --git a/app/src/app/register/page.tsx b/app/src/app/register/page.tsx index 683ef1f..f88c27c 100644 --- a/app/src/app/register/page.tsx +++ b/app/src/app/register/page.tsx @@ -1,3 +1,4 @@ +import NavigateBack from "@/components/NavigateBack"; import RegisterForm from "@/components/RegisterForm"; import { Metadata } from "next"; @@ -8,10 +9,15 @@ export const metadata: Metadata = { const page = async () => { return ( -
- +
+
+ +
+
+ +
); }; -export default page; +export default page; \ No newline at end of file diff --git a/app/src/app/transcriptions/[transcription_id]/page.tsx b/app/src/app/transcriptions/[transcription_id]/page.tsx index 41d5972..bdc3cd4 100644 --- a/app/src/app/transcriptions/[transcription_id]/page.tsx +++ b/app/src/app/transcriptions/[transcription_id]/page.tsx @@ -1,6 +1,7 @@ // transcriptions / [transcription_id] / page.tsx import DetailedTranscription from "@/components/DetailedTranscription"; +import NavigateBack from "@/components/NavigateBack"; import { db } from "@/db"; import { transcriptions } from "@/db/schema"; import { eq } from "drizzle-orm"; @@ -26,10 +27,16 @@ const page = async (props: PageProps) => { .where(eq(transcriptions.id, transcription_id)); return ( -
- {transcription.length > 0 && ( - - )} + +
+
+ +
+
+ {transcription.length > 0 && ( + + )} +
); }; diff --git a/app/src/app/transcriptions/page.tsx b/app/src/app/transcriptions/page.tsx index 3fb6ad9..99b53b1 100644 --- a/app/src/app/transcriptions/page.tsx +++ b/app/src/app/transcriptions/page.tsx @@ -1,3 +1,4 @@ +import NavigateBack from "@/components/NavigateBack"; import TranscriptionItem from "@/components/TranscriptionItem"; import { db } from "@/db"; import { transcriptions } from "@/db/schema"; @@ -26,11 +27,16 @@ const page = async () => { .orderBy(desc(transcriptions.createdAt)); return ( -
-
- {userTranscriptions.map((transcription, idx) => ( - - ))} +
+
+ +
+
+
+ {userTranscriptions.map((transcription, idx) => ( + + ))} +
); diff --git a/app/src/components/NavigateBack.tsx b/app/src/components/NavigateBack.tsx new file mode 100644 index 0000000..0616c8a --- /dev/null +++ b/app/src/components/NavigateBack.tsx @@ -0,0 +1,31 @@ +'use client' + +import { useRouter } from "next/navigation" +import { Button } from "./ui/button" +import { ArrowLeftIcon } from "lucide-react" + +interface NavigateBackProps { + href?: string + subHeading?: string +} + +const NavigateBack = (props: NavigateBackProps) => { + const { href, subHeading } = props + const router = useRouter() + + const handleBack = () => { + href ? router.push(href) : router.back() + } + + return ( +
+ + {subHeading &&
{subHeading}
} +
+ ) +} + +export default NavigateBack \ No newline at end of file diff --git a/app/src/components/RegisterForm.tsx b/app/src/components/RegisterForm.tsx index 14c9ebe..9113c39 100644 --- a/app/src/components/RegisterForm.tsx +++ b/app/src/components/RegisterForm.tsx @@ -19,10 +19,11 @@ import { useMutation } from "@tanstack/react-query"; import axios, { AxiosError } from "axios"; import { toast } from "sonner"; import { useRouter } from "next/navigation"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; const RegisterForm = () => { const router = useRouter(); + const [isPersistingUser,setIsPersistingUser] = useState(false); useEffect(() => { if (typeof window !== "undefined" && localStorage.getItem("user")) { @@ -51,6 +52,7 @@ const RegisterForm = () => { } form.reset(); router.push("/new"); + setIsPersistingUser(false); }, onError: (error) => { if (error instanceof AxiosError) { @@ -67,6 +69,7 @@ const RegisterForm = () => { }); const onSubmit = (data: RegisterUserRequest) => { + setIsPersistingUser(true); mutate(data); }; @@ -110,7 +113,8 @@ const RegisterForm = () => { />