mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 13:25:23 +02:00
feat(auth): add email/password login restricted to @craze.de accounts
- src/lib/auth.ts: signIn/signOut/getStoredSession via Supabase Auth REST API - src/components/LoginPage.tsx: login form with domain validation UI - src/components/TopBar.tsx: show logged-in user email + sign out button - src/App.tsx: gate entire app behind auth — shows LoginPage if no session Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
9b10b628af
commit
eeb6711b69
@@ -1,14 +1,16 @@
|
||||
import React from 'react';
|
||||
import { Download, Database } from 'lucide-react';
|
||||
import { Download, Database, LogOut } from 'lucide-react';
|
||||
|
||||
interface TopBarProps {
|
||||
stats: any;
|
||||
onExport: () => void;
|
||||
hasData: boolean;
|
||||
hasUnsavedChanges: boolean;
|
||||
userEmail?: string;
|
||||
onSignOut?: () => void;
|
||||
}
|
||||
|
||||
export function TopBar({ stats, onExport, hasData, hasUnsavedChanges }: TopBarProps) {
|
||||
export function TopBar({ stats, onExport, hasData, hasUnsavedChanges, userEmail, onSignOut }: TopBarProps) {
|
||||
return (
|
||||
<header className="bg-slate-800 border-b border-slate-700 h-16 flex items-center justify-between px-6 shrink-0 z-10">
|
||||
<div className="flex items-center gap-3">
|
||||
@@ -50,8 +52,8 @@ export function TopBar({ stats, onExport, hasData, hasUnsavedChanges }: TopBarPr
|
||||
<button
|
||||
onClick={onExport}
|
||||
className={`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
hasUnsavedChanges
|
||||
? 'bg-blue-600 hover:bg-blue-700 text-white'
|
||||
hasUnsavedChanges
|
||||
? 'bg-blue-600 hover:bg-blue-700 text-white'
|
||||
: 'bg-slate-700 hover:bg-slate-600 text-slate-200'
|
||||
}`}
|
||||
>
|
||||
@@ -60,6 +62,18 @@ export function TopBar({ stats, onExport, hasData, hasUnsavedChanges }: TopBarPr
|
||||
{hasUnsavedChanges && <span className="w-2 h-2 rounded-full bg-red-500 ml-1 animate-pulse" />}
|
||||
</button>
|
||||
)}
|
||||
{userEmail && (
|
||||
<div className="flex items-center gap-2 border-l border-slate-700 pl-3">
|
||||
<span className="text-xs text-slate-400">{userEmail}</span>
|
||||
<button
|
||||
onClick={onSignOut}
|
||||
title="Sign out"
|
||||
className="p-1.5 text-slate-400 hover:text-white hover:bg-slate-700 rounded-md transition-colors"
|
||||
>
|
||||
<LogOut className="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user