- Added CompanyOffer component for submitting company offers with validation. - Integrated email sending functionality upon form submission. - Created a success page for company registration confirmation. - Introduced a reusable SuccessNotification component for displaying success messages. - Updated account update functionality with new fields and validation. - Enhanced user experience with back button and logo components. - Added necessary database migrations for account updates.
70 lines
1.8 KiB
TypeScript
70 lines
1.8 KiB
TypeScript
import Link from 'next/link';
|
|
|
|
import { signOutAction } from '@/lib/actions/sign-out';
|
|
import { hasEnvVars } from '@/utils/supabase/check-env-vars';
|
|
import { createClient } from '@/utils/supabase/server';
|
|
|
|
import { Badge } from '@kit/ui/badge';
|
|
import { Button } from '@kit/ui/button';
|
|
|
|
export default async function AuthButton() {
|
|
const supabase = await createClient();
|
|
|
|
const {
|
|
data: { user },
|
|
} = await supabase.auth.getUser();
|
|
|
|
if (!hasEnvVars) {
|
|
return (
|
|
<>
|
|
<div className="flex items-center gap-4">
|
|
<div>
|
|
<Badge
|
|
variant={'default'}
|
|
className="pointer-events-none font-normal"
|
|
>
|
|
Please update .env.local file with anon key and url
|
|
</Badge>
|
|
</div>
|
|
<div className="flex gap-2">
|
|
<Button
|
|
asChild
|
|
size="sm"
|
|
variant={'outline'}
|
|
disabled
|
|
className="pointer-events-none cursor-none opacity-75"
|
|
>
|
|
<Link href="/sign-in">Sign in</Link>
|
|
</Button>
|
|
<Button
|
|
asChild
|
|
size="sm"
|
|
variant={'default'}
|
|
disabled
|
|
className="pointer-events-none cursor-none opacity-75"
|
|
>
|
|
<Link href="example/sign-up">Sign up</Link>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|
|
return user ? (
|
|
<div className="flex items-center gap-4">
|
|
Hey, {user.email}!
|
|
<form action={signOutAction}>
|
|
<Button type="submit" variant={'outline'}>
|
|
Sign out
|
|
</Button>
|
|
</form>
|
|
</div>
|
|
) : (
|
|
<div className="flex gap-2">
|
|
<Button asChild size="sm" variant={'outline'}>
|
|
<Link href="/sign-in">Sign in</Link>
|
|
</Button>
|
|
</div>
|
|
);
|
|
}
|