"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const antd_1 = require("antd");
const misc_1 = require("./misc");
const columns = [
    { title: "Accounts", dataIndex: "type", key: "type" },
    { title: "Hour", dataIndex: "1h", key: "1h" },
    { title: "Day", dataIndex: "1d", key: "1d" },
    { title: "Week", dataIndex: "7d", key: "7d" },
    { title: "Month", dataIndex: "30d", key: "30d" },
];
function connectedUsers(hubServers) {
    if (hubServers == null || hubServers.length === 0) {
        return 0;
    }
    else {
        return hubServers.map((x) => x.clients).reduce((s, t) => s + t);
    }
}
function ActiveUsers({ created, active, hubServers }) {
    const rows = [
        { type: "In use", ...misc_1.ZEROS, ...active },
        { type: "Created", ...misc_1.ZEROS, ...created },
    ];
    return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("h2", { children: ["Connected Users: ", connectedUsers(hubServers)] }), (0, jsx_runtime_1.jsxs)("p", { children: ["There are ", connectedUsers(hubServers), " users connected right now; of these ", active["5min"], " actively edited a file in the last 5 minutes. Track the number of users that were recently active or created new accounts below."] }), (0, jsx_runtime_1.jsx)(antd_1.Table, { dataSource: rows, columns: columns, bordered: true, pagination: false, rowKey: "type" })] }));
}
exports.default = ActiveUsers;
//# sourceMappingURL=active-users.js.map