2023-07-23 15:08:43 +00:00
|
|
|
import { SearchLayout } from '../../components/layout'
|
|
|
|
import { getGetServerSideProps } from '../../api/ssrApollo'
|
|
|
|
import { useRouter } from 'next/router'
|
|
|
|
import { SUB_SEARCH } from '../../fragments/subs'
|
|
|
|
import Items from '../../components/items'
|
2023-09-18 22:50:41 +00:00
|
|
|
import styles from './search.module.css'
|
2023-07-23 15:08:43 +00:00
|
|
|
|
2023-08-28 17:52:15 +00:00
|
|
|
export const getServerSideProps = getGetServerSideProps({
|
|
|
|
query: SUB_SEARCH,
|
|
|
|
notFound: (data, vars) => vars.sub && !data.sub
|
|
|
|
})
|
2023-07-23 15:08:43 +00:00
|
|
|
|
|
|
|
export default function Index ({ ssrData }) {
|
|
|
|
const router = useRouter()
|
2023-10-26 17:52:06 +00:00
|
|
|
const variables = { ...router.query, includeComments: true }
|
2023-07-23 15:08:43 +00:00
|
|
|
|
2024-01-04 03:15:54 +00:00
|
|
|
const sub = ssrData?.sub?.name || variables.sub
|
|
|
|
|
2023-07-23 15:08:43 +00:00
|
|
|
return (
|
2024-01-04 03:15:54 +00:00
|
|
|
<SearchLayout sub={sub}>
|
2023-07-23 15:08:43 +00:00
|
|
|
{variables.q
|
|
|
|
? <Items
|
|
|
|
ssrData={ssrData}
|
|
|
|
query={SUB_SEARCH}
|
|
|
|
destructureData={data => data.search}
|
|
|
|
variables={variables}
|
|
|
|
noMoreText='NO MORE'
|
|
|
|
/>
|
|
|
|
: (
|
2023-09-18 22:50:41 +00:00
|
|
|
<div className={styles.content}>
|
|
|
|
<div className={styles.box}>
|
|
|
|
<div className={styles.header}>
|
|
|
|
<div className='text-muted text-center' style={{ fontFamily: 'lightning', fontSize: '2rem', opacity: '0.75' }}>
|
|
|
|
more filters
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className={styles.body}>
|
|
|
|
<div className={styles.inner}>
|
|
|
|
<div><b>nym:</b>​<em>sn</em> - limit results by stacker nym</div>
|
|
|
|
<div><b>url:</b>​<em>stacker​.news</em> - limit to specific site</div>
|
2024-01-17 15:28:05 +00:00
|
|
|
<div><b>"</b>exact phrase<b>"</b> - demand results contain exact phrase</div>
|
2023-09-18 22:50:41 +00:00
|
|
|
<div>you are searching <em>{variables.sub || 'home'}</em><br /><em>home</em> searches show results from all</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
2023-07-23 15:08:43 +00:00
|
|
|
</SearchLayout>
|
|
|
|
)
|
|
|
|
}
|