${this.renderTabs()}
${when(this.isCrawler, () =>
choose(this.collectionTab, [
@@ -174,40 +174,6 @@ export class CollectionDetail extends BtrixElement {
`,
],
- [
- Tab.About,
- () =>
- this.isEditingDescription
- ? html`
-
- void this.saveDescription()}
- ?disabled=${!this.collection}
- >
-
- ${msg("Save")}
-
- (this.isEditingDescription = false)}
- >
- ${msg("Cancel")}
-
-
- `
- : html`
-
(this.isEditingDescription = true)}
- ?disabled=${!this.collection}
- >
-
- ${msg("Edit")}
-
- `,
- ],
[
Tab.Items,
() => html`
@@ -230,7 +196,7 @@ export class CollectionDetail extends BtrixElement {
Tab.Items,
() => guard([this.archivedItems], this.renderArchivedItems),
],
- [Tab.About, () => this.renderDescription()],
+ [Tab.About, () => this.renderAbout()],
])}
{
+ if (!collection.dateEarliest || !collection.dateLatest) {
+ return msg("n/a");
+ }
+ const format: Intl.DateTimeFormatOptions = {
+ month: "long",
+ year: "numeric",
+ };
+ const dateEarliest = this.localize.date(collection.dateEarliest, format);
+ const dateLatest = this.localize.date(collection.dateLatest, format);
+
+ if (dateEarliest === dateLatest) return dateLatest;
+
+ return msg(str`${dateEarliest} to ${dateLatest}`, {
+ desc: "Date range formatted to show full month name and year",
+ });
+ };
+ const skeleton = html``;
+
+ const metadata = html`
+
+
+ ${this.collection ? dateRange(this.collection) : skeleton}
+
+
+ `;
+
return html`
-
- ${when(
- this.collection,
- (collection) =>
- this.isEditingDescription
- ? html`
-
- `
- : html`
-
- ${collection.description
- ? html`
-
- `
- : html`
-
- ${msg("No description provided.")}
-
- `}
-
- `,
- this.renderSpinner,
- )}
-
+
+
+
+
+ ${msg("Description")}
+
+ ${when(
+ this.collection?.description && !this.isEditingDescription,
+ () => html`
+ (this.isEditingDescription = true)}
+ >
+
+ ${msg("Edit Description")}
+
+ `,
+ )}
+
+ ${when(
+ this.collection,
+ (collection) =>
+ this.isEditingDescription
+ ? this.renderDescriptionForm()
+ : html`
+
+ ${collection.description
+ ? html`
+
+ `
+ : html`
+
+
+ ${msg("No description provided.")}
+
+
+ (this.isEditingDescription = true)}
+ ?disabled=${!this.collection}
+ >
+
+ ${msg("Add Description")}
+
+
+ `}
+
+ `,
+ this.renderSpinner,
+ )}
+
+
+
+ ${msg("Metadata")}
+
+ ${metadata}
+
+
+ `;
+ }
+
+ private renderDescriptionForm() {
+ if (!this.collection) return;
+
+ return html`
+
+
+ (this.isEditingDescription = false)}
+ >
+ ${msg("Cancel")}
+
+ void this.saveDescription()}
+ ?disabled=${!this.collection}
+ >
+ ${msg("Update Description")}
+
+
`;
}
@@ -708,32 +769,31 @@ export class CollectionDetail extends BtrixElement {
const headers = this.authState?.headers;
const config = JSON.stringify({ headers });
- return html`
-
- {
- if (!this.isRwpLoaded) {
- this.isRwpLoaded = true;
- }
- }}
- >
-
+ return html`
+ {
+ if (!this.isRwpLoaded) {
+ this.isRwpLoaded = true;
+ }
+ }}
+ >
`;
};
private readonly renderSpinner = () => html`
diff --git a/frontend/src/pages/org/index.ts b/frontend/src/pages/org/index.ts
index ffb2e21a..6e55e6cf 100644
--- a/frontend/src/pages/org/index.ts
+++ b/frontend/src/pages/org/index.ts
@@ -602,6 +602,7 @@ export class Org extends BtrixElement {
if (params.collectionId) {
return html`