From 03b05189120e6e457b5708fb5c04efebbe9b9982 Mon Sep 17 00:00:00 2001 From: im-adithya Date: Thu, 11 Jul 2024 19:57:30 +0530 Subject: [PATCH] chore: further changes --- frontend/src/components/Permissions.tsx | 15 +++++++-------- frontend/src/screens/apps/NewApp.tsx | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/Permissions.tsx b/frontend/src/components/Permissions.tsx index 812662be..9c5d5a05 100644 --- a/frontend/src/components/Permissions.tsx +++ b/frontend/src/components/Permissions.tsx @@ -35,12 +35,12 @@ const Permissions: React.FC = ({ }) => { const [permissions, setPermissions] = React.useState(initialPermissions); - const [canEditBudgetAmount, setCanEditBudgetAmount] = React.useState( + const [isBudgetAmountEditable, setBudgetAmountEditable] = React.useState( isNewConnection ? Number.isNaN(initialPermissions.maxAmount) : canEditPermissions ); - const [canEditExpiry, setCanEditExpiry] = React.useState( + const [isExpiryEditable, setExpiryEditable] = React.useState( isNewConnection ? !initialPermissions.expiresAt : canEditPermissions ); @@ -54,12 +54,12 @@ const Permissions: React.FC = ({ if (isNewConnection) { return; } - setCanEditBudgetAmount( + setBudgetAmountEditable( isNewConnection ? Number.isNaN(initialPermissions.maxAmount) : canEditPermissions ); - setCanEditExpiry( + setExpiryEditable( isNewConnection ? !initialPermissions.expiresAt : canEditPermissions ); }, [canEditPermissions, initialPermissions, isNewConnection]); @@ -147,7 +147,7 @@ const Permissions: React.FC = ({ )} {capabilities.scopes.includes(NIP_47_PAY_INVOICE_METHOD) && permissions.scopes.has(NIP_47_PAY_INVOICE_METHOD) && - (!canEditBudgetAmount ? ( + (!isBudgetAmountEditable ? (

@@ -171,9 +171,8 @@ const Permissions: React.FC = ({ type="button" variant="secondary" onClick={() => { - setShowBudgetOptions(true); - handleBudgetRenewalChange("monthly"); handleBudgetMaxAmountChange(100000); + setShowBudgetOptions(true); }} className="mb-4 mr-4" > @@ -200,7 +199,7 @@ const Permissions: React.FC = ({ ))} - {!canEditExpiry ? ( + {!isExpiryEditable ? (

Connection expiry

diff --git a/frontend/src/screens/apps/NewApp.tsx b/frontend/src/screens/apps/NewApp.tsx index 787c0715..957a5159 100644 --- a/frontend/src/screens/apps/NewApp.tsx +++ b/frontend/src/screens/apps/NewApp.tsx @@ -171,7 +171,7 @@ const NewAppInternal = ({ capabilities }: NewAppInternalProps) => { maxAmount: parseInt(budgetMaxAmountParam), budgetRenewal: validBudgetRenewals.includes(budgetRenewalParam) ? budgetRenewalParam - : "never", + : "monthly", expiresAt: parseExpiresParam(expiresAtParam), });