2021-06-02 23:15:28 +00:00
|
|
|
import { useQuery } from '@apollo/client'
|
|
|
|
import gql from 'graphql-tag'
|
2021-09-02 23:27:11 +00:00
|
|
|
import { Container, OverlayTrigger, Popover } from 'react-bootstrap'
|
2021-06-02 23:15:28 +00:00
|
|
|
import { CopyInput } from './form'
|
2021-06-04 01:55:23 +00:00
|
|
|
import styles from './footer.module.css'
|
2021-06-30 23:01:28 +00:00
|
|
|
import Texas from '../svgs/texas.svg'
|
|
|
|
import Github from '../svgs/github-fill.svg'
|
2021-07-15 23:06:21 +00:00
|
|
|
import Link from 'next/link'
|
2021-11-09 17:38:58 +00:00
|
|
|
import useDarkMode from 'use-dark-mode'
|
|
|
|
import Sun from '../svgs/sun-fill.svg'
|
|
|
|
import Moon from '../svgs/moon-fill.svg'
|
2022-10-04 22:34:28 +00:00
|
|
|
import No from '../svgs/no.svg'
|
|
|
|
import Bolt from '../svgs/bolt.svg'
|
2023-05-05 21:22:22 +00:00
|
|
|
import Amboss from '../svgs/amboss.svg'
|
2021-11-09 23:04:15 +00:00
|
|
|
import { useEffect, useState } from 'react'
|
2023-07-06 17:43:51 +00:00
|
|
|
import Rewards from './footer-rewards'
|
2021-11-04 18:22:03 +00:00
|
|
|
|
2021-11-16 20:55:40 +00:00
|
|
|
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
|
|
// if you update this you need to update /public/darkmode
|
|
|
|
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
|
|
const COLORS = {
|
|
|
|
light: {
|
2023-05-01 20:58:30 +00:00
|
|
|
body: '#f5f5f7',
|
2021-11-16 20:55:40 +00:00
|
|
|
color: '#212529',
|
|
|
|
navbarVariant: 'light',
|
2022-02-09 19:15:38 +00:00
|
|
|
navLink: 'rgba(0, 0, 0, 0.55)',
|
2021-11-16 20:55:40 +00:00
|
|
|
navLinkFocus: 'rgba(0, 0, 0, 0.7)',
|
|
|
|
navLinkActive: 'rgba(0, 0, 0, 0.9)',
|
|
|
|
borderColor: '#ced4da',
|
|
|
|
inputBg: '#ffffff',
|
|
|
|
inputDisabledBg: '#e9ecef',
|
|
|
|
dropdownItemColor: 'rgba(0, 0, 0, 0.7)',
|
|
|
|
dropdownItemColorHover: 'rgba(0, 0, 0, 0.9)',
|
|
|
|
commentBg: 'rgba(0, 0, 0, 0.03)',
|
2022-04-15 16:56:01 +00:00
|
|
|
clickToContextColor: 'rgba(0, 0, 0, 0.07)',
|
2022-02-09 19:15:38 +00:00
|
|
|
brandColor: 'rgba(0, 0, 0, 0.9)',
|
|
|
|
grey: '#707070',
|
|
|
|
link: '#007cbe',
|
2023-01-05 19:24:09 +00:00
|
|
|
toolbarActive: 'rgba(0, 0, 0, 0.10)',
|
|
|
|
toolbarHover: 'rgba(0, 0, 0, 0.20)',
|
|
|
|
toolbar: '#ffffff',
|
|
|
|
quoteBar: 'rgb(206, 208, 212)',
|
|
|
|
quoteColor: 'rgb(101, 103, 107)',
|
2022-02-09 19:15:38 +00:00
|
|
|
linkHover: '#004a72',
|
2022-08-31 20:22:25 +00:00
|
|
|
linkVisited: '#537587'
|
2021-11-16 20:55:40 +00:00
|
|
|
},
|
|
|
|
dark: {
|
|
|
|
body: '#000000',
|
|
|
|
inputBg: '#000000',
|
|
|
|
inputDisabledBg: '#000000',
|
2022-02-09 19:15:38 +00:00
|
|
|
navLink: 'rgba(255, 255, 255, 0.55)',
|
2021-11-16 20:55:40 +00:00
|
|
|
navLinkFocus: 'rgba(255, 255, 255, 0.75)',
|
|
|
|
navLinkActive: 'rgba(255, 255, 255, 0.9)',
|
|
|
|
borderColor: 'rgba(255, 255, 255, 0.5)',
|
|
|
|
dropdownItemColor: 'rgba(255, 255, 255, 0.7)',
|
|
|
|
dropdownItemColorHover: 'rgba(255, 255, 255, 0.9)',
|
|
|
|
commentBg: 'rgba(255, 255, 255, 0.04)',
|
2022-04-15 16:56:01 +00:00
|
|
|
clickToContextColor: 'rgba(255, 255, 255, 0.2)',
|
2021-11-16 20:55:40 +00:00
|
|
|
color: '#f8f9fa',
|
2022-02-09 19:15:38 +00:00
|
|
|
brandColor: 'var(--primary)',
|
|
|
|
grey: '#969696',
|
|
|
|
link: '#2e99d1',
|
2023-01-05 19:24:09 +00:00
|
|
|
toolbarActive: 'rgba(255, 255, 255, 0.10)',
|
|
|
|
toolbarHover: 'rgba(255, 255, 255, 0.20)',
|
|
|
|
toolbar: '#3e3f3f',
|
|
|
|
quoteBar: 'rgb(158, 159, 163)',
|
|
|
|
quoteColor: 'rgb(141, 144, 150)',
|
2022-02-09 19:15:38 +00:00
|
|
|
linkHover: '#007cbe',
|
2022-08-31 20:22:25 +00:00
|
|
|
linkVisited: '#56798E'
|
2021-11-16 20:55:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const handleThemeChange = (dark) => {
|
|
|
|
const root = window.document.documentElement
|
|
|
|
const colors = COLORS[dark ? 'dark' : 'light']
|
|
|
|
Object.entries(colors).forEach(([varName, value]) => {
|
|
|
|
const cssVarName = `--theme-${varName}`
|
|
|
|
root.style.setProperty(cssVarName, value)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-05-04 18:17:02 +00:00
|
|
|
const RssPopover = (
|
|
|
|
<Popover>
|
2023-06-12 19:48:35 +00:00
|
|
|
<Popover.Content style={{ fontWeight: 500, fontSize: '.9rem' }}>
|
|
|
|
<div className='d-flex justify-content-center'>
|
|
|
|
<a href='/rss' className='nav-link p-0 d-inline-flex'>
|
|
|
|
home
|
|
|
|
</a>
|
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
|
|
|
<a href='/~bitcoin/rss' className='nav-link p-0 d-inline-flex'>
|
|
|
|
bitcoin
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div className='d-flex justify-content-center'>
|
|
|
|
<a href='/~nostr/rss' className='nav-link p-0 d-inline-flex'>
|
|
|
|
nostr
|
|
|
|
</a>
|
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
|
|
|
<a href='/~tech/rss' className='nav-link p-0 d-inline-flex'>
|
|
|
|
tech
|
|
|
|
</a>
|
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
|
|
|
<a href='/~jobs/rss' className='nav-link p-0 d-inline-flex'>
|
|
|
|
jobs
|
|
|
|
</a>
|
|
|
|
</div>
|
2023-05-04 18:17:02 +00:00
|
|
|
</Popover.Content>
|
|
|
|
</Popover>
|
|
|
|
)
|
|
|
|
|
2023-05-04 23:15:08 +00:00
|
|
|
const SocialsPopover = (
|
|
|
|
<Popover>
|
|
|
|
<Popover.Content style={{ fontWeight: 500, fontSize: '.9rem' }}>
|
|
|
|
<a
|
|
|
|
href='https://snort.social/p/npub1jfujw6llhq7wuvu5detycdsq5v5yqf56sgrdq8wlgrryx2a2p09svwm0gx' className='nav-link p-0 d-inline-flex'
|
|
|
|
target='_blank' rel='noreferrer'
|
|
|
|
>
|
|
|
|
nostr
|
|
|
|
</a>
|
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
|
|
|
<a
|
|
|
|
href='https://twitter.com/stacker_news' className='nav-link p-0 d-inline-flex'
|
|
|
|
target='_blank' rel='noreferrer'
|
|
|
|
>
|
|
|
|
twitter
|
|
|
|
</a>
|
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
|
|
|
<a
|
|
|
|
href='https://www.youtube.com/@stackernews' className='nav-link p-0 d-inline-flex'
|
|
|
|
target='_blank' rel='noreferrer'
|
|
|
|
>
|
2023-05-05 16:54:28 +00:00
|
|
|
youtube
|
|
|
|
</a>
|
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
|
|
|
<a
|
|
|
|
href='https://www.fountain.fm/show/Mg1AWuvkeZSFhsJZ3BW2' className='nav-link p-0 d-inline-flex'
|
|
|
|
target='_blank' rel='noreferrer'
|
|
|
|
>
|
|
|
|
pod
|
2023-05-04 23:15:08 +00:00
|
|
|
</a>
|
|
|
|
</Popover.Content>
|
|
|
|
</Popover>
|
|
|
|
)
|
|
|
|
|
2021-09-02 23:27:11 +00:00
|
|
|
const ChatPopover = (
|
|
|
|
<Popover>
|
2022-02-09 19:15:38 +00:00
|
|
|
<Popover.Content style={{ fontWeight: 500, fontSize: '.9rem' }}>
|
2021-09-02 23:27:11 +00:00
|
|
|
<a
|
2023-05-04 21:41:56 +00:00
|
|
|
href='https://tribes.sphinx.chat/t/stackerzchat' className='nav-link p-0 d-inline-flex'
|
2021-09-02 23:27:11 +00:00
|
|
|
target='_blank' rel='noreferrer'
|
|
|
|
>
|
|
|
|
sphinx
|
|
|
|
</a>
|
2023-05-04 21:41:56 +00:00
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
2021-09-02 23:27:11 +00:00
|
|
|
<a
|
2023-05-04 21:41:56 +00:00
|
|
|
href='https://t.me/stackernews' className='nav-link p-0 d-inline-flex'
|
2021-09-02 23:27:11 +00:00
|
|
|
target='_blank' rel='noreferrer'
|
|
|
|
>
|
|
|
|
telegram
|
|
|
|
</a>
|
2023-06-16 23:04:56 +00:00
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
|
|
|
<a
|
|
|
|
href='https://simplex.chat/contact#/?v=1-2&smp=smp%3A%2F%2F6iIcWT_dF2zN_w5xzZEY7HI2Prbh3ldP07YTyDexPjE%3D%40smp10.simplex.im%2FebLYaEFGjsD3uK4fpE326c5QI1RZSxau%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAV086Oj5yCsavWzIbRMCVuF6jq793Tt__rWvCec__viI%253D%26srv%3Drb2pbttocvnbrngnwziclp2f4ckjq65kebafws6g4hy22cdaiv5dwjqd.onion&data=%7B%22type%22%3A%22group%22%2C%22groupLinkId%22%3A%22cZwSGoQhyOUulzp7rwCdWQ%3D%3D%22%7D' className='nav-link p-0 d-inline-flex'
|
|
|
|
target='_blank' rel='noreferrer'
|
|
|
|
>
|
|
|
|
simplex
|
|
|
|
</a>
|
2021-09-02 23:27:11 +00:00
|
|
|
</Popover.Content>
|
|
|
|
</Popover>
|
|
|
|
)
|
|
|
|
|
2022-06-10 19:20:33 +00:00
|
|
|
const AnalyticsPopover = (
|
|
|
|
<Popover>
|
|
|
|
<Popover.Content style={{ fontWeight: 500, fontSize: '.9rem' }}>
|
|
|
|
<a
|
2023-05-04 21:41:56 +00:00
|
|
|
href='https://plausible.io/stacker.news' className='nav-link p-0 d-inline-flex'
|
2022-06-10 19:20:33 +00:00
|
|
|
target='_blank' rel='noreferrer'
|
|
|
|
>
|
|
|
|
visitors
|
|
|
|
</a>
|
2023-05-04 21:41:56 +00:00
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
2022-12-01 21:31:04 +00:00
|
|
|
<Link href='/users/day' passHref>
|
2023-05-04 21:41:56 +00:00
|
|
|
<a className='nav-link p-0 d-inline-flex'>
|
2022-06-24 15:38:00 +00:00
|
|
|
users
|
2022-06-10 19:20:33 +00:00
|
|
|
</a>
|
|
|
|
</Link>
|
|
|
|
</Popover.Content>
|
|
|
|
</Popover>
|
|
|
|
)
|
|
|
|
|
2021-08-26 21:22:37 +00:00
|
|
|
export default function Footer ({ noLinks }) {
|
2021-06-02 23:15:28 +00:00
|
|
|
const query = gql`
|
|
|
|
{
|
|
|
|
connectAddress
|
|
|
|
}
|
|
|
|
`
|
2021-10-28 17:03:26 +00:00
|
|
|
const { data } = useQuery(query, { fetchPolicy: 'cache-first' })
|
2021-06-02 23:15:28 +00:00
|
|
|
|
2021-11-09 17:38:58 +00:00
|
|
|
const darkMode = useDarkMode(false, {
|
|
|
|
// set this so it doesn't try to use classes
|
2021-11-09 22:43:56 +00:00
|
|
|
onChange: handleThemeChange
|
2021-11-09 17:38:58 +00:00
|
|
|
})
|
|
|
|
|
2021-11-09 23:04:15 +00:00
|
|
|
const [mounted, setMounted] = useState()
|
2022-10-04 22:34:28 +00:00
|
|
|
const [lightning, setLightning] = useState(undefined)
|
2021-11-09 23:04:15 +00:00
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
setMounted(true)
|
2022-10-04 22:34:28 +00:00
|
|
|
setLightning(localStorage.getItem('lnAnimate') || 'yes')
|
2023-01-10 15:40:56 +00:00
|
|
|
}, [])
|
2021-11-09 23:04:15 +00:00
|
|
|
|
2022-10-04 22:34:28 +00:00
|
|
|
const toggleLightning = () => {
|
|
|
|
if (lightning === 'yes') {
|
|
|
|
localStorage.setItem('lnAnimate', 'no')
|
|
|
|
setLightning('no')
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('lnAnimate', 'yes')
|
|
|
|
setLightning('yes')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const DarkModeIcon = darkMode.value ? Sun : Moon
|
|
|
|
const LnIcon = lightning === 'yes' ? No : Bolt
|
|
|
|
|
2023-06-01 17:19:45 +00:00
|
|
|
const version = process.env.NEXT_PUBLIC_COMMIT_HASH
|
|
|
|
|
2021-06-02 23:15:28 +00:00
|
|
|
return (
|
|
|
|
<footer>
|
2021-08-26 21:22:37 +00:00
|
|
|
<Container className='mb-3 mt-4'>
|
|
|
|
{!noLinks &&
|
2022-10-04 17:19:15 +00:00
|
|
|
<>
|
2021-11-09 23:04:15 +00:00
|
|
|
{mounted &&
|
2023-05-01 20:58:30 +00:00
|
|
|
<div className='mb-1'>
|
|
|
|
<DarkModeIcon onClick={() => darkMode.toggle()} width={20} height={20} className='fill-grey theme' />
|
|
|
|
<LnIcon onClick={toggleLightning} width={20} height={20} className='ml-2 fill-grey theme' />
|
2021-11-09 23:04:15 +00:00
|
|
|
</div>}
|
2022-12-08 00:04:02 +00:00
|
|
|
<div className='mb-0' style={{ fontWeight: 500 }}>
|
2023-07-06 17:43:51 +00:00
|
|
|
<Rewards />
|
2022-12-08 00:04:02 +00:00
|
|
|
</div>
|
2022-10-04 21:21:42 +00:00
|
|
|
<div className='mb-0' style={{ fontWeight: 500 }}>
|
2022-10-04 17:19:15 +00:00
|
|
|
<OverlayTrigger trigger='click' placement='top' overlay={AnalyticsPopover} rootClose>
|
2023-05-04 21:41:56 +00:00
|
|
|
<div className='nav-link p-0 p-0 d-inline-flex' style={{ cursor: 'pointer' }}>
|
2022-10-04 17:19:15 +00:00
|
|
|
analytics
|
|
|
|
</div>
|
|
|
|
</OverlayTrigger>
|
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
|
|
|
<OverlayTrigger trigger='click' placement='top' overlay={ChatPopover} rootClose>
|
2023-05-04 21:41:56 +00:00
|
|
|
<div className='nav-link p-0 p-0 d-inline-flex' style={{ cursor: 'pointer' }}>
|
2022-10-04 17:19:15 +00:00
|
|
|
chat
|
|
|
|
</div>
|
|
|
|
</OverlayTrigger>
|
2022-10-10 21:58:50 +00:00
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
2023-05-04 23:15:08 +00:00
|
|
|
<OverlayTrigger trigger='click' placement='top' overlay={SocialsPopover} rootClose>
|
|
|
|
<div className='nav-link p-0 p-0 d-inline-flex' style={{ cursor: 'pointer' }}>
|
|
|
|
socials
|
|
|
|
</div>
|
|
|
|
</OverlayTrigger>
|
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
2023-05-04 18:17:02 +00:00
|
|
|
<OverlayTrigger trigger='click' placement='top' overlay={RssPopover} rootClose>
|
2023-05-04 21:41:56 +00:00
|
|
|
<div className='nav-link p-0 p-0 d-inline-flex' style={{ cursor: 'pointer' }}>
|
2023-05-04 18:17:02 +00:00
|
|
|
rss
|
|
|
|
</div>
|
|
|
|
</OverlayTrigger>
|
2022-10-04 17:19:15 +00:00
|
|
|
</div>
|
|
|
|
<div className='mb-2' style={{ fontWeight: 500 }}>
|
|
|
|
<Link href='/faq' passHref>
|
2023-05-04 21:41:56 +00:00
|
|
|
<a className='nav-link p-0 p-0 d-inline-flex'>
|
2022-10-04 17:19:15 +00:00
|
|
|
faq
|
|
|
|
</a>
|
|
|
|
</Link>
|
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
2022-10-23 15:43:39 +00:00
|
|
|
<Link href='/guide' passHref>
|
2023-05-04 21:41:56 +00:00
|
|
|
<a className='nav-link p-0 p-0 d-inline-flex'>
|
2022-10-23 15:43:39 +00:00
|
|
|
guide
|
|
|
|
</a>
|
|
|
|
</Link>
|
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
2022-10-04 17:19:15 +00:00
|
|
|
<Link href='/story' passHref>
|
2023-05-04 21:41:56 +00:00
|
|
|
<a className='nav-link p-0 p-0 d-inline-flex'>
|
2022-10-04 17:19:15 +00:00
|
|
|
story
|
|
|
|
</a>
|
|
|
|
</Link>
|
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
2022-10-10 21:58:50 +00:00
|
|
|
<Link href='/changes' passHref>
|
2023-05-04 21:41:56 +00:00
|
|
|
<a className='nav-link p-0 p-0 d-inline-flex'>
|
2022-10-10 21:58:50 +00:00
|
|
|
changes
|
|
|
|
</a>
|
|
|
|
</Link>
|
2022-10-04 17:19:15 +00:00
|
|
|
<span className='mx-2 text-muted'> \ </span>
|
2022-10-10 21:58:50 +00:00
|
|
|
<Link href='/privacy' passHref>
|
2023-05-04 21:41:56 +00:00
|
|
|
<a className='nav-link p-0 p-0 d-inline-flex'>
|
2022-10-10 21:58:50 +00:00
|
|
|
privacy
|
|
|
|
</a>
|
|
|
|
</Link>
|
2022-10-04 17:19:15 +00:00
|
|
|
</div>
|
|
|
|
</>}
|
2021-06-30 23:01:28 +00:00
|
|
|
{data &&
|
2021-06-02 23:31:07 +00:00
|
|
|
<div
|
2023-05-09 22:52:24 +00:00
|
|
|
className={`text-small mx-auto mb-2 ${styles.connect}`}
|
2021-06-02 23:31:07 +00:00
|
|
|
>
|
2021-06-02 23:15:28 +00:00
|
|
|
<span className='nav-item text-muted mr-2'>connect:</span>
|
|
|
|
<CopyInput
|
|
|
|
size='sm'
|
2021-06-02 23:31:07 +00:00
|
|
|
groupClassName='mb-0 w-100'
|
2021-06-02 23:15:28 +00:00
|
|
|
readOnly
|
2022-08-18 18:15:24 +00:00
|
|
|
noForm
|
2021-06-02 23:15:28 +00:00
|
|
|
placeholder={data.connectAddress}
|
|
|
|
/>
|
2023-05-05 21:22:22 +00:00
|
|
|
<a
|
|
|
|
href='https://amboss.space/node/03cc1d0932bb99b0697f5b5e5961b83ab7fd66f1efc4c9f5c7bad66c1bcbe78f02'
|
|
|
|
target='_blank' rel='noreferrer'
|
|
|
|
>
|
|
|
|
<Amboss className='ml-2 theme' width={20} height={20} />
|
|
|
|
</a>
|
2021-06-30 23:01:28 +00:00
|
|
|
</div>}
|
2023-05-09 22:52:24 +00:00
|
|
|
<small className='d-flex justify-content-center align-items-center text-muted flex-wrap'>
|
|
|
|
<a className={`${styles.contrastLink} d-flex align-items-center`} href='https://github.com/stackernews/stacker.news' target='_blank' rel='noreferrer'>
|
|
|
|
FOSS <Github width={20} height={20} className='mx-1' />
|
2021-11-09 22:43:56 +00:00
|
|
|
</a>
|
2023-05-09 22:52:24 +00:00
|
|
|
made in Austin<Texas className='ml-1' width={20} height={20} />
|
|
|
|
<span className='ml-1'>by</span>
|
|
|
|
<span>
|
|
|
|
<Link href='/k00b' passHref>
|
|
|
|
<a className='ml-1'>@k00b</a>
|
|
|
|
</Link>
|
|
|
|
<Link href='/kr' passHref>
|
|
|
|
<a className='ml-1'>@kr</a>
|
|
|
|
</Link>
|
|
|
|
<Link href='/ekzyis' passHref>
|
|
|
|
<a className='ml-1'>@ekzyis</a>
|
|
|
|
</Link>
|
2021-06-30 23:01:28 +00:00
|
|
|
</span>
|
|
|
|
</small>
|
2023-06-01 17:57:31 +00:00
|
|
|
{version &&
|
|
|
|
<div className={styles.version}>
|
|
|
|
running <a className='text-reset' href={`https://github.com/stackernews/stacker.news/commit/${version}`}>{version}</a>
|
|
|
|
</div>}
|
2021-06-30 23:01:28 +00:00
|
|
|
</Container>
|
2021-06-02 23:15:28 +00:00
|
|
|
</footer>
|
|
|
|
)
|
|
|
|
}
|