stacker.news/pages/~/index.js
rleed 2ba969ebab
Add new visitor welcome banner (#418)
* add new visitor welcome banner

* show dismissible banner on first-time login

* add mutation to hide welcome banner

* Update components/banners.js

Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>

* fix error handling

* simplifications and other review suggestions

* cleanup

* restore selective display logic

* remove unnecessary query arguments

* cleanup a bit more

* don't show welcome banner to existing stackers

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-09-11 16:29:45 -05:00

26 lines
734 B
JavaScript

import { useRouter } from 'next/router'
import { getGetServerSideProps } from '../../api/ssrApollo'
import Items from '../../components/items'
import Layout from '../../components/layout'
import { SUB_ITEMS } from '../../fragments/subs'
import Snl from '../../components/snl'
import WelcomeBanner from '../../components/banners'
export const getServerSideProps = getGetServerSideProps({
query: SUB_ITEMS,
notFound: (data, vars) => vars.sub && !data.sub
})
export default function Sub ({ ssrData }) {
const router = useRouter()
const variables = { ...router.query }
return (
<Layout sub={variables.sub}>
<Snl />
<WelcomeBanner />
<Items ssrData={ssrData} variables={variables} />
</Layout>
)
}