diff --git a/public/vite.svg b/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/assets/react.svg b/src/assets/react.svg deleted file mode 100644 index 6c87de9..0000000 --- a/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/Header.tsx b/src/components/Header.tsx new file mode 100644 index 0000000..3a1c68f --- /dev/null +++ b/src/components/Header.tsx @@ -0,0 +1,58 @@ +import { Link } from '@tanstack/react-router'; +import { useState } from 'react'; +import { useUser } from '../lib/context/user'; + +const Header = () => { + const { logout } = useUser(); + const [isDropdownOpen, setIsDropdownOpen] = useState(false); + + const toggleDropdown = () => { + setIsDropdownOpen(!isDropdownOpen); + }; + + return ( +
+ +
+ ); +}; + +export default Header; diff --git a/src/index.css b/src/index.css index e7d4bb2..6e569a5 100644 --- a/src/index.css +++ b/src/index.css @@ -26,14 +26,6 @@ a:hover { color: #535bf2; } -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; -} - h1 { font-size: 3.2em; line-height: 1.1; diff --git a/src/lib/context/user.tsx b/src/lib/context/user.tsx index f480fbf..b30a485 100644 --- a/src/lib/context/user.tsx +++ b/src/lib/context/user.tsx @@ -45,6 +45,7 @@ export const UserProvider = (props: PropsWithChildren) => { const logout = async () => { await account.deleteSession('current'); setUser(null); + window.location.replace('/'); }; const register = async (email: string, password: string) => { diff --git a/src/main.tsx b/src/main.tsx index 0b2e903..b203482 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -15,6 +15,7 @@ import Login from './pages/Login'; import { EstimationSessionProvider } from './lib/context/estimationSession'; import { EstimationContextProvider } from './lib/context/estimation'; import Estimation from './pages/Estimation/Estimation'; +import Header from './components/Header'; interface RouterContext { userContext: UserContextType; @@ -38,6 +39,14 @@ const authenticatedRoute = createRoute({ }); } }, + component: () => { + return ( + <> +
+ + + ); + }, }); const indexRoute = createRoute({ diff --git a/src/pages/Estimation/Estimation.tsx b/src/pages/Estimation/Estimation.tsx index 737c3e9..0aab900 100644 --- a/src/pages/Estimation/Estimation.tsx +++ b/src/pages/Estimation/Estimation.tsx @@ -40,7 +40,7 @@ const Estimation: React.FC = () => { return (
setActiveTicket(ticket.id)} onAddTicket={() => setDrawerOpen(true)} diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 5c1ff71..ca43ceb 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -1,5 +1,3 @@ -import reactLogo from '../assets/react.svg'; -import viteLogo from '/vite.svg'; import './Home.css'; import { getRouteApi, Link } from '@tanstack/react-router'; import { useUser } from '../lib/context/user'; @@ -22,14 +20,6 @@ function Home() { return ( <> -
- - Vite logo - - - React logo - -

Scrummie-Poker