fee button improvements

This commit is contained in:
keyan 2023-11-20 13:20:28 -06:00
parent af59e3ef54
commit 1266ae2983
1 changed files with 4 additions and 3 deletions

View File

@ -41,14 +41,15 @@ export function postCommentUseRemoteLineItems ({ parentId, me } = {}) {
const query = parentId const query = parentId
? gql`{ itemRepetition(parentId: "${parentId}") }` ? gql`{ itemRepetition(parentId: "${parentId}") }`
: gql`{ itemRepetition }` : gql`{ itemRepetition }`
return function useRemoteLineItems () { return function useRemoteLineItems () {
const [line, setLine] = useState({}) const [line, setLine] = useState({})
const { data } = useQuery(query, SSR ? {} : { pollInterval: 1000, nextFetchPolicy: 'cache-and-network' }) const { data } = useQuery(query, SSR ? {} : { pollInterval: 1000, nextFetchPolicy: 'cache-and-network' })
useEffect(() => { useEffect(() => {
const repetition = data?.itemRepetition || 0 const repetition = data?.itemRepetition
if (!repetition) return if (!repetition) return setLine({})
setLine({ setLine({
itemRepetition: { itemRepetition: {
term: <>x 10<sup>{repetition}</sup></>, term: <>x 10<sup>{repetition}</sup></>,
@ -124,7 +125,7 @@ export default function FeeButton ({ ChildButton = SubmitButton, variant, text,
return ( return (
<div className={styles.feeButton}> <div className={styles.feeButton}>
<ActionTooltip overlayText={numWithUnits(total, { abbreviate: false })}> <ActionTooltip overlayText={feeText}>
<ChildButton variant={variant} disabled={disabled || ctxDisabled}>{text}{feeText && <small> {feeText}</small>}</ChildButton> <ChildButton variant={variant} disabled={disabled || ctxDisabled}>{text}{feeText && <small> {feeText}</small>}</ChildButton>
</ActionTooltip> </ActionTooltip>
{!me && <AnonInfo />} {!me && <AnonInfo />}