Download Header.tsx from Jarvisstacks/Sentiment_Analysis_Tool_for_Social_Media: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/Jarvisstacks/Sentiment_Analysis_Tool_for_Social_Media/resolve/main/Header.tsx
- Command line
-
hf download hf://Jarvisstacks/Sentiment_Analysis_Tool_for_Social_Media/Header.tsx
-
curl -L -o Header.tsx https://huggingface.co/Jarvisstacks/Sentiment_Analysis_Tool_for_Social_Media/resolve/main/Header.tsx
1.36 kB
| // src/components/Header.tsx | |
| import React from 'react'; | |
| import { Link, useNavigate } from 'react-router-dom'; | |
| const Header: React.FC = () => { | |
| const token = localStorage.getItem('token'); | |
| const navigate = useNavigate(); | |
| const logout = () => { | |
| localStorage.removeItem('token'); | |
| navigate('/login'); | |
| }; | |
| return ( | |
| <header className="bg-gray-800 text-white p-4"> | |
| <nav className="container mx-auto flex justify-between"> | |
| <Link to="/" className="text-xl font-bold">Sentiment Tool</Link> | |
| <div className="space-x-4"> | |
| {token ? ( | |
| <> | |
| <Link to="/analyze">Analyze</Link> | |
| <Link to="/batch">Batch Analyze</Link> | |
| <Link to="/history">History</Link> | |
| <Link to="/profile">Profile</Link> | |
| <button onClick={logout} className="text-red-400">Logout</button> | |
| </> | |
| ) : ( | |
| <> | |
| <Link to="/login">Login</Link> | |
| <Link to="/register">Register</Link> | |
| </> | |
| )} | |
| </div> | |
| </nav> | |
| </header> | |
| ); | |
| }; | |
| export default Header; |