@unhingged/vizu-core 0.1.17 → 0.1.19

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/index.cjs CHANGED
@@ -2337,11 +2337,22 @@ var Sidebar = class {
2337
2337
  const conf = this.lastConfidence;
2338
2338
  const orphans = comments.filter((c) => conf.get(c.id) === "orphaned");
2339
2339
  const anchored = comments.filter((c) => conf.get(c.id) !== "orphaned");
2340
- const visible = this.filter === "open" ? anchored.filter((c) => (c.status ?? "open") === "open") : anchored;
2341
- const visibleOrphans = this.filter === "open" ? [] : orphans;
2340
+ const statusOf = (c) => c.status ?? "open";
2341
+ const visible = this.filter === "open" ? anchored.filter((c) => statusOf(c) === "open") : this.filter === "resolved" ? anchored.filter((c) => statusOf(c) !== "open") : anchored;
2342
+ const visibleOrphans = this.filter === "all" ? orphans : [];
2342
2343
  const counts = countByStatus(comments);
2343
2344
  if (visible.length === 0 && visibleOrphans.length === 0) {
2344
- 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.";
2345
+ let emptyCopy;
2346
+ if (comments.length === 0) {
2347
+ emptyCopy = "<strong>No comments yet</strong>Click any element on the page to leave one.";
2348
+ } else if (this.filter === "open") {
2349
+ const closed = counts.resolved + counts.wontfix;
2350
+ emptyCopy = `<strong>Nothing open.</strong>${closed} closed comment${closed === 1 ? "" : "s"} hidden. Switch to <em>All</em> to see them.`;
2351
+ } else if (this.filter === "resolved") {
2352
+ emptyCopy = `<strong>Nothing resolved.</strong>${counts.open} still open. Switch to <em>Open</em> or <em>All</em> to see more.`;
2353
+ } else {
2354
+ emptyCopy = "<strong>No comments yet</strong>Click any element on the page to leave one.";
2355
+ }
2345
2356
  this.el.innerHTML = `
2346
2357
  ${this.headerHtml(comments.length, counts)}
2347
2358
  <div class="vz-sidebar-body">
@@ -2437,6 +2448,9 @@ var Sidebar = class {
2437
2448
  <button class="vz-sidebar-filter ${this.filter === "open" ? "is-active" : ""}" data-vz="filter" data-filter="open" role="tab" aria-selected="${this.filter === "open"}">
2438
2449
  Open <span class="vz-sidebar-filter-count">${counts.open}</span>
2439
2450
  </button>
2451
+ <button class="vz-sidebar-filter ${this.filter === "resolved" ? "is-active" : ""}" data-vz="filter" data-filter="resolved" role="tab" aria-selected="${this.filter === "resolved"}">
2452
+ Resolved <span class="vz-sidebar-filter-count">${counts.resolved + counts.wontfix}</span>
2453
+ </button>
2440
2454
  <button class="vz-sidebar-filter ${this.filter === "all" ? "is-active" : ""}" data-vz="filter" data-filter="all" role="tab" aria-selected="${this.filter === "all"}">
2441
2455
  All <span class="vz-sidebar-filter-count">${total}</span>
2442
2456
  </button>