"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;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importStar(require("react"));
const icons_1 = require("@ant-design/icons");
const antd_1 = require("antd");
const styled_components_1 = __importDefault(require("styled-components"));
const system_1 = require("@/pages/system");
const period_format_1 = require("@/utils/period-format");
const Container = styled_components_1.default.div `
  display: flex;
  align-items: center;
  margin-bottom: 16px;
`;
const Information = styled_components_1.default.div `
  flex: 1;
  padding-left: 16px;
`;
const Name = styled_components_1.default.h1 `
  font-weight: bold;
  font-size: 20px;
  line-height: 1;
  margin-bottom: 8px;
`;
const Meta = styled_components_1.default.div `
  font-weight: normal;
  font-size: 14px;
  line-height: 24px;
  color: #707070;
  > span {
    margin-right: 30px;
    :last-child {
      margin-right: 0;
    }
  }
`;
const Text = styled_components_1.default.span `
  display: inline-block;
  margin-left: 4px;
`;
const BasicInfo = (props) => {
    const { fileDetail } = props;
    const { createTime, creator, id, name, type } = fileDetail || {};
    // i18n
    const { locale } = (0, react_1.useContext)(system_1.GlobalContext);
    const { file, global } = locale.business;
    const typeMap = {
        page: {
            name: file.page,
            bgColor: '#87D068',
        },
        template: {
            name: file.template,
            bgColor: '#2DB7F5',
        },
    };
    return (react_1.default.createElement(react_1.default.Fragment, null, fileDetail && (react_1.default.createElement(Container, null,
        react_1.default.createElement(antd_1.Avatar, { size: 64, style: {
                display: 'inline-block',
                backgroundColor: type ? typeMap[type].bgColor : 'transparent',
            } }, type ? typeMap[type].name : ''),
        react_1.default.createElement(Information, null,
            react_1.default.createElement(Name, null, name || '-'),
            react_1.default.createElement(Meta, null,
                react_1.default.createElement(antd_1.Tooltip, { placement: "top", title: file.id },
                    react_1.default.createElement(icons_1.CodeOutlined, null),
                    react_1.default.createElement(Text, null, id || '')),
                react_1.default.createElement(antd_1.Tooltip, { placement: "top", title: global.creator },
                    react_1.default.createElement(icons_1.UserOutlined, null),
                    react_1.default.createElement(Text, null, (creator === null || creator === void 0 ? void 0 : creator.account) || '')),
                react_1.default.createElement(antd_1.Tooltip, { placement: "top", title: global.createTime },
                    react_1.default.createElement(icons_1.CalendarOutlined, null),
                    react_1.default.createElement(Text, null, (0, period_format_1.periodFormat)(createTime, 'unknown') || ''))))))));
};
exports.default = BasicInfo;
