"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importStar(require("react"));
const react_redux_1 = require("react-redux");
const antd_1 = require("antd");
const ACTIONS = __importStar(require("@/actions/store/list"));
const file_1 = require("@/constants/file");
const system_1 = require("@/pages/system");
const period_format_1 = require("@/utils/period-format");
const { Paragraph } = antd_1.Typography;
const mapStateToProps = (store) => ({
    selectedItem: store.store.list.selectedItem,
});
const mapDispatchToProps = {
    updatePreviewModalVisible: ACTIONS.updatePreviewModalVisible,
};
const BasicInfo = (props) => {
    var _a, _b;
    const { selectedItem } = props;
    // i18n
    const { locale } = (0, react_1.useContext)(system_1.GlobalContext);
    const { global, file } = locale.business;
    if (!selectedItem) {
        return null;
    }
    return (react_1.default.createElement("div", null,
        react_1.default.createElement(Paragraph, null,
            global.nameLabel,
            ": ",
            selectedItem.name),
        react_1.default.createElement(Paragraph, null,
            global.creator,
            ": ", (_a = selectedItem.creator) === null || _a === void 0 ? void 0 :
            _a.account),
        react_1.default.createElement(Paragraph, null,
            global.application,
            ": ", (_b = selectedItem.application) === null || _b === void 0 ? void 0 :
            _b.name),
        react_1.default.createElement(Paragraph, null,
            global.createTime,
            ": ",
            (0, period_format_1.periodFormat)(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.createTime, 'unknown')),
        react_1.default.createElement(Paragraph, null,
            file.name,
            ":",
            react_1.default.createElement(antd_1.Table, { size: "small", columns: [
                    {
                        title: 'Id',
                        dataIndex: 'id',
                    },
                    {
                        title: global.nameLabel,
                        dataIndex: 'name',
                    },
                    {
                        title: `${file.name}Id`,
                        key: 'parentFolderId',
                        render: (_text, record) => {
                            var _a;
                            return (_a = record.details) === null || _a === void 0 ? void 0 : _a.id;
                        },
                    },
                    {
                        title: global.type,
                        dataIndex: 'type',
                        render: (text) => {
                            return react_1.default.createElement(antd_1.Tag, { color: file_1.suffixTagColor[text] }, text);
                        },
                    },
                ], dataSource: selectedItem.files, pagination: false }))));
};
exports.default = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps)(BasicInfo);
