Skip to content

Commit

Permalink
Merge pull request #8145 from sagemathinc/onprem-hide-account-balance
Browse files Browse the repository at this point in the history
frontend: disable the balance button in account settings
  • Loading branch information
williamstein authored Jan 24, 2025
2 parents 8e82ece + bb80474 commit ea0cb66
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/packages/frontend/account/account-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export const AccountPage: React.FC = () => {
function renderExtraContent() {
return (
<Space>
<BalanceButton />
{is_commercial ? <BalanceButton /> : undefined}
<I18NSelector isWide={isWide} />
<SignOut everywhere={false} highlight={true} narrow={!isWide} />
</Space>
Expand Down
19 changes: 13 additions & 6 deletions src/packages/frontend/purchases/balance-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function BalanceButton({
topBar?: boolean;
}) {
const intl = useIntl();
const is_commercial = useTypedRedux("customize", "is_commercial");
const [open, setOpen] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(true);
const dbBalance = useTypedRedux("account", "balance");
Expand Down Expand Up @@ -126,10 +127,16 @@ export default function BalanceButton({
);
}

return (
<>
{renderDisplay()}
{renderModal()}
</>
);
// This ensures it only shows up in commercial setups.
// Wherever it is used, the component shouldn't be instantiated in those cases, though.
if (!is_commercial) {
return;
} else {
return (
<>
{renderDisplay()}
{renderModal()}
</>
);
}
}

0 comments on commit ea0cb66

Please sign in to comment.