@unhingged/vizu-core 0.1.16 → 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.js CHANGED
@@ -1297,11 +1297,22 @@ var Sidebar = class {
1297
1297
  const conf = this.lastConfidence;
1298
1298
  const orphans = comments.filter((c) => conf.get(c.id) === "orphaned");
1299
1299
  const anchored = comments.filter((c) => conf.get(c.id) !== "orphaned");
1300
- const visible = this.filter === "open" ? anchored.filter((c) => (c.status ?? "open") === "open") : anchored;
1301
- const visibleOrphans = this.filter === "open" ? [] : orphans;
1300
+ const statusOf = (c) => c.status ?? "open";
1301
+ const visible = this.filter === "open" ? anchored.filter((c) => statusOf(c) === "open") : this.filter === "resolved" ? anchored.filter((c) => statusOf(c) === "resolved") : anchored;
1302
+ const visibleOrphans = this.filter === "all" ? orphans : [];
1302
1303
  const counts = countByStatus(comments);
1303
1304
  if (visible.length === 0 && visibleOrphans.length === 0) {
1304
- 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.";
1305
+ let emptyCopy;
1306
+ if (comments.length === 0) {
1307
+ emptyCopy = "<strong>No comments yet</strong>Click any element on the page to leave one.";
1308
+ } else if (this.filter === "open") {
1309
+ const closed = counts.resolved + counts.wontfix;
1310
+ emptyCopy = `<strong>Nothing open.</strong>${closed} closed comment${closed === 1 ? "" : "s"} hidden. Switch to <em>All</em> to see them.`;
1311
+ } else if (this.filter === "resolved") {
1312
+ emptyCopy = `<strong>Nothing resolved.</strong>${counts.open} still open. Switch to <em>Open</em> or <em>All</em> to see more.`;
1313
+ } else {
1314
+ emptyCopy = "<strong>No comments yet</strong>Click any element on the page to leave one.";
1315
+ }
1305
1316
  this.el.innerHTML = `
1306
1317
  ${this.headerHtml(comments.length, counts)}
1307
1318
  <div class="vz-sidebar-body">
@@ -1397,6 +1408,9 @@ var Sidebar = class {
1397
1408
  <button class="vz-sidebar-filter ${this.filter === "open" ? "is-active" : ""}" data-vz="filter" data-filter="open" role="tab" aria-selected="${this.filter === "open"}">
1398
1409
  Open <span class="vz-sidebar-filter-count">${counts.open}</span>
1399
1410
  </button>
1411
+ <button class="vz-sidebar-filter ${this.filter === "resolved" ? "is-active" : ""}" data-vz="filter" data-filter="resolved" role="tab" aria-selected="${this.filter === "resolved"}">
1412
+ Resolved <span class="vz-sidebar-filter-count">${counts.resolved}</span>
1413
+ </button>
1400
1414
  <button class="vz-sidebar-filter ${this.filter === "all" ? "is-active" : ""}" data-vz="filter" data-filter="all" role="tab" aria-selected="${this.filter === "all"}">
1401
1415
  All <span class="vz-sidebar-filter-count">${total}</span>
1402
1416
  </button>