Skip to content

Commit

Permalink
chore: further changes
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Jul 11, 2024
1 parent 0aebbac commit 03b0518
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions frontend/src/components/Permissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ const Permissions: React.FC<PermissionsProps> = ({
}) => {
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
);

Expand All @@ -54,12 +54,12 @@ const Permissions: React.FC<PermissionsProps> = ({
if (isNewConnection) {
return;
}
setCanEditBudgetAmount(
setBudgetAmountEditable(
isNewConnection
? Number.isNaN(initialPermissions.maxAmount)
: canEditPermissions
);
setCanEditExpiry(
setExpiryEditable(
isNewConnection ? !initialPermissions.expiresAt : canEditPermissions
);
}, [canEditPermissions, initialPermissions, isNewConnection]);
Expand Down Expand Up @@ -147,7 +147,7 @@ const Permissions: React.FC<PermissionsProps> = ({
)}
{capabilities.scopes.includes(NIP_47_PAY_INVOICE_METHOD) &&
permissions.scopes.has(NIP_47_PAY_INVOICE_METHOD) &&
(!canEditBudgetAmount ? (
(!isBudgetAmountEditable ? (
<div className="pt-2 pl-4 ml-2 border-l-2 border-l-primary">
<div className="flex flex-col gap-2 text-muted-foreground mb-3 text-sm">
<p className="capitalize">
Expand All @@ -171,9 +171,8 @@ const Permissions: React.FC<PermissionsProps> = ({
type="button"
variant="secondary"
onClick={() => {
setShowBudgetOptions(true);
handleBudgetRenewalChange("monthly");
handleBudgetMaxAmountChange(100000);
setShowBudgetOptions(true);
}}
className="mb-4 mr-4"
>
Expand All @@ -200,7 +199,7 @@ const Permissions: React.FC<PermissionsProps> = ({
</>
))}

{!canEditExpiry ? (
{!isExpiryEditable ? (
<div className="mt-4">
<p className="text-sm font-medium mb-2">Connection expiry</p>
<p className="text-muted-foreground text-sm">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/screens/apps/NewApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const NewAppInternal = ({ capabilities }: NewAppInternalProps) => {
maxAmount: parseInt(budgetMaxAmountParam),
budgetRenewal: validBudgetRenewals.includes(budgetRenewalParam)
? budgetRenewalParam
: "never",
: "monthly",
expiresAt: parseExpiresParam(expiresAtParam),
});

Expand Down

0 comments on commit 03b0518

Please sign in to comment.