diff --git a/frontend/src/components/ui/markdown-editor.ts b/frontend/src/components/ui/markdown-editor.ts index 056d868c..720039cb 100644 --- a/frontend/src/components/ui/markdown-editor.ts +++ b/frontend/src/components/ui/markdown-editor.ts @@ -27,6 +27,14 @@ export class MarkdownEditor extends BtrixElement { --ink-block-padding: var(--sl-input-spacing-small); } + .ink-mde-textarea { + flex-grow: 1; + } + + .ink-mde { + height: 100%; + } + .ink-mde { border: solid var(--sl-input-border-width) var(--sl-input-border-color); } @@ -56,7 +64,8 @@ export class MarkdownEditor extends BtrixElement { } .cm-line:only-child { - min-height: 8em; + height: 100%; + min-height: 20em; } `; @@ -111,7 +120,11 @@ export class MarkdownEditor extends BtrixElement { render() { const isInvalid = this.maxlength && this.value.length > this.maxlength; return html` -
+
${this.label && html``}
diff --git a/frontend/src/features/collections/collection-replay-dialog.ts b/frontend/src/features/collections/collection-replay-dialog.ts index 41678a51..032483f5 100644 --- a/frontend/src/features/collections/collection-replay-dialog.ts +++ b/frontend/src/features/collections/collection-replay-dialog.ts @@ -25,14 +25,14 @@ export class CollectionStartPageDialog extends BtrixElement { { label: string; icon: NonNullable; detail: string } > = { [HomeView.Pages]: { - label: msg("Default"), + label: msg("List of Pages"), icon: "list-ul", detail: `${msg("ReplayWeb.Page default view")}`, }, [HomeView.URL]: { - label: msg("Page"), - icon: "file-earmark", - detail: msg("Load a single page URL"), + label: msg("Start Page"), + icon: "file-earmark-richtext", + detail: msg("Show a single URL snapshot"), }, }; @@ -188,7 +188,7 @@ export class CollectionStartPageDialog extends BtrixElement {
- ${when( - showSettings && this.collection, - this.renderSettings, - this.renderShareLink, - )} + ${when(showSettings && this.collection, this.renderSettings)}
@@ -266,7 +262,6 @@ export class ShareCollection extends BtrixElement {
- ${when(showSettings, this.renderShareLink)} (this.showDialog = false)}> ${msg("Done")} @@ -287,6 +282,10 @@ export class ShareCollection extends BtrixElement { ); }} > + ${when( + this.collection?.access != CollectionAccess.Private, + this.renderShareLink, + )} ${when( this.org && !this.org.enablePublicProfile && @@ -389,7 +388,7 @@ export class ShareCollection extends BtrixElement { > ${isSelected ? html`` : nothing} @@ -410,7 +409,7 @@ export class ShareCollection extends BtrixElement { private readonly renderShareLink = () => { return html` -
+
${msg("Link to Share")}
`; case "moderate": return html``; case "good": return html``; case "commentOnly": // Comment icons are rendered separately diff --git a/frontend/src/features/qa/page-list/helpers/severity.ts b/frontend/src/features/qa/page-list/helpers/severity.ts index a0136932..66a106b7 100644 --- a/frontend/src/features/qa/page-list/helpers/severity.ts +++ b/frontend/src/features/qa/page-list/helpers/severity.ts @@ -29,9 +29,9 @@ export const textColorFromSeverity = cached((severity: Severity) => { case "good": return tw`text-green-600`; case "moderate": - return tw`text-yellow-600`; + return tw`text-yellow-500`; case "severe": - return tw`text-red-600`; + return tw`text-red-500`; default: return ""; } diff --git a/frontend/src/layouts/page.ts b/frontend/src/layouts/page.ts index 69fc104e..a8c410b8 100644 --- a/frontend/src/layouts/page.ts +++ b/frontend/src/layouts/page.ts @@ -39,7 +39,7 @@ export function page( >
${header.breadcrumbs ? html` ${pageNav(header.breadcrumbs)} ` : nothing} ${pageHeader(header)} diff --git a/frontend/src/pages/collections/collection.ts b/frontend/src/pages/collections/collection.ts index 1150fb2f..1b54f646 100644 --- a/frontend/src/pages/collections/collection.ts +++ b/frontend/src/pages/collections/collection.ts @@ -206,6 +206,7 @@ export class Collection extends BtrixElement { `; } + // TODO Consolidate with collection-detail.ts private renderAbout(collection: PublicCollection) { const dateRange = () => { if (!collection.dateEarliest || !collection.dateLatest) { @@ -243,13 +244,13 @@ export class Collection extends BtrixElement { return html`
-
+

${msg("Metadata")}

diff --git a/frontend/src/pages/org/collection-detail.ts b/frontend/src/pages/org/collection-detail.ts index 6c741e38..c98cf2fc 100644 --- a/frontend/src/pages/org/collection-detail.ts +++ b/frontend/src/pages/org/collection-detail.ts @@ -1,4 +1,5 @@ import { localized, msg, str } from "@lit/localize"; +import clsx from "clsx"; import { html, nothing, type PropertyValues, type TemplateResult } from "lit"; import { customElement, property, query, state } from "lit/decorators.js"; import { choose } from "lit/directives/choose.js"; @@ -24,6 +25,7 @@ import type { ArchivedItem, Crawl, Upload } from "@/types/crawler"; import type { CrawlState } from "@/types/crawlState"; import { pluralOf } from "@/utils/pluralize"; import { formatRwpTimestamp } from "@/utils/replay"; +import { tw } from "@/utils/tailwind"; const ABORT_REASON_THROTTLE = "throttled"; const INITIAL_ITEMS_PAGE_SIZE = 20; @@ -115,7 +117,7 @@ export class CollectionDetail extends BtrixElement { if (this.descriptionEditor) { // FIXME Focus on editor ready instead of timeout window.setTimeout(() => { - void this.descriptionEditor?.focus(); + this.descriptionEditor && void this.descriptionEditor.focus(); }, 200); } } @@ -148,9 +150,7 @@ export class CollectionDetail extends BtrixElement {
${this.renderInfoBar()}
-
+
${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`