@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/internal.cjs CHANGED
@@ -1327,11 +1327,22 @@ var Sidebar = class {
1327
1327
  const conf = this.lastConfidence;
1328
1328
  const orphans = comments.filter((c) => conf.get(c.id) === "orphaned");
1329
1329
  const anchored = comments.filter((c) => conf.get(c.id) !== "orphaned");
1330
- const visible = this.filter === "open" ? anchored.filter((c) => (c.status ?? "open") === "open") : anchored;
1331
- const visibleOrphans = this.filter === "open" ? [] : orphans;
1330
+ const statusOf = (c) => c.status ?? "open";
1331
+ const visible = this.filter === "open" ? anchored.filter((c) => statusOf(c) === "open") : this.filter === "resolved" ? anchored.filter((c) => statusOf(c) === "resolved") : anchored;
1332
+ const visibleOrphans = this.filter === "all" ? orphans : [];
1332
1333
  const counts = countByStatus(comments);
1333
1334
  if (visible.length === 0 && visibleOrphans.length === 0) {
1334
- 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.";
1335
+ let emptyCopy;
1336
+ if (comments.length === 0) {
1337
+ emptyCopy = "<strong>No comments yet</strong>Click any element on the page to leave one.";
1338
+ } else if (this.filter === "open") {
1339
+ const closed = counts.resolved + counts.wontfix;
1340
+ emptyCopy = `<strong>Nothing open.</strong>${closed} closed comment${closed === 1 ? "" : "s"} hidden. Switch to <em>All</em> to see them.`;
1341
+ } else if (this.filter === "resolved") {
1342
+ emptyCopy = `<strong>Nothing resolved.</strong>${counts.open} still open. Switch to <em>Open</em> or <em>All</em> to see more.`;
1343
+ } else {
1344
+ emptyCopy = "<strong>No comments yet</strong>Click any element on the page to leave one.";
1345
+ }
1335
1346
  this.el.innerHTML = `
1336
1347
  ${this.headerHtml(comments.length, counts)}
1337
1348
  <div class="vz-sidebar-body">
@@ -1427,6 +1438,9 @@ var Sidebar = class {
1427
1438
  <button class="vz-sidebar-filter ${this.filter === "open" ? "is-active" : ""}" data-vz="filter" data-filter="open" role="tab" aria-selected="${this.filter === "open"}">
1428
1439
  Open <span class="vz-sidebar-filter-count">${counts.open}</span>
1429
1440
  </button>
1441
+ <button class="vz-sidebar-filter ${this.filter === "resolved" ? "is-active" : ""}" data-vz="filter" data-filter="resolved" role="tab" aria-selected="${this.filter === "resolved"}">
1442
+ Resolved <span class="vz-sidebar-filter-count">${counts.resolved}</span>
1443
+ </button>
1430
1444
  <button class="vz-sidebar-filter ${this.filter === "all" ? "is-active" : ""}" data-vz="filter" data-filter="all" role="tab" aria-selected="${this.filter === "all"}">
1431
1445
  All <span class="vz-sidebar-filter-count">${total}</span>
1432
1446
  </button>