fix issues with new linting

This commit is contained in:
keyan 2023-07-25 09:14:45 -05:00
parent 041b711c21
commit ab2046ab0b
38 changed files with 118 additions and 128 deletions

View File

@ -602,10 +602,10 @@ export default {
const optionCount = id
? await models.pollOption.count({
where: {
itemId: Number(id)
}
})
where: {
itemId: Number(id)
}
})
: 0
await ssValidate(pollSchema, data, models, optionCount)

View File

@ -110,7 +110,7 @@ export default function Comment ({
const [pendingSats, setPendingSats] = useState(0)
useEffect(() => {
setCollapse(localStorage.getItem(`commentCollapse:${item.id}`) || collapse)
setCollapse(window.localStorage.getItem(`commentCollapse:${item.id}`) || collapse)
if (Number(router.query.commentId) === Number(item.id)) {
// HACK wait for other comments to collapse if they're collapsed
setTimeout(() => {
@ -134,7 +134,7 @@ export default function Comment ({
>
<div className={`${itemStyles.item} ${styles.item}`}>
{item.meDontLike
? <Flag width={24} height={24} className={`${styles.dontLike}`} />
? <Flag width={24} height={24} className={styles.dontLike} />
: <UpVote item={item} className={styles.upvote} pendingSats={pendingSats} setPendingSats={setPendingSats} />}
<div className={`${itemStyles.hunk} ${styles.hunk}`}>
<div className='d-flex align-items-center'>
@ -160,13 +160,13 @@ export default function Comment ({
? <Eye
className={styles.collapser} height={10} width={10} onClick={() => {
setCollapse('nope')
localStorage.setItem(`commentCollapse:${item.id}`, 'nope')
window.localStorage.setItem(`commentCollapse:${item.id}`, 'nope')
}}
/>
: <EyeClose
className={styles.collapser} height={10} width={10} onClick={() => {
setCollapse('yep')
localStorage.setItem(`commentCollapse:${item.id}`, 'yep')
window.localStorage.setItem(`commentCollapse:${item.id}`, 'yep')
}}
/>)}
{topLevel && (
@ -197,7 +197,7 @@ export default function Comment ({
bottomedOut
? <DepthLimit item={item} />
: (
<div className={`${styles.children}`}>
<div className={styles.children}>
{!noReply &&
<Reply depth={depth + 1} item={item} replyOpen={replyOpen}>
{root.bounty && !bountyPaid && <PayBounty item={item} />}
@ -207,7 +207,7 @@ export default function Comment ({
{item.comments && !noComments
? item.comments.map((item) => (
<Comment depth={depth + 1} key={item.id} item={item} />
))
))
: null}
</div>
</div>
@ -227,7 +227,7 @@ function DepthLimit ({ item }) {
}
return (
<div className={`${styles.children}`}>
<div className={styles.children}>
<ReplyOnAnotherPage parentId={item.id} />
</div>
)

View File

@ -1,6 +1,7 @@
import { Component } from 'react'
import { StaticLayout } from './layout'
import styles from '../styles/404.module.css'
import Image from 'react-bootstrap/Image'
class ErrorBoundary extends Component {
constructor (props) {

View File

@ -128,15 +128,15 @@ export default function Footer ({ links = true }) {
const [lightning, setLightning] = useState(undefined)
useEffect(() => {
setLightning(localStorage.getItem('lnAnimate') || 'yes')
setLightning(window.localStorage.getItem('lnAnimate') || 'yes')
}, [])
const toggleLightning = () => {
if (lightning === 'yes') {
localStorage.setItem('lnAnimate', 'no')
window.localStorage.setItem('lnAnimate', 'no')
setLightning('no')
} else {
localStorage.setItem('lnAnimate', 'yes')
window.localStorage.setItem('lnAnimate', 'yes')
setLightning('yes')
}
}

View File

@ -31,9 +31,9 @@ export function SubmitButton ({
disabled={disabled || isSubmitting}
onClick={value
? e => {
setFieldValue('submit', value)
onClick && onClick(e)
}
setFieldValue('submit', value)
onClick && onClick(e)
}
: onClick}
{...props}
>
@ -231,10 +231,10 @@ function InputInner ({
if (overrideValue) {
helpers.setValue(overrideValue)
if (storageKey) {
localStorage.setItem(storageKey, overrideValue)
window.localStorage.setItem(storageKey, overrideValue)
}
} else if (storageKey) {
const draft = localStorage.getItem(storageKey)
const draft = window.localStorage.getItem(storageKey)
if (draft) {
// for some reason we have to turn off validation to get formik to
// not assume this is invalid
@ -264,7 +264,7 @@ function InputInner ({
field.onChange(e)
if (storageKey) {
localStorage.setItem(storageKey, e.target.value)
window.localStorage.setItem(storageKey, e.target.value)
}
if (onChange) {
@ -280,7 +280,7 @@ function InputInner ({
onClick={(e) => {
helpers.setValue('')
if (storageKey) {
localStorage.removeItem(storageKey)
window.localStorage.removeItem(storageKey)
}
if (onChange) {
onChange(formik, { target: { value: '' } })
@ -460,10 +460,10 @@ export function Form ({
onSubmit && onSubmit(values, ...args).then(() => {
if (!storageKeyPrefix) return
Object.keys(values).forEach(v => {
localStorage.removeItem(storageKeyPrefix + '-' + v)
window.localStorage.removeItem(storageKeyPrefix + '-' + v)
if (Array.isArray(values[v])) {
values[v].forEach(
(_, i) => localStorage.removeItem(`${storageKeyPrefix}-${v}[${i}]`))
(_, i) => window.localStorage.removeItem(`${storageKeyPrefix}-${v}[${i}]`))
}
}
)

View File

@ -134,10 +134,10 @@ function LurkerCorner ({ path }) {
const strike = useLightning()
useEffect(() => {
if (!localStorage.getItem('striked')) {
if (!window.localStorage.getItem('striked')) {
const to = setTimeout(() => {
strike()
localStorage.setItem('striked', 'yep')
window.localStorage.setItem('striked', 'yep')
}, randInRange(3000, 10000))
return () => clearTimeout(to)
}
@ -263,7 +263,7 @@ export default function Header ({ sub }) {
</Navbar>
<Navbar className='pt-0 pb-2 d-lg-none'>
<Nav
className={`${styles.navbarNav}`}
className={styles.navbarNav}
activeKey={topNavKey}
>
<NavItems className='me-1' prefix={prefix} sub={sub} />
@ -289,7 +289,7 @@ export function HeaderStatic () {
<div className='d-flex align-items-center'>
<Back />
<Link href='/' passHref legacyBehavior>
<Navbar.Brand className={`${styles.brand}`}>
<Navbar.Brand className={styles.brand}>
SN
</Navbar.Brand>
</Link>

View File

@ -25,7 +25,7 @@ const Tips = ({ setOValue }) => {
</Button>)
}
const getCustomTips = () => JSON.parse(localStorage.getItem('custom-tips')) || []
const getCustomTips = () => JSON.parse(window.localStorage.getItem('custom-tips')) || []
const addCustomTip = (amount) => {
if (defaultTips.includes(amount)) return
@ -33,7 +33,7 @@ const addCustomTip = (amount) => {
if (customTips.length > 3) {
customTips = customTips.slice(0, 3)
}
localStorage.setItem('custom-tips', JSON.stringify(customTips))
window.localStorage.setItem('custom-tips', JSON.stringify(customTips))
}
export default function ItemAct ({ onClose, itemId, act, strike }) {

View File

@ -22,7 +22,7 @@ export default function ItemJob ({ item, toc, rank, children }) {
{rank}
</div>)
: <div />}
<div className={`${styles.item}`}>
<div className={styles.item}>
<Link href={`/items/${item.id}`}>
<Image
src={item.uploadId ? `https://${process.env.NEXT_PUBLIC_AWS_UPLOAD_BUCKET}.s3.amazonaws.com/${item.uploadId}` : '/jobs-default.png'} width='42' height='42' className={styles.companyImage}
@ -37,7 +37,7 @@ export default function ItemJob ({ item, toc, rank, children }) {
<>{item.title}</>)}
</Link>
</div>
<div className={`${styles.other}`}>
<div className={styles.other}>
{item.company &&
<>
{item.company}
@ -78,7 +78,7 @@ export default function ItemJob ({ item, toc, rank, children }) {
</>}
</div>
{children && (
<div className={`${styles.children}`} style={{ marginLeft: 'calc(42px + .8rem)' }}>
<div className={styles.children} style={{ marginLeft: 'calc(42px + .8rem)' }}>
<div className='mb-3 d-flex'>
<Button
target='_blank' href={isEmail ? `mailto:${item.url}?subject=${encodeURIComponent(item.title)} via Stacker News` : item.url}

View File

@ -36,7 +36,7 @@ export default function Item ({ item, rank, belowTitle, right, full, children, s
<div className={`${styles.item} ${siblingComments ? 'pt-2' : ''}`}>
{item.position
? <Pin width={24} height={24} className={styles.pin} />
: item.meDontLike ? <Flag width={24} height={24} className={`${styles.dontLike}`} /> : <UpVote item={item} className={styles.upvote} pendingSats={pendingSats} setPendingSats={setPendingSats} />}
: item.meDontLike ? <Flag width={24} height={24} className={styles.dontLike} /> : <UpVote item={item} className={styles.upvote} pendingSats={pendingSats} setPendingSats={setPendingSats} />}
<div className={styles.hunk}>
<div className={`${styles.main} flex-wrap`}>
<Link href={`/items/${item.id}`} ref={titleRef} className={`${styles.title} text-reset me-2`}>
@ -54,7 +54,7 @@ export default function Item ({ item, rank, belowTitle, right, full, children, s
<>
{/* eslint-disable-next-line */}
<a
className={`${styles.link}`} target='_blank' href={item.url}
className={styles.link} target='_blank' href={item.url}
rel={item.sats + item.boost >= NOFOLLOW_LIMIT ? null : 'nofollow'}
>
{item.url.replace(/(^https?:|^)\/\//, '')}

View File

@ -175,7 +175,7 @@ function PromoteJob ({ item, sub, storageKeyPrefix }) {
const position = data?.auctionPosition
useEffect(() => {
const initialMaxBid = Number(item?.maxBid || localStorage.getItem(storageKeyPrefix + '-maxBid')) || 0
const initialMaxBid = Number(item?.maxBid || window.localStorage.getItem(storageKeyPrefix + '-maxBid')) || 0
getAuctionPosition({ variables: { id: item?.id, bid: initialMaxBid } })
setMonthly(satsMin2Mo(initialMaxBid))
}, [])

View File

@ -9,7 +9,7 @@ export class LightningProvider extends React.Component {
}
strike = () => {
const should = localStorage.getItem('lnAnimate') || 'yes'
const should = window.localStorage.getItem('lnAnimate') || 'yes'
if (should === 'yes') {
this.setState(state => {
return {

View File

@ -268,14 +268,14 @@ function NotificationAlert () {
const isSupported = sw.support.serviceWorker && sw.support.pushManager && sw.support.notification
if (isSupported) {
const isDefaultPermission = sw.permission.notification === 'default'
setShowAlert(isDefaultPermission && !localStorage.getItem('hideNotifyPrompt'))
setShowAlert(isDefaultPermission && !window.localStorage.getItem('hideNotifyPrompt'))
sw.registration?.pushManager.getSubscription().then(subscription => setHasSubscription(!!subscription))
setSupported(true)
}
}, [sw])
const close = () => {
localStorage.setItem('hideNotifyPrompt', 'yep')
window.localStorage.setItem('hideNotifyPrompt', 'yep')
setShowAlert(false)
}
@ -299,7 +299,7 @@ function NotificationAlert () {
}}
>Yes
</button>
<button className={`${styles.alertBtn}`} onClick={close}>No</button>
<button className={styles.alertBtn} onClick={close}>No</button>
</Alert>
)
: (

View File

@ -52,21 +52,21 @@ export default function Poll ({ item }) {
variant='outline-info' className={styles.pollButton}
onClick={me
? async () => {
try {
await pollVote({
variables: { id: v.id },
optimisticResponse: {
pollVote: v.id
}
})
} catch (error) {
if (error.toString().includes('insufficient funds')) {
showModal(onClose => {
return <FundError onClose={onClose} />
})
try {
await pollVote({
variables: { id: v.id },
optimisticResponse: {
pollVote: v.id
}
})
} catch (error) {
if (error.toString().includes('insufficient funds')) {
showModal(onClose => {
return <FundError onClose={onClose} />
})
}
}
}
: signIn}
>
{v.option}

View File

@ -38,7 +38,7 @@ export function PriceProvider ({ price, children }) {
export default function Price ({ className }) {
const [asSats, setAsSats] = useState(undefined)
useEffect(() => {
setAsSats(localStorage.getItem('asSats'))
setAsSats(window.localStorage.getItem('asSats'))
}, [])
const { price, fiatSymbol } = usePrice()
@ -46,13 +46,13 @@ export default function Price ({ className }) {
const handleClick = () => {
if (asSats === 'yep') {
localStorage.setItem('asSats', '1btc')
window.localStorage.setItem('asSats', '1btc')
setAsSats('1btc')
} else if (asSats === '1btc') {
localStorage.removeItem('asSats')
window.localStorage.removeItem('asSats')
setAsSats(undefined)
} else {
localStorage.setItem('asSats', 'yep')
window.localStorage.setItem('asSats', 'yep')
setAsSats('yep')
}
}

View File

@ -39,7 +39,7 @@ export default function Reply ({ item, onSuccess, replyOpen, children, placehold
const parentId = item.id
useEffect(() => {
setReply(replyOpen || !!localStorage.getItem('reply-' + parentId + '-' + 'text'))
setReply(replyOpen || !!window.localStorage.getItem('reply-' + parentId + '-' + 'text'))
}, [])
const [createComment] = useMutation(

View File

@ -101,7 +101,7 @@ export default function Search ({ sub }) {
</>}
</div>}
<div className={`${styles.active}`}>
<div className={styles.active}>
<Input
name='q'
required

View File

@ -13,7 +13,7 @@ export function SeoSearch ({ sub }) {
title={title}
description={desc}
openGraph={{
title: title,
title,
description: desc,
images: [
{

View File

@ -43,7 +43,7 @@ export const ServiceWorkerProvider = ({ children }) => {
const requestNotificationPermission = useCallback(() => {
// https://web.dev/push-notifications-subscribing-a-user/#requesting-permission
return new Promise(function (resolve, reject) {
const permission = Notification.requestPermission(function (result) {
const permission = window.Notification.requestPermission(function (result) {
resolve(result)
})
if (permission) {
@ -88,7 +88,7 @@ export const ServiceWorkerProvider = ({ children }) => {
notification: 'Notification' in window,
pushManager: 'PushManager' in window
})
setPermission({ notification: 'Notification' in window ? Notification.permission : 'denied' })
setPermission({ notification: 'Notification' in window ? window.Notification.permission : 'denied' })
}, [])
useEffect(() => {

View File

@ -11,7 +11,7 @@ export default function Snl ({ ignorePreference }) {
})
useEffect(() => {
const dismissed = localStorage.getItem('snl')
const dismissed = window.localStorage.getItem('snl')
if (!ignorePreference && dismissed && dismissed > new Date(dismissed) < dayPivot(new Date(), -6)) {
return
}
@ -27,7 +27,7 @@ export default function Snl ({ ignorePreference }) {
variant='info' className='fw-bold mb-3 d-flex py-2 flex-shrink align-items-center'
onClose={() => {
setShow(undefined)
localStorage.setItem('snl', new Date())
window.localStorage.setItem('snl', new Date())
}}
dismissible
>

View File

@ -88,7 +88,7 @@ export default memo(function Text ({ topLevel, noFragments, nofollow, onlyImgPro
if (imgRegexp.test(url)) {
setUrlCache((prev) => ({ ...prev, [url]: CACHE_STATES.IS_LOADED }))
} else if (!onlyImgProxy) {
const img = new Image()
const img = new window.Image()
imgCache.current[url] = img
setUrlCache((prev) => ({ ...prev, [url]: CACHE_STATES.IS_LOADING }))
@ -157,8 +157,8 @@ export default memo(function Text ({ topLevel, noFragments, nofollow, onlyImgPro
children = children?.map(e =>
typeof e === 'string'
? reactStringReplace(e, /:high\[([^\]]+)\]/g, (match, i) => {
return <mark key={`mark-${match}-${i}`}>{match}</mark>
})
return <mark key={`mark-${match}-${i}`}>{match}</mark>
})
: e)
return (

View File

@ -16,7 +16,7 @@ export default function Upload ({ as: Component, onSelect, onStarted, onError, o
const upload = file => {
onStarted && onStarted()
const img = new Image()
const img = new window.Image()
img.src = window.URL.createObjectURL(file)
img.onload = async () => {
let data

View File

@ -236,21 +236,21 @@ export default function UpVote ({ item, className, pendingSats, setPendingSats }
onShortPress={
me
? async (e) => {
if (!item) return
if (!item) return
// we can't tip ourselves
if (disabled) {
return
}
if (meSats) {
setVoteShow(false)
}
strike()
setPendingSats(pendingSats + sats)
// we can't tip ourselves
if (disabled) {
return
}
if (meSats) {
setVoteShow(false)
}
strike()
setPendingSats(pendingSats + sats)
}
: async () => await router.push({
pathname: '/signup',
query: { callbackUrl: window.location.origin + router.asPath }

View File

@ -3,21 +3,21 @@ const COMMENTS_NUM_PREFIX = 'commentsViewNum'
export function commentsViewed (item) {
if (!item.parentId && item.lastCommentAt) {
localStorage.setItem(`${COMMENTS_VIEW_PREFIX}:${item.id}`, new Date(item.lastCommentAt).getTime())
localStorage.setItem(`${COMMENTS_NUM_PREFIX}:${item.id}`, item.ncomments)
window.localStorage.setItem(`${COMMENTS_VIEW_PREFIX}:${item.id}`, new Date(item.lastCommentAt).getTime())
window.localStorage.setItem(`${COMMENTS_NUM_PREFIX}:${item.id}`, item.ncomments)
}
}
export function commentsViewedAfterComment (rootId, createdAt) {
localStorage.setItem(`${COMMENTS_VIEW_PREFIX}:${rootId}`, new Date(createdAt).getTime())
const existingRootComments = localStorage.getItem(`${COMMENTS_NUM_PREFIX}:${rootId}`) || 0
localStorage.setItem(`${COMMENTS_NUM_PREFIX}:${rootId}`, existingRootComments + 1)
window.localStorage.setItem(`${COMMENTS_VIEW_PREFIX}:${rootId}`, new Date(createdAt).getTime())
const existingRootComments = window.localStorage.getItem(`${COMMENTS_NUM_PREFIX}:${rootId}`) || 0
window.localStorage.setItem(`${COMMENTS_NUM_PREFIX}:${rootId}`, existingRootComments + 1)
}
export function newComments (item) {
if (!item.parentId) {
const commentsViewedAt = localStorage.getItem(`${COMMENTS_VIEW_PREFIX}:${item.id}`)
const commentsViewNum = localStorage.getItem(`${COMMENTS_NUM_PREFIX}:${item.id}`)
const commentsViewedAt = window.localStorage.getItem(`${COMMENTS_VIEW_PREFIX}:${item.id}`)
const commentsViewNum = window.localStorage.getItem(`${COMMENTS_NUM_PREFIX}:${item.id}`)
if (commentsViewedAt && commentsViewNum) {
return commentsViewedAt < new Date(item.lastCommentAt).getTime() || commentsViewNum < item.ncomments

View File

@ -91,6 +91,9 @@
},
"standard": {
"parser": "@babel/eslint-parser",
"plugins": [
"@next/next"
],
"extends": [
"next"
]

View File

@ -20,7 +20,7 @@ function writeQuery (client, apollo, data) {
if (apollo && data) {
client.writeQuery({
query: gql`${apollo.query}`,
data: data,
data,
variables: apollo.variables,
broadcast: !SSR,
overwrite: SSR

View File

@ -11,7 +11,7 @@ export default async ({ query }, res) => {
const sig = Buffer.from(query.sig, 'hex')
const k1 = Buffer.from(query.k1, 'hex')
const key = Buffer.from(query.key, 'hex')
if (secp256k1.verify(signature, k1, key)) {
if (secp256k1.verify(sig, k1, key)) {
const auth = await models.lnAuth.findUnique({ where: { k1: query.k1 } })
if (!auth || auth.pubkey || auth.createdAt < Date.now() - HOUR) {
return res.status(400).json({ status: 'ERROR', reason: 'token expired' })

View File

@ -3,7 +3,7 @@ import lnd from '../../../../api/lnd'
import { createInvoice } from 'ln-service'
import { lnurlPayDescriptionHashForUser } from '../../../../lib/lnurl'
import serialize from '../../../../api/resolvers/serial'
import { schnorr } from '@noble/curves/secp256k1';
import { schnorr } from '@noble/curves/secp256k1'
import { createHash } from 'crypto'
export default async ({ query: { username, amount, nostr } }, res) => {
@ -38,7 +38,7 @@ export default async ({ query: { username, amount, nostr } }, res) => {
// generate invoice
const expiresAt = new Date(new Date().setMinutes(new Date().getMinutes() + 1))
const invoice = await createInvoice({
description: description,
description,
description_hash: descriptionHash,
lnd,
mtokens: amount,

View File

@ -97,14 +97,14 @@ export default function Invites () {
const [active, inactive] = data && data.invites
? data.invites.reduce((result, invite) => {
result[
invite.revoked || (invite.limit &&
result[
invite.revoked || (invite.limit &&
invite.invitees.length >= invite.limit)
? 1
: 0].push(invite)
return result
},
[[], []])
? 1
: 0].push(invite)
return result
},
[[], []])
: [[], []]
return (

View File

@ -2,11 +2,6 @@ import { gql } from 'graphql-tag'
import { useEffect, useState } from 'react'
import Button from 'react-bootstrap/Button'
import InputGroup from 'react-bootstrap/InputGroup'
import { PieChart } from 'recharts/lib/chart/PieChart'
import { Cell } from 'recharts/lib/component/Cell'
import { Pie } from 'recharts/lib/polar/Pie'
import { Tooltip } from 'recharts/lib/component/Tooltip'
import { ResponsiveContainer } from 'recharts/lib/component/ResponsiveContainer'
import { getGetServerSideProps } from '../api/ssrApollo'
import { Form, Input, SubmitButton } from '../components/form'
import { CenterLayout } from '../components/layout'
@ -94,14 +89,6 @@ export default function Rewards ({ ssrData }) {
)
}
const COLORS = [
'var(--bs-secondary)',
'var(--bs-info)',
'var(--bs-success)',
'var(--bs-boost)',
'var(--bs-grey)'
]
export function DonateButton () {
const showModal = useShowModal()
const [donateToRewards] = useMutation(

View File

@ -5,14 +5,14 @@ import Col from 'react-bootstrap/Col'
import Row from 'react-bootstrap/Row'
import { UsageHeader } from '../../components/usage-header'
import { useRouter } from 'next/router'
import dynamic from "next/dynamic"
import dynamic from 'next/dynamic'
const WhenAreaChart = dynamic(() => import('../../components/charts').then(mod => mod.WhenAreaChart), {
loading: () => <div>Loading...</div>
});
})
const WhenLineChart = dynamic(() => import('../../components/charts').then(mod => mod.WhenLineChart), {
loading: () => <div>Loading...</div>
});
})
export const getServerSideProps = getGetServerSideProps(
gql`
@ -75,31 +75,31 @@ export default function Growth ({
<Row>
<Col className='mt-3'>
<div className='text-center text-muted fw-bold'>{avg}stackers</div>
<WhenLineChart data={stackerGrowth} />
<WhenLineChart data={stackerGrowth} />
</Col>
<Col className='mt-3'>
<div className='text-center text-muted fw-bold'>stacking</div>
<WhenAreaChart data={stackingGrowth} />
<WhenAreaChart data={stackingGrowth} />
</Col>
</Row>
<Row>
<Col className='mt-3'>
<div className='text-center text-muted fw-bold'>{avg}spenders</div>
<WhenLineChart data={spenderGrowth} />
<WhenLineChart data={spenderGrowth} />
</Col>
<Col className='mt-3'>
<div className='text-center text-muted fw-bold'>spending</div>
<WhenAreaChart data={spendingGrowth} />
<WhenAreaChart data={spendingGrowth} />
</Col>
</Row>
<Row>
<Col className='mt-3'>
<div className='text-center text-muted fw-bold'>registrations</div>
<WhenAreaChart data={registrationGrowth} />
<WhenAreaChart data={registrationGrowth} />
</Col>
<Col className='mt-3'>
<div className='text-center text-muted fw-bold'>items</div>
<WhenAreaChart data={itemGrowth} />
<WhenAreaChart data={itemGrowth} />
</Col>
</Row>
</Layout>

View File

@ -86,7 +86,7 @@ export function FundForm () {
}`)
useEffect(() => {
setShowAlert(!localStorage.getItem('hideLnAddrAlert'))
setShowAlert(!window.localStorage.getItem('hideLnAddrAlert'))
}, [])
if (called && !error) {
@ -99,7 +99,7 @@ export function FundForm () {
{me && showAlert &&
<Alert
variant='success' dismissible onClose={() => {
localStorage.setItem('hideLnAddrAlert', 'yep')
window.localStorage.setItem('hideLnAddrAlert', 'yep')
setShowAlert(false)
}}
>

View File

@ -13,7 +13,7 @@ export default function Sub ({ ssrData }) {
return (
<Layout sub={variables.sub}>
<Items ssrData={ssrData} rank variables={variables} />
<Items ssrData={ssrData} variables={variables} />
</Layout>
)
}

View File

@ -24,7 +24,7 @@ export default function Index ({ ssrData }) {
<Items
ssrData={ssrData}
query={SUB_ITEMS}
variables={variables} rank
variables={variables}
/>
</Layout>
)

View File

@ -1,4 +1,3 @@
import getGetRssServerSideProps from '../../lib/rss'
import { SUB_ITEMS } from '../../fragments/subs'

View File

@ -24,7 +24,7 @@ export default function Index ({ ssrData }) {
<Items
ssrData={ssrData}
query={SUB_ITEMS}
variables={variables} rank
variables={variables}
noMoreText='NO MORE'
/>
</Layout>

View File

@ -67,7 +67,7 @@ export const getTheme = () => {
const supportsColorSchemeQuery = mql.media === PREFER_DARK_QUERY
let localStorageTheme = null
try {
localStorageTheme = localStorage.getItem(STORAGE_KEY)
localStorageTheme = window.localStorage.getItem(STORAGE_KEY)
} catch (err) {}
const localStorageExists = localStorageTheme !== null
if (localStorageExists) {
@ -82,7 +82,7 @@ export const getTheme = () => {
}
export const setTheme = (dark) => {
localStorage.setItem(STORAGE_KEY, JSON.stringify(dark))
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(dark))
handleThemeChange(dark)
}

View File

@ -1,3 +1,4 @@
/* global self */
import { precacheAndRoute } from 'workbox-precaching'
import { offlineFallback } from 'workbox-recipes'
import { setDefaultHandler } from 'workbox-routing'

View File

@ -1,4 +1,3 @@
// this is intended to be run everyday after midnight CT
function views ({ models }) {
return async function () {