nexus33rd commited on
Commit
c008ff2
·
verified ·
1 Parent(s): 29a0cd3

Upload 20 files

Browse files
Files changed (1) hide show
  1. static/app.js +21 -21
static/app.js CHANGED
@@ -150,24 +150,24 @@
150
  return escapeHtml(value || "-");
151
  }
152
 
153
- function metricBadge({ icon, label, value, tone = "default", wide = false }) {
154
  const toneClasses = {
155
  default: "border-white/10 bg-white/[0.04] text-stone-200",
156
- size: "border-sky-400/20 bg-sky-400/10 text-sky-100",
157
  down: "border-neon/20 bg-neon/10 text-neon",
158
  up: "border-lime/20 bg-lime/10 text-lime",
159
- peer: "border-violet/20 bg-violet/10 text-violet",
160
- ratio: "border-amber/20 bg-amber/10 text-amber-100",
161
- eta: "border-white/10 bg-black/20 text-stone-300",
162
  };
163
  const classes = toneClasses[tone] || toneClasses.default;
 
164
  return `
165
- <div class="inline-flex ${wide ? "min-w-[10.5rem] justify-between" : ""} items-center gap-2 rounded-2xl border px-3 py-2 text-xs ${classes}">
166
- <span class="inline-flex items-center gap-2">
167
- <i class="fa-solid ${icon} text-[11px]"></i>
168
- <span class="text-stone-400">${escapeHtml(label)}</span>
169
- </span>
170
- <span class="font-mono font-medium ${wide ? "text-right" : ""}">${escapeHtml(value)}</span>
 
 
171
  </div>
172
  `;
173
  }
@@ -420,17 +420,17 @@
420
  ? "bg-neon/10 text-neon"
421
  : "bg-white/[0.04] text-stone-300";
422
  const primaryBadges = [
423
- metricBadge({ icon: "fa-box-archive", label: "Size", value: torrent.total_size || "-", tone: "size", wide: true }),
424
- metricBadge({ icon: "fa-download", label: "Downloaded", value: torrent.downloaded || "-", tone: "default", wide: true }),
425
- metricBadge({ icon: "fa-upload", label: "Uploaded", value: torrent.uploaded || "-", tone: "default", wide: true }),
426
  metricBadge({ icon: "fa-arrow-down", label: "Down", value: torrent.dlspeed || "-", tone: "down" }),
427
  metricBadge({ icon: "fa-arrow-up", label: "Up", value: torrent.upspeed || "-", tone: "up" }),
428
- metricBadge({ icon: "fa-chart-simple", label: "Ratio", value: torrent.ratio || "-", tone: "ratio" }),
429
  ].join("");
430
  const peerBadges = [
431
- metricBadge({ icon: "fa-seedling", label: "Seed", value: torrent.num_seeds ?? 0, tone: "peer" }),
432
- metricBadge({ icon: "fa-users", label: "Peer", value: `${torrent.num_seeds ?? 0} / ${torrent.num_leechs ?? 0}`, tone: "peer", wide: true }),
433
- !isComplete ? metricBadge({ icon: "fa-clock", label: "ETA", value: torrent.eta || "-", tone: "eta", wide: true }) : "",
434
  ].join("");
435
 
436
  return `
@@ -446,7 +446,7 @@
446
  <span class="inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs ${tone.pill}">
447
  <span class="h-2 w-2 rounded-full ${tone.dot}"></span>${escapeHtml(tone.label)}
448
  </span>
449
- ${activeSpeed ? `<span class="inline-flex items-center rounded-full border border-white/10 bg-black/20 px-3 py-1.5 text-xs">${activeSpeed}</span>` : ""}
450
  ${endpointMeta}
451
  </div>
452
  </div>
@@ -466,11 +466,11 @@
466
 
467
  <div class="mt-4 h-px bg-gradient-to-r from-transparent via-white/12 to-transparent"></div>
468
 
469
- <div class="mt-4 flex flex-wrap gap-2">
470
  ${primaryBadges}
471
  </div>
472
 
473
- <div class="mt-3 flex flex-wrap gap-2">
474
  ${peerBadges}
475
  </div>
476
 
 
150
  return escapeHtml(value || "-");
151
  }
152
 
153
+ function metricBadge({ icon, label, value, tone = "default", span = "normal" }) {
154
  const toneClasses = {
155
  default: "border-white/10 bg-white/[0.04] text-stone-200",
156
+ muted: "border-white/10 bg-black/20 text-stone-300",
157
  down: "border-neon/20 bg-neon/10 text-neon",
158
  up: "border-lime/20 bg-lime/10 text-lime",
 
 
 
159
  };
160
  const classes = toneClasses[tone] || toneClasses.default;
161
+ const spanClass = span === "full" ? "sm:col-span-2" : "";
162
  return `
163
+ <div class="min-w-0 rounded-2xl border px-3 py-2.5 text-xs ${classes} ${spanClass}">
164
+ <div class="flex items-center justify-between gap-3">
165
+ <span class="inline-flex min-w-0 items-center gap-2">
166
+ <i class="fa-solid ${icon} shrink-0 text-[11px]"></i>
167
+ <span class="truncate text-stone-400">${escapeHtml(label)}</span>
168
+ </span>
169
+ <span class="min-w-0 truncate text-right font-mono font-medium">${escapeHtml(value)}</span>
170
+ </div>
171
  </div>
172
  `;
173
  }
 
420
  ? "bg-neon/10 text-neon"
421
  : "bg-white/[0.04] text-stone-300";
422
  const primaryBadges = [
423
+ metricBadge({ icon: "fa-box-archive", label: "Size", value: torrent.total_size || "-", tone: "muted" }),
424
+ metricBadge({ icon: "fa-download", label: "Downloaded", value: torrent.downloaded || "-", tone: "muted" }),
425
+ metricBadge({ icon: "fa-upload", label: "Uploaded", value: torrent.uploaded || "-", tone: "muted" }),
426
  metricBadge({ icon: "fa-arrow-down", label: "Down", value: torrent.dlspeed || "-", tone: "down" }),
427
  metricBadge({ icon: "fa-arrow-up", label: "Up", value: torrent.upspeed || "-", tone: "up" }),
428
+ metricBadge({ icon: "fa-chart-simple", label: "Ratio", value: torrent.ratio || "-", tone: "muted" }),
429
  ].join("");
430
  const peerBadges = [
431
+ metricBadge({ icon: "fa-seedling", label: "Seed", value: torrent.num_seeds ?? 0, tone: "muted" }),
432
+ metricBadge({ icon: "fa-users", label: "Peer", value: `${torrent.num_seeds ?? 0} / ${torrent.num_leechs ?? 0}`, tone: "muted" }),
433
+ !isComplete ? metricBadge({ icon: "fa-clock", label: "ETA", value: torrent.eta || "-", tone: "muted", span: "full" }) : "",
434
  ].join("");
435
 
436
  return `
 
446
  <span class="inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs ${tone.pill}">
447
  <span class="h-2 w-2 rounded-full ${tone.dot}"></span>${escapeHtml(tone.label)}
448
  </span>
449
+ ${activeSpeed ? `<span class="inline-flex items-center rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs text-stone-200">${activeSpeed}</span>` : ""}
450
  ${endpointMeta}
451
  </div>
452
  </div>
 
466
 
467
  <div class="mt-4 h-px bg-gradient-to-r from-transparent via-white/12 to-transparent"></div>
468
 
469
+ <div class="mt-4 grid grid-cols-1 gap-2 sm:grid-cols-2">
470
  ${primaryBadges}
471
  </div>
472
 
473
+ <div class="mt-3 grid grid-cols-1 gap-2 sm:grid-cols-2">
474
  ${peerBadges}
475
  </div>
476