created_at swagger
This commit is contained in:
@@ -13,21 +13,52 @@ const PreviewWorkspace = ({
|
||||
|
||||
const title = document.title;
|
||||
const summary = describeDocumentSummary(document);
|
||||
const baseSummaryRows = summary.summaryRows.filter((row) => {
|
||||
if (row.key === 'pages') {
|
||||
return Number.isFinite(summary.pageCount);
|
||||
const correspondents = Array.isArray(document.correspondents)
|
||||
? document.correspondents.map((entry) => entry?.name).filter(Boolean).join(', ')
|
||||
: '';
|
||||
const tags = Array.isArray(document.tags)
|
||||
? document.tags.map((tag) => tag?.label).filter(Boolean).join(', ')
|
||||
: '';
|
||||
|
||||
const formatDateTime = (value) => {
|
||||
if (!value) {
|
||||
return '—';
|
||||
}
|
||||
if (row.key === 'folder') {
|
||||
return Boolean(summary.folderLabel);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
const summaryRows = [
|
||||
...baseSummaryRows,
|
||||
const date = new Date(value);
|
||||
return Number.isNaN(date.getTime()) ? '—' : date.toLocaleString();
|
||||
};
|
||||
|
||||
const detailItems = [
|
||||
{ label: 'Title', value: summary.title || '—' },
|
||||
{ label: 'Archive Reference', value: document.archive_serial || '—' },
|
||||
{ label: 'Issued On', value: formatDateTime(document.issued_at) },
|
||||
{ label: 'Correspondent', value: correspondents || '—' },
|
||||
{ label: 'Document Type', value: document.document_type || '—' },
|
||||
{
|
||||
key: 'original-name',
|
||||
label: 'Original filename',
|
||||
value: document.original_name || '—',
|
||||
label: 'Filename',
|
||||
value: document.archive_path || document.filename || '—',
|
||||
},
|
||||
{ label: 'Tags', value: tags || '—' },
|
||||
];
|
||||
|
||||
const metadataItems = [
|
||||
{ label: 'Modified At', value: formatDateTime(document.updated_at) },
|
||||
{ label: 'Created At', value: formatDateTime(document.created_at) },
|
||||
{
|
||||
label: 'Media Filename',
|
||||
value: document.current_version?.filename || document.archive_path || '—',
|
||||
},
|
||||
{
|
||||
label: 'SHA-256 Checksum',
|
||||
value: document.current_version?.checksum || '—',
|
||||
},
|
||||
{
|
||||
label: 'Original File Size',
|
||||
value: summary.sizeLabel,
|
||||
},
|
||||
{
|
||||
label: 'Original MIME Type',
|
||||
value: document.content_type || '—',
|
||||
},
|
||||
];
|
||||
const metadata =
|
||||
@@ -35,30 +66,54 @@ const PreviewWorkspace = ({
|
||||
|
||||
return (
|
||||
<section className="preview-workspace">
|
||||
<aside className="preview-workspace__sidebar">
|
||||
<div className="preview-workspace__info">
|
||||
{summaryRows.length ? (
|
||||
<dl className="preview-workspace__summary">
|
||||
{summaryRows.map(({ key, label, value }) => {
|
||||
const displayValue =
|
||||
value === null || value === undefined || value === '' ? '—' : value;
|
||||
return (
|
||||
<div className="preview-workspace__summary-row" key={key}>
|
||||
<dt>{label}</dt>
|
||||
<dd>{displayValue}</dd>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</dl>
|
||||
<div className="preview-workspace__details">
|
||||
<section className="preview-section">
|
||||
<h3 className="preview-section__title">Details</h3>
|
||||
<dl className="preview-section__list">
|
||||
{detailItems.map(({ label, value }) => (
|
||||
<div className="preview-section__item" key={label}>
|
||||
<dt>{label}</dt>
|
||||
<dd>{value || '—'}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</section>
|
||||
<section className="preview-section">
|
||||
<h3 className="preview-section__title">Content</h3>
|
||||
<p className="preview-section__placeholder">
|
||||
Full OCR text will appear here in a future update. Use the toolbar button to open the OCR view for now.
|
||||
</p>
|
||||
</section>
|
||||
<section className="preview-section">
|
||||
<h3 className="preview-section__title">Metadata</h3>
|
||||
<dl className="preview-section__list">
|
||||
{metadataItems.map(({ label, value }) => (
|
||||
<div className="preview-section__item" key={label}>
|
||||
<dt>{label}</dt>
|
||||
<dd>{value || '—'}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
{metadata ? (
|
||||
<details className="preview-section__payload">
|
||||
<summary>Show metadata payload</summary>
|
||||
<pre>{JSON.stringify(metadata, null, 2)}</pre>
|
||||
</details>
|
||||
) : null}
|
||||
</div>
|
||||
{metadata ? (
|
||||
<section className="preview-workspace__metadata">
|
||||
<h4>Metadata payload</h4>
|
||||
<pre>{JSON.stringify(metadata, null, 2)}</pre>
|
||||
</section>
|
||||
) : null}
|
||||
</aside>
|
||||
</section>
|
||||
<section className="preview-section">
|
||||
<h3 className="preview-section__title">Notes</h3>
|
||||
<p className="preview-section__placeholder">Custom notes will be editable here once the feature lands.</p>
|
||||
</section>
|
||||
<section className="preview-section">
|
||||
<h3 className="preview-section__title">History</h3>
|
||||
<p className="preview-section__placeholder">Change history will be displayed here in an upcoming release.</p>
|
||||
</section>
|
||||
<section className="preview-section">
|
||||
<h3 className="preview-section__title">Permissions</h3>
|
||||
<p className="preview-section__placeholder">Access control management is planned and will surface here.</p>
|
||||
</section>
|
||||
</div>
|
||||
<div className="preview-workspace__viewer">
|
||||
{!previewEntry?.url ? (
|
||||
<div className="preview-workspace__message">Loading preview…</div>
|
||||
|
||||
Reference in New Issue
Block a user