From 1bcc864ef49ac42cf6e1954042c38e98534288cc Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 3 Aug 2025 19:16:16 +0200 Subject: [PATCH] Better upload fee info (#2380) * Better upload fee info * Calculate total from info shown to user --- components/form.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/form.js b/components/form.js index 1d9e150d..67732bca 100644 --- a/components/form.js +++ b/components/form.js @@ -317,10 +317,8 @@ export function MarkdownInput ({ label, topLevel, groupClassName, onChange, onKe const [updateUploadFees] = useLazyQuery(gql` query uploadFees($s3Keys: [Int]!) { uploadFees(s3Keys: $s3Keys) { - totalFees nUnpaid uploadFees - bytes24h } }`, { fetchPolicy: 'no-cache', @@ -329,13 +327,15 @@ export function MarkdownInput ({ label, topLevel, groupClassName, onChange, onKe console.error(err) }, onCompleted: ({ uploadFees }) => { + const { uploadFees: feePerUpload, nUnpaid } = uploadFees + const totalFees = feePerUpload * nUnpaid merge({ uploadFees: { - term: `+ ${numWithUnits(uploadFees.totalFees, { abbreviate: false })}`, + term: `+ ${numWithUnits(feePerUpload, { abbreviate: false })} x ${nUnpaid}`, label: 'upload fee', op: '+', - modifier: cost => cost + uploadFees.totalFees, - omit: !uploadFees.totalFees + modifier: cost => cost + totalFees, + omit: !totalFees } }) }