diff --git a/frontend/src/components/ui/badge.ts b/frontend/src/components/ui/badge.ts index 3141d7e2..ef917869 100644 --- a/frontend/src/components/ui/badge.ts +++ b/frontend/src/components/ui/badge.ts @@ -1,7 +1,7 @@ -import { TailwindElement } from "@/classes/TailwindElement"; -import { tw } from "@/utils/tailwind"; -import { html } from "lit"; +import { css } from "lit"; import { customElement, property } from "lit/decorators.js"; +import SlBadge from "@shoelace-style/shoelace/dist/components/badge/badge.component.js"; +import badgeStyles from "@shoelace-style/shoelace/dist/components/badge/badge.styles.js"; /** * Show numeric value in a label @@ -12,35 +12,18 @@ import { customElement, property } from "lit/decorators.js"; * ``` */ @customElement("btrix-badge") -export class Badge extends TailwindElement { - @property({ type: String }) - variant: - | "success" - | "warning" - | "danger" - | "neutral" - | "primary" - | "high-contrast" = "neutral"; +export class Badge extends SlBadge { + static styles = [ + badgeStyles, + css` + .badge { + border-color: rgba(255, 255, 255, 0.5); + line-height: 1rem; + padding: 0 1ch; + } + `, + ]; @property({ type: String, reflect: true }) role: string | null = "status"; - - render() { - return html` - - - - `; - } } diff --git a/frontend/src/pages/org/archived-item-detail.ts b/frontend/src/pages/org/archived-item-detail.ts index ed299533..9c0beecb 100644 --- a/frontend/src/pages/org/archived-item-detail.ts +++ b/frontend/src/pages/org/archived-item-detail.ts @@ -21,6 +21,7 @@ import { isApiError } from "@/utils/api"; const SECTIONS = [ "overview", + "qa", "watch", "replay", "files", @@ -142,6 +143,15 @@ export class CrawlDetail extends LiteElement { let sectionContent: string | TemplateResult = ""; switch (this.sectionName) { + case "qa": + sectionContent = this.renderPanel( + html`${this.renderTitle(msg("Crawl Analysis"))} + console.log("TODO")}> + ${msg("Reanalyze Crawl")} + `, + this.renderQA(), + ); + break; case "replay": sectionContent = this.renderPanel(msg("Replay"), this.renderReplay(), { "overflow-hidden": true, @@ -314,11 +324,13 @@ export class CrawlDetail extends LiteElement { label, iconLibrary, icon, + detail, }: { section: SectionName; label: string; iconLibrary: "app" | "default"; icon: string; + detail?: TemplateResult<1>; }) => { const isActive = section === this.sectionName; const baseUrl = window.location.pathname.split("#")[0]; @@ -336,7 +348,7 @@ export class CrawlDetail extends LiteElement { aria-hidden="true" library=${iconLibrary} > - ${label} `; }; @@ -351,6 +363,20 @@ export class CrawlDetail extends LiteElement { icon: "info-circle-fill", label: msg("Overview"), })} + ${when( + this.itemType === "crawl", + () => html` + ${renderNavItem({ + section: "qa", + iconLibrary: "default", + icon: "clipboard2-data-fill", + label: msg("QA"), + detail: html` + ${msg("Ready")} + `, + })} + `, + )} ${renderNavItem({ section: "replay", iconLibrary: "app", @@ -526,6 +552,15 @@ export class CrawlDetail extends LiteElement { `; } + private renderQA() { + return html` +
[summary]
+
[stats]
+

${msg("Pages")}

+
[pages]
+ `; + } + private renderReplay() { if (!this.crawl) return; const replaySource = `/api/orgs/${this.crawl.oid}/${ diff --git a/frontend/src/shoelace.ts b/frontend/src/shoelace.ts index 0ab484b0..da792586 100644 --- a/frontend/src/shoelace.ts +++ b/frontend/src/shoelace.ts @@ -75,6 +75,9 @@ import( import( /* webpackChunkName: "shoelace" */ "@shoelace-style/shoelace/dist/components/tree-item/tree-item" ); +import( + /* webpackChunkName: "shoelace" */ "@shoelace-style/shoelace/dist/components/badge/badge" +); setBasePath("/shoelace"); registerIconLibrary("app", {