Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/dashboard/src/teams/TeamUsageBasedBilling.tsx
2501 views
1
/**
2
* Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import { OrgSettingsPage } from "./OrgSettingsPage";
8
import { BillingMode } from "@gitpod/gitpod-protocol/lib/billing-mode";
9
import UsageBasedBillingConfig from "../components/UsageBasedBillingConfig";
10
import { useOrgBillingMode } from "../data/billing-mode/org-billing-mode-query";
11
import { useIsOwner } from "../data/organizations/members-query";
12
import { Redirect } from "react-router";
13
14
export default function TeamUsageBasedBillingPage() {
15
return (
16
<OrgSettingsPage>
17
<TeamUsageBasedBilling />
18
</OrgSettingsPage>
19
);
20
}
21
22
function TeamUsageBasedBilling() {
23
const orgBillingMode = useOrgBillingMode();
24
const isOwner = useIsOwner();
25
26
if (!isOwner) {
27
return <Redirect to="/settings" />;
28
}
29
30
if (!BillingMode.showUsageBasedBilling(orgBillingMode.data)) {
31
return <></>;
32
}
33
34
return <UsageBasedBillingConfig hideSubheading />;
35
}
36
37