mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-04 20:02:26 +00:00
Improve relay hygiene and count status
This commit is contained in:
1 parent
6ae4b7ab4f
commit
c3e986c9d3
12 files changed
+286
-59
No files matched your search
@@ -6201,11 +6201,16 @@ export class VideoModal {
|
||||
try {
|
||||
const token = subscribeToVideoViewCount(
|
||||
pointerInfo.pointer,
|
||||
({ total, status }) => {
|
||||
({ total, status, partial }) => {
|
||||
if (!viewEl || !viewEl.isConnected) {
|
||||
return;
|
||||
}
|
||||
viewEl.textContent = this.getViewCountLabel(total, status);
|
||||
viewEl.textContent = this.getViewCountLabel(total, status, partial);
|
||||
if (partial) {
|
||||
viewEl.dataset.viewCountState = "partial";
|
||||
} else {
|
||||
viewEl.dataset.viewCountState = status;
|
||||
}
|
||||
}
|
||||
);
|
||||
return { pointer: pointerInfo.pointer, token };
|
||||
@@ -6216,9 +6221,10 @@ export class VideoModal {
|
||||
}
|
||||
}
|
||||
|
||||
getViewCountLabel(total, status) {
|
||||
getViewCountLabel(total, status, partial) {
|
||||
if (Number.isFinite(total)) {
|
||||
return this.formatViewCountLabel(Number(total));
|
||||
const label = this.formatViewCountLabel(Number(total));
|
||||
return partial ? `${label} (partial)` : label;
|
||||
}
|
||||
if (status === "hydrating") {
|
||||
return "Loading…";
|
||||
|
||||
Reference in new issue
Block a user