|
|
@@ -1,26 +1,25 @@
|
|
1
|
1
|
import styled from 'styles'
|
|
2
|
|
-import { signin, signout, useSession } from 'next-auth/client'
|
|
|
2
|
+import { getSession, signin, signout, useSession } from 'next-auth/client'
|
|
|
3
|
+import { GetServerSideProps } from 'next'
|
|
|
4
|
+import React from 'react'
|
|
3
|
5
|
|
|
4
|
6
|
export default function Sponsorware() {
|
|
5
|
7
|
const [session, loading] = useSession()
|
|
6
|
8
|
|
|
7
|
9
|
return (
|
|
8
|
10
|
<Content>
|
|
9
|
|
- <h1>tldraw is sponsorware</h1>
|
|
10
|
|
- <video src="images/hello.mp4" autoPlay muted loop />
|
|
|
11
|
+ <h1>tldraw (is sponsorware)</h1>
|
|
11
|
12
|
<p>
|
|
12
|
13
|
Hey, thanks for visiting <a href="https://tldraw.com/">tldraw</a>, a
|
|
13
|
14
|
tiny little drawing app by{' '}
|
|
14
|
15
|
<a href="https://twitter.com/steveruizok">steveruizok</a>.
|
|
15
|
16
|
</p>
|
|
16
|
|
- <p>
|
|
17
|
|
- {' '}
|
|
18
|
|
- This project is currently:{' '}
|
|
19
|
|
- <ul>
|
|
20
|
|
- <li>in development</li>
|
|
21
|
|
- <li>only available for my sponsors</li>
|
|
22
|
|
- </ul>
|
|
23
|
|
- </p>
|
|
|
17
|
+ <video src="images/hello.mp4" autoPlay muted loop />
|
|
|
18
|
+ <p>This project is currently: </p>
|
|
|
19
|
+ <ul>
|
|
|
20
|
+ <li>in development</li>
|
|
|
21
|
+ <li>only available for my sponsors</li>
|
|
|
22
|
+ </ul>
|
|
24
|
23
|
<p>
|
|
25
|
24
|
If you'd like to try it out,{' '}
|
|
26
|
25
|
<a
|
|
|
@@ -32,23 +31,61 @@ export default function Sponsorware() {
|
|
32
|
31
|
</a>{' '}
|
|
33
|
32
|
(at $1 or more) and sign in below.
|
|
34
|
33
|
</p>
|
|
35
|
|
- <Button onClick={() => signin('github')}>Sign in With Github</Button>
|
|
36
|
|
- <button onClick={() => signout()}>Sign Out</button>
|
|
37
|
|
- <pre>{JSON.stringify(session, null, 2)}</pre>
|
|
|
34
|
+ <ButtonGroup>
|
|
|
35
|
+ {session ? (
|
|
|
36
|
+ <>
|
|
|
37
|
+ <Button onClick={() => signout()} variant={'secondary'}>
|
|
|
38
|
+ Sign Out
|
|
|
39
|
+ </Button>
|
|
|
40
|
+ <Detail>
|
|
|
41
|
+ Signed in as {session?.user?.name} ({session?.user?.email}), but
|
|
|
42
|
+ it looks like you're not yet a sponsor.
|
|
|
43
|
+ <br />
|
|
|
44
|
+ Something wrong? Try <a href="/">reloading the page</a> or DM me
|
|
|
45
|
+ on <a href="https://twitter.com/steveruizok">Twitter</a>.
|
|
|
46
|
+ </Detail>
|
|
|
47
|
+ </>
|
|
|
48
|
+ ) : (
|
|
|
49
|
+ <>
|
|
|
50
|
+ <Button onClick={() => signin('github')} variant={'primary'}>
|
|
|
51
|
+ {loading ? 'Loading...' : 'Sign in With Github'}
|
|
|
52
|
+ </Button>
|
|
|
53
|
+ <Detail>Already a sponsor? Just sign in to visit the app.</Detail>
|
|
|
54
|
+ </>
|
|
|
55
|
+ )}
|
|
|
56
|
+ </ButtonGroup>
|
|
38
|
57
|
</Content>
|
|
39
|
58
|
)
|
|
40
|
59
|
}
|
|
41
|
60
|
|
|
|
61
|
+export const getServerSideProps: GetServerSideProps = async (context) => {
|
|
|
62
|
+ const session = await getSession(context)
|
|
|
63
|
+
|
|
|
64
|
+ // if (!!session?.user) {
|
|
|
65
|
+ // context.res.setHeader('Location', `/`)
|
|
|
66
|
+ // context.res.statusCode = 307
|
|
|
67
|
+ // }
|
|
|
68
|
+
|
|
|
69
|
+ return {
|
|
|
70
|
+ props: {
|
|
|
71
|
+ session,
|
|
|
72
|
+ },
|
|
|
73
|
+ }
|
|
|
74
|
+}
|
|
|
75
|
+
|
|
42
|
76
|
const Content = styled('div', {
|
|
43
|
77
|
width: '720px',
|
|
44
|
78
|
maxWidth: 'calc(100% - 16px)',
|
|
45
|
79
|
backgroundColor: '$panel',
|
|
46
|
|
- margin: '72px auto',
|
|
47
|
|
- borderRadius: '4px',
|
|
48
|
|
- boxShadow: '0px 2px 4px rgba(0,0,0,.2)',
|
|
49
|
|
- padding: '16px',
|
|
|
80
|
+ margin: '32px auto',
|
|
|
81
|
+ borderRadius: '8px',
|
|
|
82
|
+ boxShadow: '0px 2px 24px rgba(0,0,0,.08), 0px 2px 4px rgba(0,0,0,.16)',
|
|
|
83
|
+ padding: '32px',
|
|
50
|
84
|
overflow: 'hidden',
|
|
51
|
85
|
color: '$text',
|
|
|
86
|
+ fontSize: '$3',
|
|
|
87
|
+ fontFamily: '$body',
|
|
|
88
|
+ lineHeight: 1.5,
|
|
52
|
89
|
|
|
53
|
90
|
'& a': {
|
|
54
|
91
|
color: '$bounds',
|
|
|
@@ -58,32 +95,60 @@ const Content = styled('div', {
|
|
58
|
95
|
borderRadius: '2px',
|
|
59
|
96
|
},
|
|
60
|
97
|
|
|
61
|
|
- '& p': {
|
|
62
|
|
- fontFamily: '$body',
|
|
63
|
|
- fontSize: '$3',
|
|
64
|
|
- lineHeight: 1.5,
|
|
65
|
|
- },
|
|
|
98
|
+ '& p': {},
|
|
66
|
99
|
|
|
67
|
100
|
'& video': {
|
|
68
|
101
|
maxWidth: '100%',
|
|
69
|
|
- boxShadow: '0px 2px 4px rgba(0,0,0,.2)',
|
|
|
102
|
+ border: '1px solid $overlay',
|
|
70
|
103
|
borderRadius: '4px',
|
|
71
|
104
|
overflow: 'hidden',
|
|
72
|
105
|
margin: '16px 0',
|
|
73
|
106
|
},
|
|
|
107
|
+
|
|
|
108
|
+ '& iframe': {
|
|
|
109
|
+ border: 'none',
|
|
|
110
|
+ backgroundColor: 'none',
|
|
|
111
|
+ background: 'none',
|
|
|
112
|
+ },
|
|
|
113
|
+})
|
|
|
114
|
+
|
|
|
115
|
+const ButtonGroup = styled('div', {
|
|
|
116
|
+ display: 'grid',
|
|
|
117
|
+ gap: '16px',
|
|
|
118
|
+ margin: '40px 0 32px 0',
|
|
|
119
|
+})
|
|
|
120
|
+
|
|
|
121
|
+const Detail = styled('p', {
|
|
|
122
|
+ fontSize: '$2',
|
|
|
123
|
+ textAlign: 'center',
|
|
74
|
124
|
})
|
|
75
|
125
|
|
|
76
|
126
|
const Button = styled('button', {
|
|
|
127
|
+ cursor: 'pointer',
|
|
77
|
128
|
width: '100%',
|
|
78
|
129
|
padding: '12px 0',
|
|
79
|
130
|
display: 'flex',
|
|
80
|
131
|
alignItems: 'center',
|
|
81
|
132
|
justifyContent: 'center',
|
|
82
|
133
|
font: '$ui',
|
|
83
|
|
- fontWeight: 'bold',
|
|
84
|
134
|
fontSize: '$3',
|
|
85
|
|
- background: '$bounds',
|
|
86
|
135
|
color: '$panel',
|
|
87
|
136
|
border: 'none',
|
|
88
|
|
- margin: '32px 0 8px 0',
|
|
|
137
|
+ borderRadius: '4px',
|
|
|
138
|
+
|
|
|
139
|
+ variants: {
|
|
|
140
|
+ variant: {
|
|
|
141
|
+ primary: {
|
|
|
142
|
+ fontWeight: 'bold',
|
|
|
143
|
+ background: '$bounds',
|
|
|
144
|
+ color: '$panel',
|
|
|
145
|
+ boxShadow: '0px 2px 4px rgba(0,0,0,.2)',
|
|
|
146
|
+ },
|
|
|
147
|
+ secondary: {
|
|
|
148
|
+ border: '1px solid $overlay',
|
|
|
149
|
+ background: 'transparent',
|
|
|
150
|
+ color: '$muted',
|
|
|
151
|
+ },
|
|
|
152
|
+ },
|
|
|
153
|
+ },
|
|
89
|
154
|
})
|