sub related enchancements

This commit is contained in:
keyan 2023-05-02 11:55:10 -05:00
parent 4be5286122
commit 4e817a232d
7 changed files with 39 additions and 11 deletions

View File

@ -18,6 +18,7 @@ import Flag from '../svgs/flag-fill.svg'
import { abbrNum } from '../lib/format'
import Share from './share'
import ItemInfo from './item-info'
import { Badge } from 'react-bootstrap'
function Parent ({ item, rootText }) {
const ParentFrag = () => (
@ -40,6 +41,10 @@ function Parent ({ item, rootText }) {
<Link href={`/items/${item.root.id}`} passHref>
<a className='text-reset'>{rootText || 'on:'} {item.root.title}</a>
</Link>
{item.root.sub?.name &&
<Link href={`/~${item.root.sub?.name}`}>
<a>{' '}<Badge className={itemStyles.newComment} variant={null}>{item.root.sub?.name}</Badge></a>
</Link>}
</>
)
}

View File

@ -264,7 +264,7 @@ export default function Header ({ sub }) {
<NavItems className='d-none d-md-flex mx-2' />
<PostItem className='d-none d-md-flex mx-2' />
<Link href='/search' passHref>
<Nav.Link eventKey='search' className='position-relative d-none d-md-flex align-items-center mx-2'>
<Nav.Link eventKey='search' className='position-relative d-none d-md-flex align-items-center pr-0 ml-2'>
<SearchIcon className='theme' width={22} height={22} />
</Nav.Link>
</Link>

View File

@ -65,14 +65,19 @@ export default function ItemInfo ({ item, commentsText, className, embellishUser
</Link>
</>}
</span>
{item.sub?.name &&
<Link href={`/~${item.sub?.name}`}>
<a>{' '}<Badge className={styles.newComment} variant={null}>{item.sub?.name}</Badge></a>
</Link>}
{(item.outlawed && !item.mine &&
<Link href='/outlawed'>
<a>{' '}<Badge className={styles.newComment} variant={null}>OUTLAWED</Badge></a>
</Link>) || (item.freebie && !item.mine &&
<a>{' '}<Badge className={styles.newComment} variant={null}>outlawed</Badge></a>
</Link>) ||
(item.freebie && !item.mine &&
<Link href='/freebie'>
<a>{' '}<Badge className={styles.newComment} variant={null}>FREEBIE</Badge></a>
<a>{' '}<Badge className={styles.newComment} variant={null}>freebie</Badge></a>
</Link>
)}
)}
{canEdit && !item.deletedAt &&
<>
<span> \ </span>

View File

@ -11,6 +11,7 @@ import { PollForm } from '../components/poll-form'
import { BountyForm } from '../components/bounty-form'
import { Form, Select } from '../components/form'
import { useEffect, useState } from 'react'
import Info from '../components/info'
export const getServerSideProps = getGetServerSideProps()
@ -74,7 +75,7 @@ export function SubSelect ({ children }) {
return (
<div className='mb-3 d-flex justify-content-start'>
<Form
className='w-auto'
className='w-auto d-flex align-items-center'
initial={{
sub
}}
@ -91,6 +92,16 @@ export function SubSelect ({ children }) {
size='sm'
items={router.query?.type ? ['bitcoin', 'nostr'] : ['bitcoin', 'nostr', 'jobs']}
/>
<Info>
<div>
<div className='font-weight-bold'>The sub your post will go in ...</div>
<ul>
<li>If it's bitcoin related, put it in the bitcoin sub.</li>
<li>If it's nostr related, put it in the nostr sub.</li>
<li>If it's a job, put it in the jobs sub.</li>
</ul>
</div>
</Info>
</Form>
{children}
</div>

View File

@ -4,6 +4,7 @@ import { ITEM_SEARCH } from '../fragments/items'
import SearchItems from '../components/search-items'
import { useRouter } from 'next/router'
import { SeoSearch } from '../components/seo'
import Down from '../svgs/arrow-down-line.svg'
export const getServerSideProps = getGetServerSideProps(ITEM_SEARCH)
@ -13,11 +14,15 @@ export default function Index ({ data: { search: { items, cursor } } }) {
return (
<Layout noSeo search>
<SeoSearch />
{router.query?.q &&
<SearchItems
items={items} cursor={cursor}
variables={{ q: router.query?.q, sort: router.query?.sort, what: router.query?.what, when: router.query?.when }}
/>}
{router.query?.q
? <SearchItems
items={items} cursor={cursor}
variables={{ q: router.query?.q, sort: router.query?.sort, what: router.query?.what, when: router.query?.when }}
/>
: (
<div className='text-muted text-center mt-5' style={{ fontFamily: 'lightning', fontSize: '2rem', opacity: '0.75' }}>
<Down width={22} height={22} className='mr-2' />search for something<Down width={22} height={22} className='ml-2' />
</div>)}
</Layout>
)
}

1
svgs/arrow-down-line.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.9999 16.1716L18.3638 10.8076L19.778 12.2218L11.9999 20L4.22168 12.2218L5.63589 10.8076L10.9999 16.1716V4H12.9999V16.1716Z"></path></svg>

After

Width:  |  Height:  |  Size: 209 B

View File

@ -34,6 +34,7 @@ function repin ({ models }) {
text: current.text,
url: current.url,
userId: current.userId,
subName: current.subName,
pinId
}
})