From 9c45ce61b8d6733fbc160bc59666eb8fcc03f73e Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Sat, 26 Aug 2023 12:31:40 +0530 Subject: [PATCH 1/5] feat: added show password feature Signed-off-by: Adithya Krishna --- apps/web/src/components/forms/password.tsx | 70 ++++++++++++++++++---- apps/web/src/components/forms/signin.tsx | 37 +++++++++--- apps/web/src/components/forms/signup.tsx | 37 +++++++++--- 3 files changed, 117 insertions(+), 27 deletions(-) diff --git a/apps/web/src/components/forms/password.tsx b/apps/web/src/components/forms/password.tsx index eba0c9a43..4689e0dbe 100644 --- a/apps/web/src/components/forms/password.tsx +++ b/apps/web/src/components/forms/password.tsx @@ -1,7 +1,9 @@ 'use client'; +import { useState } from 'react'; + import { zodResolver } from '@hookform/resolvers/zod'; -import { Loader } from 'lucide-react'; +import { Eye, EyeOff, Loader } from 'lucide-react'; import { useForm } from 'react-hook-form'; import { z } from 'zod'; @@ -35,6 +37,8 @@ export type PasswordFormProps = { export const PasswordForm = ({ className }: PasswordFormProps) => { const { toast } = useToast(); + const [showPassword, setShowPassword] = useState(false); + const [showConfirmPassword, setShowConfirmPassword] = useState(false); const { register, @@ -79,6 +83,14 @@ export const PasswordForm = ({ className }: PasswordFormProps) => { } }; + const onShowPassword = () => { + setShowPassword(!showPassword); + }; + + const onShowConfirmPassword = () => { + setShowConfirmPassword(!showConfirmPassword); + }; + return (
{ Password - +
+ + + +
@@ -104,12 +132,28 @@ export const PasswordForm = ({ className }: PasswordFormProps) => { Repeat Password - +
+ + + +
diff --git a/apps/web/src/components/forms/signin.tsx b/apps/web/src/components/forms/signin.tsx index ae9540869..2f3c3a4d6 100644 --- a/apps/web/src/components/forms/signin.tsx +++ b/apps/web/src/components/forms/signin.tsx @@ -1,7 +1,9 @@ 'use client'; +import { useState } from 'react'; + import { zodResolver } from '@hookform/resolvers/zod'; -import { Loader } from 'lucide-react'; +import { Eye, EyeOff, Loader } from 'lucide-react'; import { signIn } from 'next-auth/react'; import { useForm } from 'react-hook-form'; import { FcGoogle } from 'react-icons/fc'; @@ -26,6 +28,7 @@ export type SignInFormProps = { export const SignInForm = ({ className }: SignInFormProps) => { const { toast } = useToast(); + const [showPassword, setShowPassword] = useState(false); const { register, @@ -73,6 +76,10 @@ export const SignInForm = ({ className }: SignInFormProps) => { } }; + const onShowPassword = () => { + setShowPassword(!showPassword); + }; + return ( { Password - +
+ + + +
{errors.password && ( {errors.password.message} diff --git a/apps/web/src/components/forms/signup.tsx b/apps/web/src/components/forms/signup.tsx index ce449f850..a66e43caf 100644 --- a/apps/web/src/components/forms/signup.tsx +++ b/apps/web/src/components/forms/signup.tsx @@ -1,7 +1,9 @@ 'use client'; +import { useState } from 'react'; + import { zodResolver } from '@hookform/resolvers/zod'; -import { Loader } from 'lucide-react'; +import { Eye, EyeOff, Loader } from 'lucide-react'; import { signIn } from 'next-auth/react'; import { useForm } from 'react-hook-form'; import { z } from 'zod'; @@ -29,6 +31,7 @@ export type SignUpFormProps = { export const SignUpForm = ({ className }: SignUpFormProps) => { const { toast } = useToast(); + const [showPassword, setShowPassword] = useState(false); const { register, @@ -72,6 +75,10 @@ export const SignUpForm = ({ className }: SignUpFormProps) => { } }; + const onShowPassword = () => { + setShowPassword(!showPassword); + }; + return ( { Password - +
+ + + +
From 7c6b5ac59d227a2020cbb7760f61751098b27c86 Mon Sep 17 00:00:00 2001 From: Adithya Krishna Date: Sat, 26 Aug 2023 20:42:15 +0530 Subject: [PATCH 2/5] fix: updated padding and set patterns Signed-off-by: Adithya Krishna --- apps/web/src/components/forms/password.tsx | 20 ++++++-------------- apps/web/src/components/forms/signin.tsx | 10 +++------- apps/web/src/components/forms/signup.tsx | 10 +++------- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/apps/web/src/components/forms/password.tsx b/apps/web/src/components/forms/password.tsx index 4689e0dbe..d258b2693 100644 --- a/apps/web/src/components/forms/password.tsx +++ b/apps/web/src/components/forms/password.tsx @@ -83,14 +83,6 @@ export const PasswordForm = ({ className }: PasswordFormProps) => { } }; - const onShowPassword = () => { - setShowPassword(!showPassword); - }; - - const onShowConfirmPassword = () => { - setShowConfirmPassword(!showConfirmPassword); - }; - return ( {
@@ -140,9 +140,9 @@ export const PasswordForm = ({ className }: PasswordFormProps) => { onClick={() => setShowConfirmPassword((showConfirmPassword) => !showConfirmPassword)} > {showConfirmPassword ? ( - + ) : ( - + )} diff --git a/apps/web/src/components/forms/signin.tsx b/apps/web/src/components/forms/signin.tsx index d62e376ff..f8add10c4 100644 --- a/apps/web/src/components/forms/signin.tsx +++ b/apps/web/src/components/forms/signin.tsx @@ -115,9 +115,9 @@ export const SignInForm = ({ className }: SignInFormProps) => { onClick={() => setShowPassword((showPassword) => !showPassword)} > {showPassword ? ( - + ) : ( - + )} diff --git a/apps/web/src/components/forms/signup.tsx b/apps/web/src/components/forms/signup.tsx index 795dad25d..fae5d6277 100644 --- a/apps/web/src/components/forms/signup.tsx +++ b/apps/web/src/components/forms/signup.tsx @@ -121,9 +121,9 @@ export const SignUpForm = ({ className }: SignUpFormProps) => { onClick={() => setShowPassword((showPassword) => !showPassword)} > {showPassword ? ( - + ) : ( - + )} From ecc8e59c8c045b37e829393e2e66a12243958d86 Mon Sep 17 00:00:00 2001 From: Mythie Date: Wed, 20 Sep 2023 02:18:35 +0000 Subject: [PATCH 4/5] fix: update colors --- .../web/src/app/(dashboard)/documents/upload-document.tsx | 2 +- apps/web/src/app/(dashboard)/settings/billing/page.tsx | 4 ++-- apps/web/src/app/(dashboard)/settings/password/page.tsx | 2 +- apps/web/src/app/(dashboard)/settings/profile/page.tsx | 2 +- .../(dashboard)/period-selector/period-selector.tsx | 2 +- apps/web/src/components/forms/password.tsx | 8 ++++---- apps/web/src/components/forms/signin.tsx | 6 +++--- apps/web/src/components/forms/signup.tsx | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/web/src/app/(dashboard)/documents/upload-document.tsx b/apps/web/src/app/(dashboard)/documents/upload-document.tsx index b472c606b..12df84475 100644 --- a/apps/web/src/app/(dashboard)/documents/upload-document.tsx +++ b/apps/web/src/app/(dashboard)/documents/upload-document.tsx @@ -68,7 +68,7 @@ export const UploadDocument = ({ className }: UploadDocumentProps) => { {isLoading && (
- +
)} diff --git a/apps/web/src/app/(dashboard)/settings/billing/page.tsx b/apps/web/src/app/(dashboard)/settings/billing/page.tsx index bd2659e62..7e6694491 100644 --- a/apps/web/src/app/(dashboard)/settings/billing/page.tsx +++ b/apps/web/src/app/(dashboard)/settings/billing/page.tsx @@ -43,7 +43,7 @@ export default async function BillingSettingsPage() {

Billing

-

+

Your subscription is{' '} {subscription.status !== SubscriptionStatus.INACTIVE ? 'active' : 'inactive'}. {subscription?.periodEnd && ( @@ -67,7 +67,7 @@ export default async function BillingSettingsPage() { )} {!billingPortalUrl && ( -

+

You do not currently have a customer record, this should not happen. Please contact support for assistance.

diff --git a/apps/web/src/app/(dashboard)/settings/password/page.tsx b/apps/web/src/app/(dashboard)/settings/password/page.tsx index 305cc3d0c..b89e74f3c 100644 --- a/apps/web/src/app/(dashboard)/settings/password/page.tsx +++ b/apps/web/src/app/(dashboard)/settings/password/page.tsx @@ -9,7 +9,7 @@ export default async function PasswordSettingsPage() {

Password

-

Here you can update your password.

+

Here you can update your password.


diff --git a/apps/web/src/app/(dashboard)/settings/profile/page.tsx b/apps/web/src/app/(dashboard)/settings/profile/page.tsx index ba461e871..ee0087a9a 100644 --- a/apps/web/src/app/(dashboard)/settings/profile/page.tsx +++ b/apps/web/src/app/(dashboard)/settings/profile/page.tsx @@ -9,7 +9,7 @@ export default async function ProfileSettingsPage() {

Profile

-

Here you can edit your personal details.

+

Here you can edit your personal details.


diff --git a/apps/web/src/components/(dashboard)/period-selector/period-selector.tsx b/apps/web/src/components/(dashboard)/period-selector/period-selector.tsx index afabefc3f..caeb780d0 100644 --- a/apps/web/src/components/(dashboard)/period-selector/period-selector.tsx +++ b/apps/web/src/components/(dashboard)/period-selector/period-selector.tsx @@ -44,7 +44,7 @@ export const PeriodSelector = () => { return ( +
+ + + +
@@ -114,15 +136,31 @@ export const ResetPasswordForm = ({ className, token }: ResetPasswordFormProps) Repeat Password - +
+ + + +
diff --git a/apps/web/src/components/forms/signin.tsx b/apps/web/src/components/forms/signin.tsx index 63e4bb88d..2a209ddbe 100644 --- a/apps/web/src/components/forms/signin.tsx +++ b/apps/web/src/components/forms/signin.tsx @@ -145,7 +145,7 @@ export const SignInForm = ({ className }: SignInFormProps) => { type="button" className="absolute right-0 top-0 flex h-full items-center justify-center pr-3" aria-label={showPassword ? 'Mask password' : 'Reveal password'} - onClick={() => setShowPassword((showPassword) => !showPassword)} + onClick={() => setShowPassword((show) => !show)} > {showPassword ? ( diff --git a/apps/web/src/components/forms/signup.tsx b/apps/web/src/components/forms/signup.tsx index 890f8d7dd..a3c3bd92f 100644 --- a/apps/web/src/components/forms/signup.tsx +++ b/apps/web/src/components/forms/signup.tsx @@ -125,7 +125,7 @@ export const SignUpForm = ({ className }: SignUpFormProps) => { type="button" className="absolute right-0 top-0 flex h-full items-center justify-center pr-3" aria-label={showPassword ? 'Mask password' : 'Reveal password'} - onClick={() => setShowPassword((showPassword) => !showPassword)} + onClick={() => setShowPassword((show) => !show)} > {showPassword ? (