From 69ca44b904afec027bf49103cc07b27543415149 Mon Sep 17 00:00:00 2001 From: Megan Leong Date: Wed, 15 May 2024 02:24:09 -0700 Subject: [PATCH] commented out nav bars --- .../src/app/invite-admin.tsx | 127 +++++++++++++----- admin-portal-frontend/src/app/layout.tsx | 6 +- admin-portal-frontend/src/app/page.tsx | 4 +- admin-portal-frontend/src/app/pageStyles.tsx | 9 +- 4 files changed, 107 insertions(+), 39 deletions(-) diff --git a/admin-portal-frontend/src/app/invite-admin.tsx b/admin-portal-frontend/src/app/invite-admin.tsx index bc97700..b233c0b 100644 --- a/admin-portal-frontend/src/app/invite-admin.tsx +++ b/admin-portal-frontend/src/app/invite-admin.tsx @@ -4,8 +4,13 @@ import React, { useState } from 'react'; import { doc, setDoc, getFirestore } from 'firebase/firestore'; const InviteAdmin = () => { + const [firstName, setFirstName] = useState(''); + const [lastName, setLastName] = useState(''); + const [title, setTitle] = useState(''); const [email, setEmail] = useState(''); + const [phone, setPhone] = useState(''); const [status, setStatus] = useState(''); + const [showModal, setShowModal] = useState(false); const db = getFirestore(); const handleInvite = async (e: any) => { @@ -13,46 +18,108 @@ const InviteAdmin = () => { const inviteRef = doc(db, 'invitations', email); try { - await setDoc(inviteRef, { invited: true }); + await setDoc(inviteRef, { firstName, lastName, title, email, phone, invited: true }); setStatus('Invitation sent successfully.'); + setFirstName(''); + setLastName(''); + setTitle(''); setEmail(''); + setPhone(''); + setShowModal(false); } catch (error: any) { setStatus(`Failed to send invitation: ${error.message}`); } }; + return ( +
+ - -return ( -
-
- setEmail(e.target.value)} - placeholder="Enter email to invite" - required - /> - -
- {status &&

{status}

} + {showModal && ( +
+
+

Add a new Admin

+

Register a physician to your admin directory below.

+
+ + + + + + + +
+ {status &&

{status}

} +
+
+ )}
); - }; export default InviteAdmin; + diff --git a/admin-portal-frontend/src/app/layout.tsx b/admin-portal-frontend/src/app/layout.tsx index 4728242..228b2cc 100644 --- a/admin-portal-frontend/src/app/layout.tsx +++ b/admin-portal-frontend/src/app/layout.tsx @@ -15,13 +15,13 @@ const roboto = Roboto({ export default function RootLayout({ children }: { children: ReactNode }) { const location = usePathname(); - const showNavbar = location !== '/' && location !== '/signup'; + const showNavbar = location !== '/' && location !== '/signup/'; const mainClass = `flex min-h-screen flex-col antialiased bg-sky-100/50 ${showNavbar ? 'pt-16 pl-60' : ''}`; return ( - {showNavbar && ( + {/* {showNavbar && ( <>
@@ -30,7 +30,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
- )} + )} */}
{children}
diff --git a/admin-portal-frontend/src/app/page.tsx b/admin-portal-frontend/src/app/page.tsx index cce40df..981b74f 100644 --- a/admin-portal-frontend/src/app/page.tsx +++ b/admin-portal-frontend/src/app/page.tsx @@ -89,7 +89,7 @@ export default function Home() {
- +