"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActivitySlider = void 0;
const react_1 = __importDefault(require("react"));
const formatDistanceToNow_1 = __importDefault(require("date-fns/formatDistanceToNow"));
const parseISO_1 = __importDefault(require("date-fns/parseISO"));
const react_router_dom_1 = require("react-router-dom");
const Carousel_1 = __importDefault(require("react-multi-carousel/lib/Carousel"));
require("react-multi-carousel/lib/styles.css");
const LeftArrow = ({ onClick }) => (react_1.default.createElement("i", { className: "fas fa-chevron-left", onClick: () => onClick() }));
const RightArrow = ({ onClick }) => (react_1.default.createElement("i", { className: "fas fa-chevron-right", onClick: () => onClick() }));
const ActivitySlider = ({ className, data, showDots, slideHeader, responsive, infinite, keyBoardControl, containerClass, itemClass, }) => {
    return (react_1.default.createElement("div", { className: "activity-slider" + " " + className },
        react_1.default.createElement("h3", null, slideHeader),
        react_1.default.createElement(Carousel_1.default, { infinite: infinite, keyBoardControl: keyBoardControl, containerClass: containerClass, itemClass: itemClass, showDots: showDots, responsive: responsive, customLeftArrow: react_1.default.createElement(LeftArrow, null), customRightArrow: react_1.default.createElement(RightArrow, null) }, data.map(({ node }) => (react_1.default.createElement("div", { className: "activity-slider-node", key: node.id },
            react_1.default.createElement("div", { className: "ds-modality" },
                react_1.default.createElement("div", { className: "hexagon-wrapper" }, node.latestSnapshot.summary?.primaryModality
                    ? (react_1.default.createElement(react_1.default.Fragment, null,
                        react_1.default.createElement("div", { className: "hexagon " +
                                node.latestSnapshot.summary?.primaryModality
                                    .toLowerCase() }),
                        react_1.default.createElement("div", { className: "label" }, node.latestSnapshot.summary?.primaryModality)))
                    : (react_1.default.createElement(react_1.default.Fragment, null,
                        react_1.default.createElement("div", { className: "hexagon no-modality" }),
                        react_1.default.createElement("div", { className: "label" }, "N/A"))))),
            react_1.default.createElement("div", { className: "ds-name" },
                react_1.default.createElement("h4", null,
                    react_1.default.createElement(react_router_dom_1.Link, { to: "datasets/" +
                            node.id +
                            "/versions/" +
                            node.latestSnapshot.tag }, node.latestSnapshot.description.Name))),
            node.publishDate
                ? (react_1.default.createElement("div", { className: "ds-pub-date" },
                    (0, formatDistanceToNow_1.default)((0, parseISO_1.default)(node.publishDate)),
                    " ago"))
                : null,
            node.analytics
                ? (react_1.default.createElement("div", { className: "ds-pub-views" },
                    node.analytics.views.toLocaleString(),
                    " views"))
                : null))))));
};
exports.ActivitySlider = ActivitySlider;
