install shadcdn and move login dialog to a separate component

This commit is contained in:
Viktor Barzin 2025-06-15 13:49:34 +00:00
parent 4c7fe8927b
commit a8ee95b9d9
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
13 changed files with 1141 additions and 73 deletions

View file

@ -1,7 +1,8 @@
import type { User } from 'oidc-client-ts';
import { useEffect, useState } from 'react';
import './App.css';
import { getUser, handleCallback, login, logout } from './auth/authService';
import { getUser, handleCallback, logout } from './auth/authService';
import LoginModal from './components/LoginModal';
import { Map } from './components/Map';
import { Parameters } from './components/Parameters';
@ -22,19 +23,16 @@ function App() {
getUser().then(setUser);
}, []);
if (!user) {
return <LoginModal isOpen={user === null} />
}
return (
<>
<div>
<h1>React + Authentik OIDC</h1>
{user ? (
<div>
<p>Welcome, {user.profile.email}!</p>
<button onClick={logout}>Logout</button>
</div>
) : (
<button onClick={login}>Login with Authentik</button>
)}
<p>Welcome, {user.profile.name}!</p>
<button onClick={logout}>Logout</button>
</div>
{/* <div>
<a href="https://vite.dev" target="_blank">