@unhingged/vizu-core 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auto.cjs CHANGED
@@ -2327,11 +2327,22 @@ var Sidebar = class {
2327
2327
  const conf = this.lastConfidence;
2328
2328
  const orphans = comments.filter((c) => conf.get(c.id) === "orphaned");
2329
2329
  const anchored = comments.filter((c) => conf.get(c.id) !== "orphaned");
2330
- const visible = this.filter === "open" ? anchored.filter((c) => (c.status ?? "open") === "open") : anchored;
2331
- const visibleOrphans = this.filter === "open" ? [] : orphans;
2330
+ const statusOf = (c) => c.status ?? "open";
2331
+ const visible = this.filter === "open" ? anchored.filter((c) => statusOf(c) === "open") : this.filter === "resolved" ? anchored.filter((c) => statusOf(c) === "resolved") : anchored;
2332
+ const visibleOrphans = this.filter === "all" ? orphans : [];
2332
2333
  const counts = countByStatus(comments);
2333
2334
  if (visible.length === 0 && visibleOrphans.length === 0) {
2334
- const emptyCopy = this.filter === "open" && comments.length > 0 ? `<strong>Nothing open.</strong>${counts.resolved + counts.wontfix} closed comment${counts.resolved + counts.wontfix === 1 ? "" : "s"} hidden. Switch to <em>All</em> to see them.` : "<strong>No comments yet</strong>Click any element on the page to leave one.";
2335
+ let emptyCopy;
2336
+ if (comments.length === 0) {
2337
+ emptyCopy = "<strong>No comments yet</strong>Click any element on the page to leave one.";
2338
+ } else if (this.filter === "open") {
2339
+ const closed = counts.resolved + counts.wontfix;
2340
+ emptyCopy = `<strong>Nothing open.</strong>${closed} closed comment${closed === 1 ? "" : "s"} hidden. Switch to <em>All</em> to see them.`;
2341
+ } else if (this.filter === "resolved") {
2342
+ emptyCopy = `<strong>Nothing resolved.</strong>${counts.open} still open. Switch to <em>Open</em> or <em>All</em> to see more.`;
2343
+ } else {
2344
+ emptyCopy = "<strong>No comments yet</strong>Click any element on the page to leave one.";
2345
+ }
2335
2346
  this.el.innerHTML = `
2336
2347
  ${this.headerHtml(comments.length, counts)}
2337
2348
  <div class="vz-sidebar-body">
@@ -2427,6 +2438,9 @@ var Sidebar = class {
2427
2438
  <button class="vz-sidebar-filter ${this.filter === "open" ? "is-active" : ""}" data-vz="filter" data-filter="open" role="tab" aria-selected="${this.filter === "open"}">
2428
2439
  Open <span class="vz-sidebar-filter-count">${counts.open}</span>
2429
2440
  </button>
2441
+ <button class="vz-sidebar-filter ${this.filter === "resolved" ? "is-active" : ""}" data-vz="filter" data-filter="resolved" role="tab" aria-selected="${this.filter === "resolved"}">
2442
+ Resolved <span class="vz-sidebar-filter-count">${counts.resolved}</span>
2443
+ </button>
2430
2444
  <button class="vz-sidebar-filter ${this.filter === "all" ? "is-active" : ""}" data-vz="filter" data-filter="all" role="tab" aria-selected="${this.filter === "all"}">
2431
2445
  All <span class="vz-sidebar-filter-count">${total}</span>
2432
2446
  </button>