"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var antd_1 = require("antd");
var image_1 = __importDefault(require("components/landing/image"));
var A_1 = __importDefault(require("components/misc/A"));
var icon_1 = require("@cocalc/frontend/components/icon");
var antd_2 = require("antd");
var use_customize_1 = __importDefault(require("lib/use-customize"));
var config_1 = require("lib/config");
function IndexList(_a) {
    var title = _a.title, description = _a.description, dataSource = _a.dataSource;
    var customize = (0, use_customize_1.default)();
    var shareServer = customize.shareServer, landingPages = customize.landingPages;
    var filtedDataSource = (0, react_1.useMemo)(function () {
        return dataSource.filter(function (item) {
            var _a;
            if (item.shareServer && !shareServer)
                return false;
            if (item.landingPages && !landingPages)
                return false;
            if ((_a = item.hide) === null || _a === void 0 ? void 0 : _a.call(item, customize))
                return false;
            return true;
        });
    }, [shareServer, landingPages, dataSource]);
    return ((0, jsx_runtime_1.jsx)(antd_2.Layout.Content, __assign({ style: {
            backgroundColor: "white",
        } }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ style: {
                maxWidth: config_1.MAX_WIDTH,
                margin: "15px auto",
                padding: "15px",
                backgroundColor: "white",
            } }, { children: [(0, jsx_runtime_1.jsx)("h1", __assign({ style: { textAlign: "center", fontSize: "32pt", color: "#444" } }, { children: title })), (0, jsx_runtime_1.jsx)("p", { children: description }), (0, jsx_runtime_1.jsx)(DataList, { dataSource: filtedDataSource })] })) })));
}
exports.default = IndexList;
function DataList(_a) {
    var dataSource = _a.dataSource;
    return ((0, jsx_runtime_1.jsx)(antd_1.List, { itemLayout: "vertical", size: "large", dataSource: dataSource, renderItem: function (item) {
            var _a;
            var icon = ((0, jsx_runtime_1.jsx)("div", __assign({ style: { marginTop: "2.5px" } }, { children: typeof item.logo == "string" ? ((0, jsx_runtime_1.jsx)(icon_1.Icon, { name: item.logo, style: { fontSize: "75px" } })) : ((0, jsx_runtime_1.jsx)(image_1.default, { src: item.logo, width: 75, height: 75, alt: "Logo" })) })));
            var extra = item.image && ((0, jsx_runtime_1.jsx)("div", __assign({ style: { width: (_a = item.imageWidth) !== null && _a !== void 0 ? _a : "275px" } }, { children: (0, jsx_runtime_1.jsx)(A_1.default, __assign({ href: item.link }, { children: (0, jsx_runtime_1.jsx)(image_1.default, { src: item.image, alt: "Screenshot illustrating ".concat(item.title) }) })) })));
            return ((0, jsx_runtime_1.jsx)(antd_1.List.Item, __assign({ extra: extra }, { children: (0, jsx_runtime_1.jsx)(antd_1.List.Item.Meta, { avatar: item.logo && ((0, jsx_runtime_1.jsx)(A_1.default, __assign({ href: item.link, alt: item.title + " logo " }, { children: (0, jsx_runtime_1.jsx)(antd_1.Avatar, { alt: item.title + " logo ", size: 80, shape: "square", icon: icon }) }))), title: (0, jsx_runtime_1.jsx)(A_1.default, __assign({ href: item.link }, { children: item.title })), description: (0, jsx_runtime_1.jsx)("span", __assign({ style: { color: "#666" } }, { children: item.description })) }) }), item.link));
        } }));
}
//# sourceMappingURL=index-list.js.map