Path: blob/master/src/packages/next/components/statistics/active-projects.tsx
5796 views
/*1* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Table } from "antd";67import { HistoricCounts } from "@cocalc/util/db-schema/stats";8import { Paragraph, Title } from "components/misc";9import { ZEROS } from "./misc";1011export const PROJECTS_HEADING_WIDTH = 300;1213interface Props {14active: HistoricCounts;15created: HistoricCounts;16running: { free: number; member: number };17style?: React.CSSProperties;18}1920const columns = [21{22title: "Projects",23dataIndex: "type",24key: "type",25width: PROJECTS_HEADING_WIDTH,26},27{ title: "Hour", dataIndex: "1h", key: "1h" },28{ title: "Day", dataIndex: "1d", key: "1d" },29{ title: "Week", dataIndex: "7d", key: "7d" },30{ title: "Month", dataIndex: "30d", key: "30d" },31];3233export default function ActiveProject({34created,35active,36running,37style,38}: Props) {39const rows = [40{ type: "Actively being used", ...ZEROS, ...active },41{ type: "Created", ...ZEROS, "5min": "-", ...created },42];43return (44<div style={style}>45<Title level={2}>Running Projects: {running.free + running.member}</Title>46<Paragraph>47There are {running.free + running.member} projects running right now.48Track the number of projects that were actively being used and the49number that were created below.50</Paragraph>51<Table52dataSource={rows}53columns={columns}54bordered55pagination={false}56rowKey={"type"}57/>58</div>59);60}616263