UNPKG

@seidhr/sanity-plugin-muna-schemas

Version:

Muna or ᛗᚢᚾᚨ means remember in norse. Muna is a schema for the Sanity Studio that enables detailed descriptions of cultural heritage objects and knowledge about their contexts as well as pages about them (or anything else really.)

71 lines (57 loc) 2.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _io = require("react-icons/io"); var _datatype = require("../../../properties/datatype"); var _object = require("../../../properties/object"); var _default = { name: 'Creation', type: 'document', title: 'Skapelse', titleEN: 'Creation', icon: _io.IoMdCreate, fields: [_datatype.featured, _object.contributionAssignedBy, _object.timespanSingleton, _object.tookPlaceAt], preview: { select: { contributor: 'contributionAssignedBy.0.asignedActor.label', contributorName: 'contributionAssignedBy.0.usedName.content', bb: 'timespan.beginOfTheBegin', eb: 'timespan.endOfTheBegin', date: 'timespan.date', be: 'timespan.beginOfTheEnd', ee: 'timespan.endOfTheEnd' }, prepare(selection) { var dayjs = require('dayjs'); var _ = require('lodash'); var localizedFormat = require('dayjs/plugin/localizedFormat'); dayjs.extend(localizedFormat); require('dayjs/locale/nb'); var contributor = selection.contributor, contributorName = selection.contributorName, bb = selection.bb, eb = selection.eb, date = selection.date, be = selection.be, ee = selection.ee; var dates = _.pickBy({ bb: bb, eb: eb, date: date, be: be, ee: ee }, _.identity); var d = Object.assign({}, ...Object.keys(dates).map(k => ({ [k]: dayjs(dates[k]).locale('nb').format('LL') }))); return { title: "Creation, by ".concat(contributor || contributorName || 'unknown'), subtitle: "".concat(d.date || '').concat(d.bb || '').concat(d.bb && d.eb ? '~' : '').concat(d.eb || '') + "".concat((d.bb || d.eb) && (d.be || d.ee) ? ' / ' : '') + "".concat(d.be || '').concat(d.be && d.ee ? '~' : '').concat(d.ee || '') }; } } }; exports.default = _default; //# sourceMappingURL=Creation.js.map