From b853cacfa7adf8dd3fa41547279196fdfd0e81e7 Mon Sep 17 00:00:00 2001 From: keyan Date: Sun, 22 Oct 2023 11:54:27 -0500 Subject: [PATCH] simplify optional text on link --- components/adv-post-form.js | 26 ++++---------------------- components/link-form.js | 13 ++++++++++--- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/components/adv-post-form.js b/components/adv-post-form.js index 732d58c5..615455bd 100644 --- a/components/adv-post-form.js +++ b/components/adv-post-form.js @@ -1,5 +1,5 @@ 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 { BOOST_MIN, BOOST_MULT, MAX_FORWARDS } from '../lib/constants' import { DEFAULT_CROSSPOSTING_RELAYS } from '../lib/nostr' @@ -11,15 +11,14 @@ import { useRouter } from 'next/router' const EMPTY_FORWARD = { nym: '', pct: '' } -export function AdvPostInitial ({ text, forward, boost }) { +export function AdvPostInitial ({ forward, boost }) { return { - text: text || '', boost: boost || '', forward: forward?.length ? forward : [EMPTY_FORWARD] } } -export default function AdvPostForm ({ isLink }) { +export default function AdvPostForm ({ children }) { const me = useMe() const router = useRouter() @@ -28,24 +27,7 @@ export default function AdvPostForm ({ isLink }) { header={
options
} body={ <> - {isLink && - text - - You can use this text to ... -
    -
  • provide context
  • -
  • summarize the link
  • -
  • spur great conversation!
  • -
  • or for anything else that comes to your mind
  • -
-
- - } - name='text' - minRows={6} - />} + {children} boost diff --git a/components/link-form.js b/components/link-form.js index d25d9d29..f8b69ce4 100644 --- a/components/link-form.js +++ b/components/link-form.js @@ -1,5 +1,5 @@ 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 { gql, useApolloClient, useLazyQuery, useMutation } from '@apollo/client' import Countdown from './countdown' @@ -123,7 +123,8 @@ export function LinkForm ({ item, sub, editThreshold, children }) { initial={{ title: item?.title || shareTitle || '', 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 }) }} schema={schema} @@ -185,7 +186,13 @@ export function LinkForm ({ item, sub, editThreshold, children }) { } }} /> - + + +
{item ? (