From 3469d55b48a44ac124a6088280c0eec61f09b986 Mon Sep 17 00:00:00 2001 From: Jubayer Date: Wed, 4 Dec 2024 13:37:59 +0600 Subject: [PATCH] feat: add demo login credentials toast notification on mount Signed-off-by: Jubayer --- apps/web/app/(auth)/login/page.tsx | 45 +++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/apps/web/app/(auth)/login/page.tsx b/apps/web/app/(auth)/login/page.tsx index 9d9dfde..4fb9f38 100644 --- a/apps/web/app/(auth)/login/page.tsx +++ b/apps/web/app/(auth)/login/page.tsx @@ -9,15 +9,18 @@ import auth3Light from '@/public/images/auth3-light.png'; import { Eye, EyeOff, Loader2 } from 'lucide-react'; import Image from 'next/image'; import Link from 'next/link'; -import { useRef, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; +import { PiUserDuotone } from 'react-icons/pi'; import { toast } from 'sonner'; export default function Login() { const { loginUser } = useAuth(); const [getResponse, setGetResponse] = useState(false); + const [mounted, setMounted] = useState(false); const usernameRef = useRef(null); const passwordRef = useRef(null); const [passwordType, setPasswordType] = useState('password'); + const togglePasswordType = () => { if (passwordType === 'text') { setPasswordType('password'); @@ -55,6 +58,35 @@ export default function Login() { } setGetResponse(false); }; + + useEffect(() => { + if (typeof window !== 'undefined') { + setMounted(true); + } + }, []); + + if (mounted) { + toast( +
+

+ Demo Login Credentials +

+ +

+ Username: admin +

+

+ Password: admin +

+

Note: The demo does not make any changes to the database.

+
, + { + position: 'bottom-center', + duration: Infinity, + } + ); + } + return (
background image @@ -83,6 +115,17 @@ export default function Login() {
Hey, Hello 👋
Enter your DASH credentials here...
+ {/* Demo Credentials Alert*/} + {/*
+

+ Demo Credentials +

+

+ Username: admin Password: admin +

+

NB: Performing post, put, delete methods in the demo will not reflect in the database.

+
*/} +