Path: blob/main/components/dashboard/src/usage/UsageSummary.tsx
2499 views
/**1* Copyright (c) 2023 Gitpod GmbH. All rights reserved.2* Licensed under the GNU Affero General Public License (AGPL).3* See License.AGPL.txt in the project root for license information.4*/56import { FC } from "react";7import { useCurrentOrg } from "../data/organizations/orgs-query";8import { Subheading } from "../components/typography/headings";9import { Link } from "react-router-dom";10import { useOrgBillingMode } from "../data/billing-mode/org-billing-mode-query";11import { useIsOwner } from "../data/organizations/members-query";1213type Props = {14creditsUsed?: number;15};16export const UsageSummaryData: FC<Props> = ({ creditsUsed }) => {17const currentOrg = useCurrentOrg();18const isOwner = useIsOwner();19const { data: billingMode } = useOrgBillingMode();2021return (22<div className="flex flex-row">23<div className="mt-8 p-3 flex flex-col">24<Subheading>Credits Consumed</Subheading>25<div className="flex text-lg text-gray-600 font-semibold">26<span className="dark:text-gray-400">27{creditsUsed !== undefined ? creditsUsed.toLocaleString() : "-"}28</span>29</div>30{currentOrg.data && isOwner && billingMode?.mode === "usage-based" && (31<div className="flex text-xs text-gray-600">32<span className="dark:text-gray-500 text-gray-400">33<Link to="/billing" className="gp-link">34View Billing →35</Link>36</span>37</div>38)}39</div>40</div>41);42};434445