Skip to content

Commit

Permalink
Hide no credits banner for no billing accounts (#21218)
Browse files Browse the repository at this point in the history
  • Loading branch information
timroes authored Jan 11, 2023
1 parent 4b5cf8b commit e55a7c6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FormattedMessage } from "react-intl";

import { InfoBox } from "components/ui/InfoBox";

import { CreditStatus } from "packages/cloud/lib/domain/cloudWorkspaces/types";
import { useGetCloudWorkspace } from "packages/cloud/services/workspaces/CloudWorkspacesService";
import { useCurrentWorkspace } from "services/workspaces/WorkspacesService";

Expand All @@ -14,7 +15,9 @@ export const LowCreditBalanceHint: React.FC<React.PropsWithChildren<unknown>> =
const workspace = useCurrentWorkspace();
const cloudWorkspace = useGetCloudWorkspace(workspace.workspaceId);

if (cloudWorkspace.remainingCredits > LOW_BALANCE_CREDIT_TRESHOLD) {
const isNoBillingAccount =
cloudWorkspace.remainingCredits <= 0 && cloudWorkspace.creditStatus === CreditStatus.POSITIVE;
if (isNoBillingAccount || cloudWorkspace.remainingCredits > LOW_BALANCE_CREDIT_TRESHOLD) {
return null;
}

Expand Down

0 comments on commit e55a7c6

Please sign in to comment.