2021-11-06 11:16:30 +00:00
|
|
|
import { styled } from 'styles'
|
2021-09-04 12:02:13 +00:00
|
|
|
import { getSession, signin, signout, useSession } from 'next-auth/client'
|
|
|
|
import { GetServerSideProps } from 'next'
|
2021-09-04 12:04:49 +00:00
|
|
|
import Link from 'next/link'
|
2021-09-04 12:02:13 +00:00
|
|
|
import React from 'react'
|
2021-09-06 13:37:48 +00:00
|
|
|
import Head from 'next/head'
|
2021-09-04 12:02:13 +00:00
|
|
|
|
|
|
|
export default function Sponsorware(): JSX.Element {
|
|
|
|
const [session, loading] = useSession()
|
|
|
|
|
|
|
|
return (
|
2021-09-06 13:37:48 +00:00
|
|
|
<>
|
|
|
|
<Head>
|
2021-11-16 16:31:50 +00:00
|
|
|
<title>tldraw</title>
|
2021-09-06 13:37:48 +00:00
|
|
|
</Head>
|
2021-11-03 16:46:33 +00:00
|
|
|
<StyledOuterContent>
|
|
|
|
<StyledContent
|
|
|
|
size={{
|
|
|
|
'@sm': 'small',
|
|
|
|
}}
|
2021-09-06 13:37:48 +00:00
|
|
|
>
|
2021-11-16 16:01:29 +00:00
|
|
|
<h1>Tldraw (is sponsorware)</h1>
|
2021-09-06 13:37:48 +00:00
|
|
|
<p>
|
2021-11-16 16:01:29 +00:00
|
|
|
Hey, thanks for visiting <Link href="/">Tldraw</Link>, a tiny little drawing app by{' '}
|
2021-09-06 13:37:48 +00:00
|
|
|
<a
|
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer nofollow noopener"
|
|
|
|
href="https://twitter.com/steveruizok"
|
|
|
|
>
|
|
|
|
steveruizok
|
|
|
|
</a>{' '}
|
|
|
|
and friends .
|
|
|
|
</p>
|
|
|
|
<video autoPlay muted playsInline onClick={(e) => e.currentTarget.play()}>
|
|
|
|
<source src="images/hello.mp4" type="video/mp4" />
|
|
|
|
</video>
|
|
|
|
<p>This project is currently: </p>
|
|
|
|
<ul>
|
|
|
|
<li>in development</li>
|
|
|
|
<li>only available for my sponsors</li>
|
|
|
|
</ul>
|
|
|
|
<p>
|
|
|
|
If you'd like to try it out,{' '}
|
|
|
|
<a
|
|
|
|
href="https://github.com/sponsors/steveruizok"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
sponsor me on Github
|
|
|
|
</a>{' '}
|
|
|
|
(at any level) and sign in below.
|
|
|
|
</p>
|
2021-11-03 16:46:33 +00:00
|
|
|
<StyledButtonGroup>
|
2021-09-06 13:37:48 +00:00
|
|
|
{session ? (
|
|
|
|
<>
|
2021-11-03 16:46:33 +00:00
|
|
|
<StyledButton variant="secondary" onClick={() => signout()}>
|
2021-09-06 13:37:48 +00:00
|
|
|
Sign Out
|
2021-11-03 16:46:33 +00:00
|
|
|
</StyledButton>
|
|
|
|
<StyledDetail>
|
2021-09-06 13:37:48 +00:00
|
|
|
Signed in as {session?.user?.name} ({session?.user?.email}), but it looks like
|
|
|
|
you're not yet a sponsor.
|
|
|
|
<br />
|
|
|
|
Something wrong? Try <Link href="/">reloading the page</Link> or DM me on{' '}
|
|
|
|
<a
|
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer nofollow noopener"
|
|
|
|
href="https://twitter.com/steveruizok"
|
|
|
|
>
|
|
|
|
Twitter
|
|
|
|
</a>
|
|
|
|
.
|
2021-11-03 16:46:33 +00:00
|
|
|
</StyledDetail>
|
2021-09-06 13:37:48 +00:00
|
|
|
</>
|
|
|
|
) : (
|
|
|
|
<>
|
2021-11-03 16:46:33 +00:00
|
|
|
<StyledButton variant="primary" onClick={() => signin('github')}>
|
2021-09-06 13:37:48 +00:00
|
|
|
{loading ? 'Loading...' : 'Sign in With Github'}
|
2021-11-03 16:46:33 +00:00
|
|
|
</StyledButton>
|
|
|
|
<StyledDetail>Already a sponsor? Just sign in to visit the app.</StyledDetail>
|
2021-09-06 13:37:48 +00:00
|
|
|
</>
|
|
|
|
)}
|
2021-11-03 16:46:33 +00:00
|
|
|
</StyledButtonGroup>
|
|
|
|
</StyledContent>
|
|
|
|
</StyledOuterContent>
|
2021-09-06 13:37:48 +00:00
|
|
|
</>
|
2021-09-04 12:02:13 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export const getServerSideProps: GetServerSideProps = async (context) => {
|
|
|
|
const session = await getSession(context)
|
|
|
|
|
|
|
|
return {
|
|
|
|
props: {
|
|
|
|
session,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-03 16:46:33 +00:00
|
|
|
const StyledOuterContent = styled('div', {
|
2021-09-04 12:02:13 +00:00
|
|
|
backgroundColor: '$canvas',
|
|
|
|
padding: '8px 8px 64px 8px',
|
|
|
|
margin: '0 auto',
|
|
|
|
overflow: 'scroll',
|
|
|
|
position: 'fixed',
|
|
|
|
display: 'flex',
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'flex-start',
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
right: 0,
|
|
|
|
bottom: 0,
|
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
|
|
|
})
|
|
|
|
|
2021-11-03 16:46:33 +00:00
|
|
|
const StyledContent = styled('div', {
|
2021-09-04 12:02:13 +00:00
|
|
|
width: '720px',
|
|
|
|
padding: '8px 16px',
|
|
|
|
maxWidth: '100%',
|
|
|
|
backgroundColor: '$panel',
|
|
|
|
borderRadius: '4px',
|
|
|
|
boxShadow: '$12',
|
|
|
|
color: '$text',
|
|
|
|
fontSize: '$2',
|
|
|
|
fontFamily: '$body',
|
|
|
|
lineHeight: 1.5,
|
|
|
|
|
|
|
|
'& a': {
|
|
|
|
color: '$bounds',
|
|
|
|
backgroundColor: '$boundsBg',
|
|
|
|
padding: '2px 4px',
|
|
|
|
margin: '0 -3px',
|
|
|
|
borderRadius: '2px',
|
|
|
|
},
|
|
|
|
|
|
|
|
'& p': {
|
|
|
|
borderRadius: '8px',
|
|
|
|
},
|
|
|
|
|
|
|
|
'& video': {
|
|
|
|
maxWidth: '100%',
|
|
|
|
border: '1px solid $overlay',
|
|
|
|
borderRadius: '4px',
|
|
|
|
overflow: 'hidden',
|
|
|
|
margin: '16px 0',
|
|
|
|
},
|
|
|
|
|
|
|
|
'& iframe': {
|
|
|
|
border: 'none',
|
|
|
|
backgroundColor: 'none',
|
|
|
|
background: 'none',
|
|
|
|
},
|
|
|
|
|
|
|
|
variants: {
|
|
|
|
size: {
|
|
|
|
small: {
|
|
|
|
fontSize: '$3',
|
|
|
|
padding: '32px',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2021-11-03 16:46:33 +00:00
|
|
|
const StyledButtonGroup = styled('div', {
|
2021-09-04 12:02:13 +00:00
|
|
|
display: 'grid',
|
|
|
|
gap: '16px',
|
|
|
|
margin: '40px 0 32px 0',
|
|
|
|
})
|
|
|
|
|
2021-11-03 16:46:33 +00:00
|
|
|
const StyledDetail = styled('p', {
|
2021-09-04 12:02:13 +00:00
|
|
|
fontSize: '$2',
|
|
|
|
textAlign: 'center',
|
|
|
|
})
|
|
|
|
|
2021-11-03 16:46:33 +00:00
|
|
|
const StyledButton = styled('button', {
|
2021-09-04 12:02:13 +00:00
|
|
|
cursor: 'pointer',
|
|
|
|
width: '100%',
|
|
|
|
padding: '12px 0',
|
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
font: '$ui',
|
|
|
|
fontSize: '$3',
|
|
|
|
color: '$panel',
|
|
|
|
border: 'none',
|
|
|
|
borderRadius: '4px',
|
|
|
|
|
|
|
|
variants: {
|
|
|
|
variant: {
|
|
|
|
primary: {
|
|
|
|
fontWeight: 'bold',
|
|
|
|
background: '$bounds',
|
|
|
|
color: '$panel',
|
|
|
|
boxShadow: '$4',
|
|
|
|
},
|
|
|
|
secondary: {
|
|
|
|
border: '1px solid $overlay',
|
|
|
|
background: 'transparent',
|
|
|
|
color: '$muted',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|