diff --git a/Frontend/app/(authenticated)/account/page.jsx b/Frontend/app/(authenticated)/account/page.jsx new file mode 100644 index 0000000..2fab39f --- /dev/null +++ b/Frontend/app/(authenticated)/account/page.jsx @@ -0,0 +1,36 @@ +import React from "react" +import PageHeader from "@/sections/PageHeader" +import { cookies } from "next/headers" +import { getUserFromCookie } from "@/lib/auth" +import AccountContent from "@/sections/AccountContent" +import { redirect } from "next/navigation" +import pb from "@/lib/pocketbase" +import Background from "@/components/Utilities/Background" +import Footer from "@/components/Footer" +import Spacer from "@/components/Utilities/Spacer" + +export default async function AccountPage() { + const user = await getUserFromCookie(cookies()) + const cookie = cookies().get("pb_auth") + //server side + pb.authStore.loadFromCookie(cookie?.value || "") + !pb.authStore.isValid && redirect("/") + return ( + user && ( +
+ +
+ } /> + {/* */} + +
+
+
+ ) + ) +} diff --git a/Frontend/app/(authenticated)/account/page.tsx b/Frontend/app/(authenticated)/account/page.tsx deleted file mode 100644 index 7f572f1..0000000 --- a/Frontend/app/(authenticated)/account/page.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React from "react"; -import PageHeader from "@/sections/PageHeader"; -import { cookies } from "next/headers"; -import { getUserFromCookie } from "@/lib/auth"; -import { User } from "@/types"; -import AccountContent from "@/sections/AccountContent"; -import { redirect } from "next/navigation"; -import pb from "@/lib/pocketbase"; -import Background from "@/components/Utilities/Background"; -import Footer from "@/components/Footer"; -import Spacer from "@/components/Utilities/Spacer"; - -export default async function AccountPage() { - const user = (await getUserFromCookie(cookies())) as User; - const cookie = cookies().get("pb_auth"); - //server side - pb.authStore.loadFromCookie(cookie?.value || ""); - !pb.authStore.isValid && redirect("/"); - return ( - user && ( -
- -
- - } /> - - -
-
-
- ) - ); -} diff --git a/Frontend/app/(public)/[ignore]/auth/confirm-email-change/[token]/page.jsx b/Frontend/app/(public)/[ignore]/auth/confirm-email-change/[token]/page.jsx new file mode 100644 index 0000000..4c58fd6 --- /dev/null +++ b/Frontend/app/(public)/[ignore]/auth/confirm-email-change/[token]/page.jsx @@ -0,0 +1,89 @@ +"use client" + +import React from "react" +import { useForm } from "react-hook-form" +import { yupResolver } from "@hookform/resolvers/yup" +import { changeEmailValidationSchema } from "@/utils/form" +import { toast } from "react-toastify" +import PocketBase from "pocketbase" +import PageWrapper from "@/components/Utilities/PageWrapper" +import { usePathname } from "next/navigation" +import Background from "@/components/Utilities/Background" +import PageHeader from "@/sections/PageHeader" + +const pb = new PocketBase(process.env.NEXT_PUBLIC_POCKETBASE_URL) + +export default function ConfirmEmailChangePage() { + const pathName = usePathname() + const token = pathName.split("/").at(-1) + const { + register, + handleSubmit, + formState: { errors, isSubmitting }, + reset + } = useForm({ + resolver: yupResolver(changeEmailValidationSchema) + }) + + const onSubmit = async data => { + try { + await pb.collection("user").confirmEmailChange(token ?? "", data.password) + reset() + document.getElementById("sign-in-modal")?.click() + } catch (error) { + if (error instanceof Error) { + toast.error("There was a problem. Please try change your email again", { + position: "bottom-left", + autoClose: 5000, + hideProgressBar: false, + closeOnClick: true, + pauseOnHover: true, + draggable: true, + progress: undefined, + theme: "colored" + }) + } + } + } + + return ( + + +
+ } + /> +
+
+ +
+ {errors.password?.message}  +
+
+
+ +
+
+
+
+
+ ) +} diff --git a/Frontend/app/(public)/[ignore]/auth/confirm-email-change/[token]/page.tsx b/Frontend/app/(public)/[ignore]/auth/confirm-email-change/[token]/page.tsx deleted file mode 100644 index 9270ca9..0000000 --- a/Frontend/app/(public)/[ignore]/auth/confirm-email-change/[token]/page.tsx +++ /dev/null @@ -1,89 +0,0 @@ -"use client" - -import React from "react"; -import { useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import { changeEmailValidationSchema } from "@/utils/form"; -import { toast } from "react-toastify"; -import PocketBase from 'pocketbase'; -import PageWrapper from "@/components/Utilities/PageWrapper"; -import { usePathname, useRouter } from 'next/navigation'; -import Background from "@/components/Utilities/Background"; -import PageHeader from "@/sections/PageHeader"; - -const pb = new PocketBase(process.env.NEXT_PUBLIC_POCKETBASE_URL as string); - -export default function ConfirmEmailChangePage() { - const pathName = usePathname(); - const token = pathName.split('/').at(-1); - const { - register, - handleSubmit, - formState: { errors, isSubmitting }, - reset - } = useForm({ - resolver: yupResolver(changeEmailValidationSchema), - }); - - const onSubmit = async (data: any) => { - try { - await pb.collection('user').confirmEmailChange( - token ?? "", - data.password, - ); - reset(); - document.getElementById("sign-in-modal")?.click(); - } catch (error) { - if (error instanceof Error) { - toast.error("There was a problem. Please try change your email again", { - position: "bottom-left", - autoClose: 5000, - hideProgressBar: false, - closeOnClick: true, - pauseOnHover: true, - draggable: true, - progress: undefined, - theme: "colored", - }); - } - } - }; - - return ( - - -
- } - /> -
-
- -
- {errors.password?.message}  -
-
-
- -
-
-
-
-
- ); -} diff --git a/Frontend/app/(public)/[ignore]/auth/confirm-password-reset/[token]/page.jsx b/Frontend/app/(public)/[ignore]/auth/confirm-password-reset/[token]/page.jsx new file mode 100644 index 0000000..7399fb4 --- /dev/null +++ b/Frontend/app/(public)/[ignore]/auth/confirm-password-reset/[token]/page.jsx @@ -0,0 +1,108 @@ +"use client" + +import React from "react" +import { useForm } from "react-hook-form" +import { yupResolver } from "@hookform/resolvers/yup" +import { passwordValidationSchema } from "@/utils/form" +import { toast } from "react-toastify" +import PocketBase from "pocketbase" +import PageWrapper from "@/components/Utilities/PageWrapper" +import { usePathname } from "next/navigation" +import Background from "@/components/Utilities/Background" +import PageHeader from "@/sections/PageHeader" + +const pb = new PocketBase(process.env.NEXT_PUBLIC_POCKETBASE_URL) + +export default function ConfirmPasswordResetPage() { + const pathName = usePathname() + const token = pathName.split("/").at(-1) + const { + register, + handleSubmit, + formState: { errors, isSubmitting }, + reset + } = useForm({ + resolver: yupResolver(passwordValidationSchema) + }) + + const onSubmit = async data => { + try { + await pb + .collection("user") + .confirmPasswordReset( + token ?? "", + data.newPassword, + data.newPasswordConfirm + ) + reset() + document.getElementById("sign-in-modal")?.click() + } catch (error) { + if (error instanceof Error) { + toast.error( + "There was a problem. Please try reset your password again", + { + position: "bottom-left", + autoClose: 5000, + hideProgressBar: false, + closeOnClick: true, + pauseOnHover: true, + draggable: true, + progress: undefined, + theme: "colored" + } + ) + } + } + } + + return ( + + +
+ } /> +
+
+ +
+ {errors.newPassword?.message}  +
+
+
+ +
+ {errors.newPasswordConfirm?.message}  +
+
+
+ +
+
+
+
+
+ ) +} diff --git a/Frontend/app/(public)/[ignore]/auth/confirm-password-reset/[token]/page.tsx b/Frontend/app/(public)/[ignore]/auth/confirm-password-reset/[token]/page.tsx deleted file mode 100644 index ef3f365..0000000 --- a/Frontend/app/(public)/[ignore]/auth/confirm-password-reset/[token]/page.tsx +++ /dev/null @@ -1,103 +0,0 @@ -"use client" - -import React from "react"; -import { useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import { passwordValidationSchema } from "@/utils/form"; -import { toast } from "react-toastify"; -import PocketBase from 'pocketbase'; -import PageWrapper from "@/components/Utilities/PageWrapper"; -import { usePathname, useRouter } from 'next/navigation'; -import Background from "@/components/Utilities/Background"; -import PageHeader from "@/sections/PageHeader"; - -const pb = new PocketBase(process.env.NEXT_PUBLIC_POCKETBASE_URL as string); - -export default function ConfirmPasswordResetPage() { - const pathName = usePathname(); - const token = pathName.split('/').at(-1); - const { - register, - handleSubmit, - formState: { errors, isSubmitting }, - reset - } = useForm({ - resolver: yupResolver(passwordValidationSchema), - }); - - const onSubmit = async (data: any) => { - try { - await pb.collection('user').confirmPasswordReset( - token ?? "", - data.newPassword, - data.newPasswordConfirm, - ); - reset() - document.getElementById("sign-in-modal")?.click(); - } catch (error) { - if (error instanceof Error) { - toast.error("There was a problem. Please try reset your password again", { - position: "bottom-left", - autoClose: 5000, - hideProgressBar: false, - closeOnClick: true, - pauseOnHover: true, - draggable: true, - progress: undefined, - theme: "colored", - }); - } - } - }; - - return ( - - -
- } - /> -
-
- -
- {errors.newPassword?.message}  -
-
-
- -
- {errors.newPasswordConfirm?.message}  -
-
-
- -
-
-
-
-
- ); -} diff --git a/Frontend/app/(public)/[ignore]/auth/confirm-verification/[token]/page.jsx b/Frontend/app/(public)/[ignore]/auth/confirm-verification/[token]/page.jsx new file mode 100644 index 0000000..7399fb4 --- /dev/null +++ b/Frontend/app/(public)/[ignore]/auth/confirm-verification/[token]/page.jsx @@ -0,0 +1,108 @@ +"use client" + +import React from "react" +import { useForm } from "react-hook-form" +import { yupResolver } from "@hookform/resolvers/yup" +import { passwordValidationSchema } from "@/utils/form" +import { toast } from "react-toastify" +import PocketBase from "pocketbase" +import PageWrapper from "@/components/Utilities/PageWrapper" +import { usePathname } from "next/navigation" +import Background from "@/components/Utilities/Background" +import PageHeader from "@/sections/PageHeader" + +const pb = new PocketBase(process.env.NEXT_PUBLIC_POCKETBASE_URL) + +export default function ConfirmPasswordResetPage() { + const pathName = usePathname() + const token = pathName.split("/").at(-1) + const { + register, + handleSubmit, + formState: { errors, isSubmitting }, + reset + } = useForm({ + resolver: yupResolver(passwordValidationSchema) + }) + + const onSubmit = async data => { + try { + await pb + .collection("user") + .confirmPasswordReset( + token ?? "", + data.newPassword, + data.newPasswordConfirm + ) + reset() + document.getElementById("sign-in-modal")?.click() + } catch (error) { + if (error instanceof Error) { + toast.error( + "There was a problem. Please try reset your password again", + { + position: "bottom-left", + autoClose: 5000, + hideProgressBar: false, + closeOnClick: true, + pauseOnHover: true, + draggable: true, + progress: undefined, + theme: "colored" + } + ) + } + } + } + + return ( + + +
+ } /> +
+
+ +
+ {errors.newPassword?.message}  +
+
+
+ +
+ {errors.newPasswordConfirm?.message}  +
+
+
+ +
+
+
+
+
+ ) +} diff --git a/Frontend/app/(public)/[ignore]/auth/confirm-verification/[token]/page.tsx b/Frontend/app/(public)/[ignore]/auth/confirm-verification/[token]/page.tsx deleted file mode 100644 index 15382d1..0000000 --- a/Frontend/app/(public)/[ignore]/auth/confirm-verification/[token]/page.tsx +++ /dev/null @@ -1,60 +0,0 @@ -"use client" - -import React, { useEffect } from "react"; -import { toast } from "react-toastify"; -import PocketBase from 'pocketbase'; -import PageWrapper from "@/components/Utilities/PageWrapper"; -import { usePathname, useRouter } from 'next/navigation'; -import Background from "@/components/Utilities/Background"; -import PageHeader from "@/sections/PageHeader"; - -const pb = new PocketBase(process.env.NEXT_PUBLIC_POCKETBASE_URL as string); - -export default function ConfirmVerification() { - const pathName = usePathname(); - const router = useRouter(); - const token = pathName.split('/').at(-1); - - useEffect(() => { - (async () => { - try { - await pb.collection('user').confirmVerification( - token ?? "" - ); - } catch (error) { - if (error instanceof Error) { - toast.error("There was a problem. Please try confirm your email again", { - position: "bottom-left", - autoClose: 5000, - hideProgressBar: false, - closeOnClick: true, - pauseOnHover: true, - draggable: true, - progress: undefined, - theme: "colored", - }); - } - } - })() - }, []) - - const handleSignInRedirect = () => { - document.getElementById("sign-in-modal")?.click(); - }; - - return ( - - -
- } - /> - -
-
-
- ); -} diff --git a/Frontend/app/(public)/about/page.tsx b/Frontend/app/(public)/about/page.jsx similarity index 53% rename from Frontend/app/(public)/about/page.tsx rename to Frontend/app/(public)/about/page.jsx index aeae38f..268d73c 100644 --- a/Frontend/app/(public)/about/page.tsx +++ b/Frontend/app/(public)/about/page.jsx @@ -1,8 +1,8 @@ -import PageHeader from "@/sections/PageHeader"; -import React from "react"; -import Footer from "@/components/Footer"; -import Image from "next/image"; -import Link from "next/link"; +import PageHeader from "@/sections/PageHeader" +import React from "react" +import Footer from "@/components/Footer" +import Image from "next/image" +import Link from "next/link" export default async function About() { return ( @@ -15,20 +15,45 @@ export default async function About() {

- In 2023 I built Sign365 using pocketbase - and setup an open source library to help people get setup with Stripe - + Pocketbase. As 2024 has come around I have had more and more - requests for applications and features on the existing code. I built a - codebase that would save me 20 hours + in the bootstrapping time to - get my applications ready. That is why I had to build FastPocket an - easy solution to give everyone a head start. + In 2023 I built{" "} + + Sign365 + {" "} + using pocketbase and setup an open source library to help people get + setup with{" "} + + Stripe + Pocketbase + + . As 2024 has come around I have had more and more requests for + applications and features on the existing code. I built a codebase + that would save me 20 hours + in the bootstrapping time to get my + applications ready. That is why I had to build{" "} + + FastPocket + {" "} + an easy solution to give everyone a head start.

After reflecting on the challenges that developers face building their applications, I've seen that there will never be one codebase that suits all developers. But I am sure for those who are opensourcing, self-hosting and want to spin up an application quickly - they will be able to do it using FastPocket + they will be able to do it using{" "} + + FastPocket +

I am taking all of the knowledge that I have gained across 20+ @@ -38,11 +63,23 @@ export default async function About() { that have been battle tested in enterprise code

- So I've committed to building FastPocket to help you build your - projects faster to get paid. + So I've committed to building{" "} + + FastPocket + {" "} + to help you build your projects faster to get paid.

- FastPocket will get you producing more with less development. + + FastPocket + {" "} + will get you producing more with less development.

I know that your next project will grow exponentially because of the @@ -69,5 +106,5 @@ export default async function About() {