Disable post button while dupes are loading

This commit is contained in:
ekzyis 2023-04-01 05:01:21 +02:00 committed by keyan
parent 1a271432c7
commit d43c7cc222
2 changed files with 4 additions and 4 deletions

View File

@ -39,7 +39,7 @@ function Receipt ({ cost, repetition, hasImgLink, baseFee, parentId, boost }) {
) )
} }
export default function FeeButton ({ parentId, hasImgLink, baseFee, ChildButton, variant, text, alwaysShow }) { export default function FeeButton ({ parentId, hasImgLink, baseFee, ChildButton, variant, text, alwaysShow, disabled }) {
const query = parentId const query = parentId
? gql`{ itemRepetition(parentId: "${parentId}") }` ? gql`{ itemRepetition(parentId: "${parentId}") }`
: gql`{ itemRepetition }` : gql`{ itemRepetition }`
@ -53,7 +53,7 @@ export default function FeeButton ({ parentId, hasImgLink, baseFee, ChildButton,
return ( return (
<div className='d-flex align-items-center'> <div className='d-flex align-items-center'>
<ActionTooltip overlayText={`${cost} sats`}> <ActionTooltip overlayText={`${cost} sats`}>
<ChildButton variant={variant}>{text}{cost > baseFee && show && <small> {cost} sats</small>}</ChildButton> <ChildButton variant={variant} disabled={disabled}>{text}{cost > baseFee && show && <small> {cost} sats</small>}</ChildButton>
</ActionTooltip> </ActionTooltip>
{cost > baseFee && show && {cost > baseFee && show &&
<Info> <Info>

View File

@ -25,7 +25,7 @@ export function LinkForm ({ item, editThreshold }) {
}`, { }`, {
fetchPolicy: 'network-only' fetchPolicy: 'network-only'
}) })
const [getDupes, { data: dupesData }] = useLazyQuery(gql` const [getDupes, { data: dupesData, loading: dupesLoading }] = useLazyQuery(gql`
${ITEM_FIELDS} ${ITEM_FIELDS}
query Dupes($url: String!) { query Dupes($url: String!) {
dupes(url: $url) { dupes(url: $url) {
@ -142,7 +142,7 @@ export function LinkForm ({ item, editThreshold }) {
/> />
</div>) </div>)
: <FeeButton : <FeeButton
baseFee={1} parentId={null} text='post' baseFee={1} parentId={null} text='post' disabled={dupesLoading}
ChildButton={SubmitButton} variant='secondary' ChildButton={SubmitButton} variant='secondary'
/>} />}
</div> </div>