created business page

This commit is contained in:
Juthatip McDevitt 2024-04-25 18:07:43 -05:00
parent 2f7032ca4a
commit 4615d1357a
3 changed files with 67 additions and 5 deletions

View file

@ -0,0 +1,20 @@
import { Input } from '@/components/ui/input'
import React from 'react'
const CreateBusiness = () => {
return (
<div className='my-20 flex flex-col items-center gap-10 px-5'>
<p className='text-3xl uppercase font-semibold font-outline-2 text-white tracking-wide'>Schedule.Me</p>
<div className='flex flex-col items-center'>
<p className='text-lg font-semibold'>What would you like to be called?</p>
<p className='text-sm text-[gray] mb-10'>You can change this later</p>
<div className='w-full'>
<label className='font-semibold text-[#31363F]'>Team name:</label>
<Input placeholder="Enter your team name" className='mt-1'/>
</div>
</div>
</div>
)
}
export default CreateBusiness

View file

@ -1,15 +1,38 @@
"use client"
import { LogoutLink} from '@kinde-oss/kinde-auth-nextjs'
import React from 'react'
import { getFirestore } from "firebase/firestore";
import { LogoutLink, useKindeBrowserClient} from '@kinde-oss/kinde-auth-nextjs'
import React, { useEffect, useState } from 'react'
import { doc, getDoc, getFirestore } from "firebase/firestore";
import { app } from '@/config/FirebaseConfig';
import { useRouter } from 'next/navigation';
const Dashboard = () => {
const db = getFirestore(app);
const isBusinessRegistered = () => {
const {user} = useKindeBrowserClient();
const [loading, setLoading] = useState(true);
const router = useRouter();
useEffect(() => {
user && isBusinessRegistered();
}, [user])
const isBusinessRegistered = async () => {
const docRef = doc(db, "Business", user.email);
const docSnap = await getDoc(docRef);
if (docSnap.exists()) {
console.log("Document data:", docSnap.data());
setLoading(false);
} else {
// docSnap.data() will be undefined in this case
console.log("No such document!");
setLoading(false);
router.replace('/create_business');
}
}
if (loading){
return <p className='text-green-800 font-semibold justify-center items-center text-center py-10'>Loading...</p>
}
return (

View file

@ -0,0 +1,19 @@
import * as React from "react"
import { cn } from "@/lib/utils"
const Input = React.forwardRef(({ className, type, ...props }, ref) => {
return (
(<input
type={type}
className={cn(
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
className
)}
ref={ref}
{...props} />)
);
})
Input.displayName = "Input"
export { Input }