diff --git a/components/Modal/index.tsx b/components/Modal/index.tsx index 8b17791..b2f2e8b 100644 --- a/components/Modal/index.tsx +++ b/components/Modal/index.tsx @@ -11,10 +11,10 @@ type Props = { export default function Modal({ toggleModal, className, children }: Props) { return ( -
+
{ - if (status === "authenticated") { + if (status === "authenticated" && data.user.isSubscriber) { setCollections(); setTags(); // setLinks(); diff --git a/layouts/CenteredForm.tsx b/layouts/CenteredForm.tsx new file mode 100644 index 0000000..b3cf8a2 --- /dev/null +++ b/layouts/CenteredForm.tsx @@ -0,0 +1,32 @@ +import Image from "next/image"; +import React, { ReactNode } from "react"; + +interface Props { + text?: string; + children: ReactNode; +} + +export default function CenteredForm({ text, children }: Props) { + return ( +
+
+ Linkwarden + {text ? ( +

+ {text} +

+ ) : undefined} + {children} +

+ © {new Date().getFullYear()} Linkwarden. All rights reserved. +

+
+
+ ); +} diff --git a/pages/choose-username.tsx b/pages/choose-username.tsx index 8f94304..f329b66 100644 --- a/pages/choose-username.tsx +++ b/pages/choose-username.tsx @@ -6,6 +6,7 @@ import { toast } from "react-hot-toast"; import { useSession } from "next-auth/react"; import { useRouter } from "next/router"; import useAccountStore from "@/store/account"; +import CenteredForm from "@/layouts/CenteredForm"; export default function Subscribe() { const [submitLoader, setSubmitLoader] = useState(false); @@ -15,10 +16,6 @@ export default function Subscribe() { const { updateAccount, account } = useAccountStore(); - useEffect(() => { - console.log(data?.user); - }, [status]); - async function submitUsername() { setSubmitLoader(true); @@ -41,16 +38,9 @@ export default function Subscribe() { } return ( - <> - Linkwarden -
-

+ +

+

Choose a Username (Last step)

@@ -91,9 +81,6 @@ export default function Subscribe() { Sign Out
-

- © {new Date().getFullYear()} Linkwarden. All rights reserved.{" "} -

- + ); } diff --git a/pages/confirmation.tsx b/pages/confirmation.tsx index 1c9a657..4ac68dc 100644 --- a/pages/confirmation.tsx +++ b/pages/confirmation.tsx @@ -1,25 +1,27 @@ -import { signIn } from "next-auth/react"; +import CenteredForm from "@/layouts/CenteredForm"; +import Link from "next/link"; import React from "react"; export default function EmailConfirmaion() { return ( -
-
-

Please check your email

+ +
+

+ Please check your Email +

A sign in link has been sent to your email address.

You can safely close this page.

- {/*
- signIn("email", { - email: email, - redirect: false, - }) - } - className="mx-auto font-semibold mt-2 cursor-pointer w-fit" - > - Resend? -
*/} + +
+ +

+ If you didn't recieve anything, go to the{" "} + + Password Recovery + {" "} + page and enter your Email to resend the sign in link. +

-
+ ); } diff --git a/pages/forgot.tsx b/pages/forgot.tsx index cdc10a4..7dd6f2e 100644 --- a/pages/forgot.tsx +++ b/pages/forgot.tsx @@ -1,4 +1,5 @@ import SubmitButton from "@/components/SubmitButton"; +import CenteredForm from "@/layouts/CenteredForm"; import { signIn } from "next-auth/react"; import Image from "next/image"; import Link from "next/link"; @@ -38,22 +39,19 @@ export default function Forgot() { } return ( - <> - Linkwarden -
-

Fogot Password?

-

- Enter your Email so we can send you a link to recover your account. -

-

- Make sure to change your password in the profile settings afterwards. -

+ +
+

Password Recovery

+
+

+ Enter your Email so we can send you a link to recover your account. + Make sure to change your password in the profile settings + afterwards. +

+

+ You wont get logged in if you haven't created an account yet. +

+

Email

@@ -78,9 +76,6 @@ export default function Forgot() {
-

- © {new Date().getFullYear()} Linkwarden. All rights reserved.{" "} -

- +
); } diff --git a/pages/login.tsx b/pages/login.tsx index 8246fe3..f96abf9 100644 --- a/pages/login.tsx +++ b/pages/login.tsx @@ -1,4 +1,5 @@ import SubmitButton from "@/components/SubmitButton"; +import CenteredForm from "@/layouts/CenteredForm"; import { signIn } from "next-auth/react"; import Image from "next/image"; import Link from "next/link"; @@ -45,21 +46,12 @@ export default function Login() { } return ( - <> - Linkwarden -

- Sign in to your account -

-
-

+ +

+

Enter your credentials

+

Username @@ -99,7 +91,7 @@ export default function Login() {

@@ -109,9 +101,6 @@ export default function Login() {
-

- © {new Date().getFullYear()} Linkwarden. All rights reserved.{" "} -

- + ); } diff --git a/pages/register.tsx b/pages/register.tsx index f2ddf09..d02ddbc 100644 --- a/pages/register.tsx +++ b/pages/register.tsx @@ -4,6 +4,7 @@ import { toast } from "react-hot-toast"; import SubmitButton from "@/components/SubmitButton"; import { signIn } from "next-auth/react"; import Image from "next/image"; +import CenteredForm from "@/layouts/CenteredForm"; const emailEnabled = process.env.NEXT_PUBLIC_EMAIL_PROVIDER; @@ -89,23 +90,17 @@ export default function Register() { } return ( - <> - Linkwarden -

- {process.env.NEXT_PUBLIC_STRIPE_IS_ACTIVE - ? `Start using our premium services with a ${ + -

-

+ : "Create a new account" + } + > +

+

Enter your details

@@ -154,40 +149,38 @@ export default function Register() {
) : undefined} -
-
-

- Password -

+
+

+ Password +

- setForm({ ...form, password: e.target.value })} - className="w-full rounded-md p-2 mx-auto border-sky-100 border-solid border outline-none focus:border-sky-700 duration-100" - /> -
+ setForm({ ...form, password: e.target.value })} + className="w-full rounded-md p-2 mx-auto border-sky-100 border-solid border outline-none focus:border-sky-700 duration-100" + /> +
-
-

- Confirm Password -

+
+

+ Confirm Password +

- - setForm({ ...form, passwordConfirmation: e.target.value }) - } - className="w-full rounded-md p-2 mx-auto border-sky-100 border-solid border outline-none focus:border-sky-700 duration-100" - /> -
+ + setForm({ ...form, passwordConfirmation: e.target.value }) + } + className="w-full rounded-md p-2 mx-auto border-sky-100 border-solid border outline-none focus:border-sky-700 duration-100" + />
{process.env.NEXT_PUBLIC_STRIPE_IS_ACTIVE ? ( - <> +

By signing up, you agree to our{" "} @@ -212,7 +205,7 @@ export default function Register() { .

- +
) : undefined}
-

- © {new Date().getFullYear()} Linkwarden. All rights reserved.{" "} -

- + ); } diff --git a/pages/subscribe.tsx b/pages/subscribe.tsx index ffc366e..e7ee637 100644 --- a/pages/subscribe.tsx +++ b/pages/subscribe.tsx @@ -5,6 +5,7 @@ import { useEffect, useState } from "react"; import { toast } from "react-hot-toast"; import { useSession } from "next-auth/react"; import { useRouter } from "next/router"; +import CenteredForm from "@/layouts/CenteredForm"; export default function Subscribe() { const [submitLoader, setSubmitLoader] = useState(false); @@ -20,29 +21,24 @@ export default function Subscribe() { const res = await fetch("/api/payment"); const data = await res.json(); - console.log(data); router.push(data.response); } return ( - <> - Linkwarden -

- {process.env.NEXT_PUBLIC_TRIAL_PERIOD_DAYS || 14} days free trial, then - ${process.env.NEXT_PUBLIC_PRICING}/month afterwards -

-
+ +
+

+ Subscribe to Linkwarden! +

+
-

- You will be redirected to Stripe. -

-

+

You will be redirected to Stripe.

+

Feel free to reach out to us at{" "} support@linkwarden.app @@ -65,9 +61,6 @@ export default function Subscribe() { Sign Out

-

- © {new Date().getFullYear()} Linkwarden. All rights reserved.{" "} -

- +
); }