Skip to content

Commit

Permalink
fix: get max credits (#8512)
Browse files Browse the repository at this point in the history
  • Loading branch information
danilowoz committed Jul 11, 2024
1 parent 2baf4a8 commit 434c938
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/app/src/app/pages/Dashboard/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ export const Sidebar: React.FC<SidebarProps> = ({
? state.sidebar[state.activeTeam]?.hasSyncedSandboxes
: false;

let maxCredits = state.activeTeamInfo.limits?.includedCredits;
if (isPro) {
maxCredits += state.activeTeamInfo.limits?.onDemandCreditLimit;
}
const getMaxCredits = () => {
let maxCredits = state.activeTeamInfo.limits?.includedCredits;
if (isPro) {
maxCredits += state.activeTeamInfo.limits?.onDemandCreditLimit;
}

return maxCredits;
};

return (
<SidebarContext.Provider value={{ onSidebarToggle, menuState }}>
Expand Down Expand Up @@ -258,7 +262,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
{ubbBeta && state.activeTeamInfo && (
<UsageProgress
workspaceId={activeTeam}
maxCredits={maxCredits}
maxCredits={getMaxCredits()}
usedCredits={state.activeTeamInfo.usage?.credits}
/>
)}
Expand Down

0 comments on commit 434c938

Please sign in to comment.