Skip to content

Usenet streaming with a WebDAV server and a SABnzbd-compatible API

C#

Improved visual transition of queue progress bar from blue to green.

nzbdav-dev1fe5fbc287cd
diff --git a/frontend/app/routes/queue/components/status-badge/status-badge.module.css b/frontend/app/routes/queue/components/status-badge/status-badge.module.css
index a84cc187..598019ac 100644
--- a/frontend/app/routes/queue/components/status-badge/status-badge.module.css
+++ b/frontend/app/routes/queue/components/status-badge/status-badge.module.css
@@ -30,10 +30,14 @@
width: 0;
height: 100%;
background-color: rgba(var(--bs-primary-rgb));
- transition: width 500ms ease-in-out;
+ transition: width 500ms ease-in-out, background-color 500ms ease-in-out;
+
+ &.gray {
+ background-color: #333;
+ }
}
-.healthcheck-progress {
+.healthcheckProgress {
background-color: #60aa4a;
}
diff --git a/frontend/app/routes/queue/components/status-badge/status-badge.module.css.d.ts b/frontend/app/routes/queue/components/status-badge/status-badge.module.css.d.ts
index e4b373d6..73c49d3a 100644
--- a/frontend/app/routes/queue/components/status-badge/status-badge.module.css.d.ts
+++ b/frontend/app/routes/queue/components/status-badge/status-badge.module.css.d.ts
@@ -3,8 +3,9 @@ declare const styles: {
readonly "badge": string;
readonly "badge-text": string;
readonly "progress": string;
- readonly "healthcheck-progress": string;
+ readonly "healthcheckProgress": string;
readonly "failure-badge": string;
+ readonly "gray": string;
};
export = styles;
diff --git a/frontend/app/routes/queue/components/status-badge/status-badge.tsx b/frontend/app/routes/queue/components/status-badge/status-badge.tsx
index a7974850..8004f843 100644
--- a/frontend/app/routes/queue/components/status-badge/status-badge.tsx
+++ b/frontend/app/routes/queue/components/status-badge/status-badge.tsx
@@ -22,7 +22,8 @@ export function StatusBadge({ status, percentage, error }: StatusBadgeProps) {
// determine badge text
let badgeText = statusLower;
- if (statusLower === "downloading" || percentNum > 0) badgeText = `${percentNum % 100}%`;
+ if (statusLower === "downloading" || percentNum > 0)
+ badgeText = `${percentNum > 100 ? percentNum - 100 : percentNum}%`;
// determine class name
if (error?.startsWith("Article with message-id")) error = "Missing articles";
@@ -50,17 +51,24 @@ type ProgressBadgeProps = {
export function ProgressBadge(props: ProgressBadgeProps) {
const isHealthCheck = props.percentNum > 100;
- const progressClassName = isHealthCheck
- ? styles.progress + " " + styles["healthcheck-progress"]
+ const progressOneClass = isHealthCheck
+ ? `${styles.progress} ${styles.gray}`
: styles.progress;
- const style = (props.percentNum >= 0)
- ? { width: `${props.percentNum % 100}%` }
+ const progressOneStyle = (props.percentNum >= 0)
+ ? { width: `${Math.min(props.percentNum, 100)}%` }
+ : undefined;
+
+ const progressTwoClass = `${styles.progress} ${styles.healthcheckProgress}`;
+
+ const progressTwoStyle = isHealthCheck
+ ? { width: `${Math.min(props.percentNum - 100, 100)}%` }
: undefined;
return (
<div {...className([styles.badge, props.className])} style={{ backgroundColor: props.color }}>
- <div className={progressClassName} style={style} />
+ <div className={progressOneClass} style={progressOneStyle} />
+ <div className={progressTwoClass} style={progressTwoStyle} />
<div className={styles["badge-text"]}>{props.children}</div>
</div>
);