"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TagsCell = TagsCell;
exports.DateCell = DateCell;
exports.defaultTableColumns = void 0;

var _dayjs = _interopRequireDefault(require("dayjs"));

var _jsxRuntime = require("react/jsx-runtime");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var defaultTableColumns = [{
  Header: "Type",
  accessor: "config_type",
  cellClass: "px-5 py-2"
}, {
  Header: "Name",
  accessor: "name",
  cellClass: "px-5 py-2"
}, {
  Header: "Tags",
  accessor: "tags",
  Cell: TagsCell,
  cellClass: "px-5 py-2"
}, {
  Header: "Created",
  accessor: "created_at",
  Cell: DateCell,
  cellClass: "px-5 py-2"
}, {
  Header: "Last Updated",
  accessor: "updated_at",
  Cell: DateCell,
  cellClass: "px-5 py-2"
}];
exports.defaultTableColumns = defaultTableColumns;

function TagsCell(_ref) {
  var row = _ref.row,
      column = _ref.column;
  var tags = row === null || row === void 0 ? void 0 : row.values[column.id];
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
    className: "flex",
    children: (tags === null || tags === void 0 ? void 0 : tags.length) > 0 ? tags.map(function (tag) {
      return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
        className: "bg-gray-200 px-1 py-0.5 mr-1 rounded-md text-gray-600 font-semibold text-xs",
        children: tag
      }, tag);
    }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
      className: "text-gray-400",
      children: "none"
    })
  });
}

function DateCell(_ref2) {
  var row = _ref2.row,
      column = _ref2.column;
  var dateString = row === null || row === void 0 ? void 0 : row.values[column.id];
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
    className: "text-xs",
    children: dateString ? (0, _dayjs.default)(dateString).format("YYYY-DD-MM h:mm A") : "None"
  });
}