@duckmind/dm-darwin-x64 0.34.4 → 0.34.6
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/dm
CHANGED
|
Binary file
|
|
@@ -516,11 +516,12 @@ function renderCreditProgressBar(credits: DuckmindCreditsSnapshot, theme: ThemeL
|
|
|
516
516
|
const remaining = credits.remaining ?? 0;
|
|
517
517
|
const limit = credits.limit && credits.limit > 0 ? credits.limit : (remaining > 0 ? remaining : 0);
|
|
518
518
|
const percent = limit > 0 ? Math.max(0, Math.min(100, (remaining / limit) * 100)) : 0;
|
|
519
|
-
const
|
|
520
|
-
const
|
|
521
|
-
const
|
|
519
|
+
const rawFilledCells = Math.floor((percent / 100) * CREDIT_BAR_WIDTH);
|
|
520
|
+
const filledCells = percent >= 100 ? CREDIT_BAR_WIDTH : (percent > 0 ? Math.max(1, rawFilledCells) : 0);
|
|
521
|
+
const filled = "■".repeat(filledCells);
|
|
522
|
+
const empty = "□".repeat(Math.max(0, CREDIT_BAR_WIDTH - filledCells));
|
|
522
523
|
const color = percent <= 15 ? "error" : percent <= 35 ? "warning" : "success";
|
|
523
|
-
return `${safeFg(theme,
|
|
524
|
+
return `${safeFg(theme, color, filled, "accent")}${safeFg(theme, "borderMuted", empty)}`;
|
|
524
525
|
}
|
|
525
526
|
|
|
526
527
|
function isDuckmindProvider(ctx: any): boolean {
|