direct user to login on certain actions
This commit is contained in:
parent
a68da87382
commit
d8ae6ecb04
|
@ -47,9 +47,13 @@ export default function Header () {
|
|||
<Link href='/recent' passHref>
|
||||
<NavDropdown.Item>recent</NavDropdown.Item>
|
||||
</Link>
|
||||
{session
|
||||
? (
|
||||
<Link href='/post' passHref>
|
||||
<NavDropdown.Item>post</NavDropdown.Item>
|
||||
</Link>
|
||||
)
|
||||
: <NavDropdown.Item onClick={signIn}>post</NavDropdown.Item>}
|
||||
<NavDropdown.Item href='https://bitcoinerjobs.co' target='_blank'>jobs</NavDropdown.Item>
|
||||
</div>
|
||||
<NavDropdown.Divider />
|
||||
|
@ -84,9 +88,13 @@ export default function Header () {
|
|||
</Link>
|
||||
</Nav.Item>
|
||||
<Nav.Item className='d-md-flex d-none'>
|
||||
{session
|
||||
? (
|
||||
<Link href='/post' passHref>
|
||||
<Nav.Link className={styles.navLink}>post</Nav.Link>
|
||||
</Link>
|
||||
)
|
||||
: <Nav.Link className={styles.navLink} onClick={signIn}>post</Nav.Link>}
|
||||
</Nav.Item>
|
||||
<Nav.Item className='d-md-flex d-none'>
|
||||
<Nav.Link href='https://bitcoinerjobs.co' target='_blank' className={styles.navLink}>jobs</Nav.Link>
|
||||
|
|
|
@ -20,7 +20,7 @@ export default function Item ({ item, rank, children }) {
|
|||
<a className={`${styles.title} text-reset flex-md-shrink-0 mr-2`}>{item.title}</a>
|
||||
</Link>
|
||||
{item.url &&
|
||||
<a className={styles.link} href={item.url} rel={item.sats > 5 ? null : 'nofollow'}>
|
||||
<a className={styles.link} href={item.url} rel={item.sats + item.boost >= 10 ? null : 'nofollow'}>
|
||||
{item.url.replace(/(^https?:|^)\/\//, '')}
|
||||
</a>}
|
||||
</div>
|
||||
|
|
|
@ -2,8 +2,10 @@ import { LightningConsumer } from './lightning'
|
|||
import UpArrow from '../svgs/lightning-arrow.svg'
|
||||
import styles from './upvote.module.css'
|
||||
import { gql, useMutation } from '@apollo/client'
|
||||
import { signIn, useSession } from 'next-auth/client'
|
||||
|
||||
export default function UpVote ({ itemId, meSats, className }) {
|
||||
const [session] = useSession()
|
||||
const [vote] = useMutation(
|
||||
gql`
|
||||
mutation vote($id: ID!, $sats: Int!) {
|
||||
|
@ -39,7 +41,9 @@ export default function UpVote ({ itemId, meSats, className }) {
|
|||
${className || ''}
|
||||
${meSats ? (meSats > 1 ? styles.stimi : styles.voted) : ''}`
|
||||
}
|
||||
onClick={async () => {
|
||||
onClick={
|
||||
session
|
||||
? async () => {
|
||||
if (!itemId) return
|
||||
const { error } = await vote({ variables: { id: itemId, sats: 1 } })
|
||||
if (error) {
|
||||
|
@ -47,7 +51,9 @@ export default function UpVote ({ itemId, meSats, className }) {
|
|||
}
|
||||
|
||||
strike()
|
||||
}}
|
||||
}
|
||||
: signIn
|
||||
}
|
||||
/>}
|
||||
</LightningConsumer>
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue