"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HistoryRow = void 0;
var react_1 = __importDefault(require("react"));
var classnames_1 = __importDefault(require("classnames"));
var ui_i18n_1 = __importDefault(require("ui-i18n"));
var mdm_sdk_1 = require("@reltio/mdm-sdk");
var Typography_1 = __importDefault(require("@mui/material/Typography"));
var activity_log_1 = require("../../activity-log");
var styles_1 = require("./styles");
var HistoryRow = function (_a) {
    var _b;
    var change = _a.change, isCurrent = _a.isCurrent, isSelected = _a.isSelected, onClick = _a.onClick;
    var uri = change.uri, type = change.type, matchGroups = change.matchGroups, user = change.user, timestamp = change.timestamp, fakeType = change.fakeType, uris = change.uris;
    var colorUri = fakeType && uris ? uris[0] : uri;
    var color = (0, mdm_sdk_1.getContributorColor)(colorUri);
    var styles = (0, styles_1.useStyles)({ color: color });
    return (react_1.default.createElement("div", { "data-reltio-id": "history-row", className: (0, classnames_1.default)(styles.historyRow, (_b = {},
            _b[styles.selected] = isSelected,
            _b)), onClick: onClick },
        react_1.default.createElement("div", { className: styles.rowHeader },
            react_1.default.createElement("div", { className: styles.badge }),
            react_1.default.createElement(Typography_1.default, { "data-reltio-id": "history-row-header", className: (0, classnames_1.default)(styles.title, { bold: isCurrent }) }, isCurrent ? ui_i18n_1.default.text('Current view') : (0, activity_log_1.getActivityLabel)(type)),
            !isCurrent && react_1.default.createElement(Typography_1.default, { className: styles.date }, ui_i18n_1.default.date(timestamp, 'L LT'))),
        matchGroups && (react_1.default.createElement(Typography_1.default, { className: styles.title },
            ui_i18n_1.default.text('Match rule:'),
            " ",
            matchGroups.join(', '))),
        react_1.default.createElement(Typography_1.default, { className: styles.user }, user)));
};
exports.HistoryRow = HistoryRow;
