-
Notifications
You must be signed in to change notification settings - Fork 272
/
Copy pathLogin.tsx
69 lines (60 loc) · 2.02 KB
/
Login.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const { ipcRenderer } = require('electron');
import { type FC, useContext, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { KeyIcon, PersonIcon } from '@primer/octicons-react';
import { Logo } from '../components/Logo';
import { Button } from '../components/fields/Button';
import { AppContext } from '../context/App';
export const LoginRoute: FC = () => {
const navigate = useNavigate();
const { isLoggedIn } = useContext(AppContext);
useEffect(() => {
if (isLoggedIn) {
ipcRenderer.send('reopen-window');
navigate('/', { replace: true });
}
}, [isLoggedIn]);
// FIXME: Temporarily disable Login with GitHub (OAuth) as it's currently broken and requires a rewrite - see #485 #561 #747
/* const loginUser = useCallback(async () => {
try {
await login();
} catch (err) {
// Skip
}
}, []); */
return (
<div className="flex flex-1 flex-col justify-center items-center p-4 bg-white dark:bg-gray-dark dark:text-white">
<Logo className="w-16 h-16" isDark />
<div className="my-4 px-2.5 py-1.5 font-semibold text-center">
GitHub Notifications <br /> on your menu bar.
</div>
<div className="font-semibold text-center text-sm italic">Login with</div>
{
// FIXME: Temporarily disable Login with GitHub (OAuth) as it's currently broken and requires a rewrite - see #485 #561 #747
/*
<Button
name="GitHub"
icon={MarkGitHubIcon}
label="Login with GitHub"
class="w-50 px-2 py-2 my-2 text-xs"
onClick={loginUser}
/>
*/
}
<Button
name="Personal Access Token"
icon={KeyIcon}
label="Login with Personal Access Token"
class="py-2 mt-2"
onClick={() => navigate('/login-personal-access-token')}
/>
<Button
name="OAuth App"
icon={PersonIcon}
label="Login with OAuth App"
class="py-2 mt-2"
onClick={() => navigate('/login-oauth-app')}
/>
</div>
);
};