simplify optional text on link
This commit is contained in:
parent
40f63baa05
commit
b853cacfa7
@ -1,5 +1,5 @@
|
|||||||
import AccordianItem from './accordian-item'
|
import AccordianItem from './accordian-item'
|
||||||
import { MarkdownInput, Input, InputUserSuggest, VariableInput, Checkbox } from './form'
|
import { Input, InputUserSuggest, VariableInput, Checkbox } from './form'
|
||||||
import InputGroup from 'react-bootstrap/InputGroup'
|
import InputGroup from 'react-bootstrap/InputGroup'
|
||||||
import { BOOST_MIN, BOOST_MULT, MAX_FORWARDS } from '../lib/constants'
|
import { BOOST_MIN, BOOST_MULT, MAX_FORWARDS } from '../lib/constants'
|
||||||
import { DEFAULT_CROSSPOSTING_RELAYS } from '../lib/nostr'
|
import { DEFAULT_CROSSPOSTING_RELAYS } from '../lib/nostr'
|
||||||
@ -11,15 +11,14 @@ import { useRouter } from 'next/router'
|
|||||||
|
|
||||||
const EMPTY_FORWARD = { nym: '', pct: '' }
|
const EMPTY_FORWARD = { nym: '', pct: '' }
|
||||||
|
|
||||||
export function AdvPostInitial ({ text, forward, boost }) {
|
export function AdvPostInitial ({ forward, boost }) {
|
||||||
return {
|
return {
|
||||||
text: text || '',
|
|
||||||
boost: boost || '',
|
boost: boost || '',
|
||||||
forward: forward?.length ? forward : [EMPTY_FORWARD]
|
forward: forward?.length ? forward : [EMPTY_FORWARD]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AdvPostForm ({ isLink }) {
|
export default function AdvPostForm ({ children }) {
|
||||||
const me = useMe()
|
const me = useMe()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
@ -28,24 +27,7 @@ export default function AdvPostForm ({ isLink }) {
|
|||||||
header={<div style={{ fontWeight: 'bold', fontSize: '92%' }}>options</div>}
|
header={<div style={{ fontWeight: 'bold', fontSize: '92%' }}>options</div>}
|
||||||
body={
|
body={
|
||||||
<>
|
<>
|
||||||
{isLink &&
|
{children}
|
||||||
<MarkdownInput
|
|
||||||
label={
|
|
||||||
<div className='d-flex align-items-center'>text
|
|
||||||
<Info>
|
|
||||||
<span className='fw-bold'>You can use this text to ...</span>
|
|
||||||
<ul>
|
|
||||||
<li>provide context</li>
|
|
||||||
<li>summarize the link</li>
|
|
||||||
<li>spur great conversation!</li>
|
|
||||||
<li>or for anything else that comes to your mind</li>
|
|
||||||
</ul>
|
|
||||||
</Info>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
name='text'
|
|
||||||
minRows={6}
|
|
||||||
/>}
|
|
||||||
<Input
|
<Input
|
||||||
label={
|
label={
|
||||||
<div className='d-flex align-items-center'>boost
|
<div className='d-flex align-items-center'>boost
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useState, useEffect, useCallback } from 'react'
|
import { useState, useEffect, useCallback } from 'react'
|
||||||
import { Form, Input, SubmitButton } from '../components/form'
|
import { Form, Input, MarkdownInput, SubmitButton } from '../components/form'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { gql, useApolloClient, useLazyQuery, useMutation } from '@apollo/client'
|
import { gql, useApolloClient, useLazyQuery, useMutation } from '@apollo/client'
|
||||||
import Countdown from './countdown'
|
import Countdown from './countdown'
|
||||||
@ -123,7 +123,8 @@ export function LinkForm ({ item, sub, editThreshold, children }) {
|
|||||||
initial={{
|
initial={{
|
||||||
title: item?.title || shareTitle || '',
|
title: item?.title || shareTitle || '',
|
||||||
url: item?.url || shareUrl || '',
|
url: item?.url || shareUrl || '',
|
||||||
...AdvPostInitial({ text: item?.text, forward: normalizeForwards(item?.forwards), boost: item?.boost }),
|
text: item?.text || '',
|
||||||
|
...AdvPostInitial({ forward: normalizeForwards(item?.forwards), boost: item?.boost }),
|
||||||
...SubSelectInitial({ sub: item?.subName || sub?.name })
|
...SubSelectInitial({ sub: item?.subName || sub?.name })
|
||||||
}}
|
}}
|
||||||
schema={schema}
|
schema={schema}
|
||||||
@ -185,7 +186,13 @@ export function LinkForm ({ item, sub, editThreshold, children }) {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<AdvPostForm edit={!!item} isLink />
|
<AdvPostForm edit={!!item}>
|
||||||
|
<MarkdownInput
|
||||||
|
label='context'
|
||||||
|
name='text'
|
||||||
|
minRows={2}
|
||||||
|
/>
|
||||||
|
</AdvPostForm>
|
||||||
<div className='mt-3'>
|
<div className='mt-3'>
|
||||||
{item
|
{item
|
||||||
? (
|
? (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user