diff options
Diffstat (limited to 'frontend/src/components/Login.tsx')
| -rw-r--r-- | frontend/src/components/Login.tsx | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/frontend/src/components/Login.tsx b/frontend/src/components/Login.tsx index f1628b2..fe0cbd1 100644 --- a/frontend/src/components/Login.tsx +++ b/frontend/src/components/Login.tsx | |||
| @@ -5,14 +5,20 @@ import { ExitIcon, UserIcon, LoginIcon } from '@images/Images'; | |||
| 5 | import { UserProfile } from '@customTypes/Profile'; | 5 | import { UserProfile } from '@customTypes/Profile'; |
| 6 | import { API } from '@api/Api'; | 6 | import { API } from '@api/Api'; |
| 7 | import "@css/Login.css"; | 7 | import "@css/Login.css"; |
| 8 | import { Button, Buttons } from "@customTypes/Sidebar"; | ||
| 9 | import btn from "@css/Button.module.css"; | ||
| 8 | 10 | ||
| 9 | interface LoginProps { | 11 | interface LoginProps { |
| 12 | isSearching: boolean; | ||
| 13 | currentBtn: number; | ||
| 14 | buttonsList: Buttons; | ||
| 15 | setCurrentBtn: React.Dispatch<React.SetStateAction<number>>; | ||
| 10 | setToken: React.Dispatch<React.SetStateAction<string | undefined>>; | 16 | setToken: React.Dispatch<React.SetStateAction<string | undefined>>; |
| 11 | profile?: UserProfile; | 17 | profile?: UserProfile; |
| 12 | setProfile: React.Dispatch<React.SetStateAction<UserProfile | undefined>>; | 18 | setProfile: React.Dispatch<React.SetStateAction<UserProfile | undefined>>; |
| 13 | }; | 19 | }; |
| 14 | 20 | ||
| 15 | const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile }) => { | 21 | const Login: React.FC<LoginProps> = ({ isSearching, currentBtn, buttonsList, setCurrentBtn, setToken, profile, setProfile }) => { |
| 16 | 22 | ||
| 17 | const navigate = useNavigate(); | 23 | const navigate = useNavigate(); |
| 18 | 24 | ||
| @@ -36,13 +42,15 @@ const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile }) => { | |||
| 36 | {profile.profile ? | 42 | {profile.profile ? |
| 37 | ( | 43 | ( |
| 38 | <> | 44 | <> |
| 39 | <Link to="/profile" tabIndex={-1} className='login'> | 45 | <Link to="/profile" tabIndex={-1}> |
| 40 | <button className='sidebar-button'> | 46 | <button onClick={() => {setCurrentBtn(buttonsList.top.length)}} id="sidebarBtn" className={`${btn.sidebar} ${btn.profile} ${currentBtn == buttonsList.top.length ? btn.selected : ""} ${isSearching ? btn.min : ""}`}> |
| 41 | <img className="avatar-img" src={profile.avatar_link} alt="" /> | 47 | <img className="avatar-img" src={profile.avatar_link} alt="" /> |
| 48 | <span style={{justifyContent: "space-between", display: "flex", alignItems: "center", width: "100%"}}> | ||
| 42 | <span>{profile.user_name}</span> | 49 | <span>{profile.user_name}</span> |
| 43 | </button> | 50 | <button className={btn.logout} onClick={_logout}> |
| 44 | <button className='logout-button' onClick={_logout}> | 51 | <img src={ExitIcon} alt="" /><span /> |
| 45 | <img src={ExitIcon} alt="" /><span /> | 52 | </button> |
| 53 | </span> | ||
| 46 | </button> | 54 | </button> |
| 47 | </Link> | 55 | </Link> |
| 48 | </> | 56 | </> |
| @@ -50,8 +58,8 @@ const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile }) => { | |||
| 50 | : | 58 | : |
| 51 | ( | 59 | ( |
| 52 | <> | 60 | <> |
| 53 | <Link to="/" tabIndex={-1} className='login'> | 61 | <Link to="/" tabIndex={-1}> |
| 54 | <button className='sidebar-button'> | 62 | <button id="sidebarBtn" className={`${btn.sidebar} ${btn.profile} ${isSearching ? btn.min : ""}`}> |
| 55 | <img className="avatar-img" src={profile.avatar_link} alt="" /> | 63 | <img className="avatar-img" src={profile.avatar_link} alt="" /> |
| 56 | <span>Loading Profile...</span> | 64 | <span>Loading Profile...</span> |
| 57 | </button> | 65 | </button> |
| @@ -66,12 +74,12 @@ const Login: React.FC<LoginProps> = ({ setToken, profile, setProfile }) => { | |||
| 66 | ) | 74 | ) |
| 67 | : | 75 | : |
| 68 | ( | 76 | ( |
| 69 | <Link to="/api/v1/login" tabIndex={-1} className='login' > | 77 | <Link to="/api/v1/login" tabIndex={-1}> |
| 70 | <button className='sidebar-button' onClick={_login}> | 78 | <button id="sidebarBtn" className={`${btn.sidebar} ${isSearching ? btn.min : ""}`} onClick={_login}> |
| 71 | <img className="avatar-img" src={UserIcon} alt="" /> | 79 | <img className="avatar-img" src={UserIcon} alt="" /> |
| 72 | <span> | 80 | <span> |
| 73 | <img src={LoginIcon} alt="Sign in through Steam" /> | 81 | <img src={LoginIcon} alt="Sign in through Steam" /> |
| 74 | </span> | 82 | </span> |
| 75 | </button> | 83 | </button> |
| 76 | </Link> | 84 | </Link> |
| 77 | )} | 85 | )} |