@@ -45,9 +45,19 @@ function renderActionIconButton(action: string, icon: Spicetify.Icon, title: str
4545 return `<button type="button" class="qs-icon-btn" data-action="${ escapeHtml ( action ) } " title="${ escapeHtml ( title ) } ">${ getIconMarkup ( icon ) } </button>` ;
4646}
4747
48- function renderBadge ( text : string , variant : "default" | "accent" = "default" ) : string {
49- const cls = variant === "accent" ? "qs-pill qs-pill--accent" : "qs-pill" ;
50- return `<span class="${ cls } ">${ escapeHtml ( text ) } </span>` ;
48+ type BadgeVariant = "default" | "accent" | "version" | "channel" ;
49+
50+ function renderBadge ( text : string , variant : BadgeVariant = "default" ) : string {
51+ const classes = [ "qs-pill" ] ;
52+ if ( variant !== "default" ) {
53+ const variantClasses : Record < Exclude < BadgeVariant , "default" > , string > = {
54+ accent : "qs-pill--accent" ,
55+ version : "qs-pill--version" ,
56+ channel : "qs-pill--channel" ,
57+ } ;
58+ classes . push ( variantClasses [ variant ] ) ;
59+ }
60+ return `<span class="${ classes . join ( " " ) } ">${ escapeHtml ( text ) } </span>` ;
5161}
5262
5363function generateRowsHTMLFor ( list : Snapshot [ ] ) : string {
@@ -138,8 +148,8 @@ function generateSectionsHTML(): string {
138148}
139149
140150export function openManagerModal ( ui : UIHandlers ) : void {
141- const versionBadge = `<span class="qs-pill qs-pill--version"> ${ escapeHtml ( `v${ APP_VERSION } ` ) } </span>` ;
142- const channelBadge = APP_CHANNEL ? `<span class="qs-pill qs-pill--channel"> ${ escapeHtml ( APP_CHANNEL . toUpperCase ( ) ) } </span>` : "" ;
151+ const versionBadge = renderBadge ( `v${ APP_VERSION } ` , "version" ) ;
152+ const channelBadge = APP_CHANNEL ? renderBadge ( APP_CHANNEL . toUpperCase ( ) , "channel" ) : "" ;
143153 const sections = generateSectionsHTML ( ) ;
144154 const s = ui . getSettings ( ) ;
145155
@@ -181,7 +191,7 @@ export function openManagerModal(ui: UIHandlers): void {
181191 <div style="opacity:0.7; font-size:12px">Equal queues are never saved as automatic snapshots.</div>
182192 </div>
183193 <div class="qs-setting" style="margin-top:12px">
184- <label class="qs-checkbox"><input type="checkbox" id="qs-queue-warn-enabled" ${ s . queueWarnEnabled !== false ? "checked" : "" } /> ${ getIconMarkup ( "exclamation-circle" ) } Warn when queue is nearly full</label>
194+ <label class="qs-checkbox"><input type="checkbox" id="qs-queue-warn-enabled" ${ s . queueWarnEnabled ? "checked" : "" } /> ${ getIconMarkup ( "exclamation-circle" ) } Warn when queue is nearly full</label>
185195 <div style="opacity:0.7; font-size:12px">Heuristic limit; includes current track. Adjust if needed.</div>
186196 </div>
187197 <div class="qs-setting" style="margin-top:12px">
@@ -202,11 +212,11 @@ export function openManagerModal(ui: UIHandlers): void {
202212 </div>
203213 <div class="qs-setting">
204214 <label>${ getIconMarkup ( "queue" ) } Queue max size</label>
205- <input class="qs-input" type="number" id="qs-queue-max-size" min="10" step="1" value="${ s . queueMaxSize ?? 80 } " ${ s . queueWarnEnabled !== false ? "" : "disabled" } />
215+ <input class="qs-input" type="number" id="qs-queue-max-size" min="10" step="1" value="${ s . queueMaxSize } " ${ s . queueWarnEnabled ? "" : "disabled" } />
206216 </div>
207217 <div class="qs-setting">
208218 <label>${ getIconMarkup ( "exclamation-circle" ) } Warn when remaining slots ≤</label>
209- <input class="qs-input" type="number" id="qs-queue-warn-threshold" min="0" step="1" value="${ s . queueWarnThreshold ?? 5 } " ${ s . queueWarnEnabled !== false ? "" : "disabled" } />
219+ <input class="qs-input" type="number" id="qs-queue-warn-threshold" min="0" step="1" value="${ s . queueWarnThreshold } " ${ s . queueWarnEnabled ? "" : "disabled" } />
210220 </div>
211221 </div>
212222 </div>
@@ -243,7 +253,7 @@ export function openManagerModal(ui: UIHandlers): void {
243253 if ( intervalInput ) intervalInput . disabled = ! ( st . autoEnabled && st . autoMode === "timer" ) ;
244254 if ( chkOnlyNew ) chkOnlyNew . disabled = ! st . autoEnabled ;
245255 if ( maxAutosInput ) maxAutosInput . disabled = ! st . autoEnabled ;
246- const warnEnabled = st . queueWarnEnabled !== false ;
256+ const warnEnabled = st . queueWarnEnabled ;
247257 if ( queueMaxSizeInput ) queueMaxSizeInput . disabled = ! warnEnabled ;
248258 if ( queueWarnThresholdInput ) queueWarnThresholdInput . disabled = ! warnEnabled ;
249259 }
@@ -289,7 +299,7 @@ export function openManagerModal(ui: UIHandlers): void {
289299 if ( ! clickedButton ) return ;
290300
291301 const rowEl = clickedButton . closest < HTMLElement > ( ".qs-row" ) ;
292- const actionAttr = clickedButton . getAttribute ( "data-action" ) ?? undefined ;
302+ const actionAttr = clickedButton . getAttribute ( "data-action" ) ;
293303 const isRowAction = clickedButton . classList . contains ( "qs-icon-btn" ) ;
294304
295305 if ( ! rowEl || ( ! actionAttr && isRowAction ) ) return ;
@@ -456,7 +466,7 @@ export function openManagerModal(ui: UIHandlers): void {
456466 }
457467 if ( target . id === "qs-queue-warn-enabled" ) {
458468 const checkbox = target as HTMLInputElement ;
459- const queueWarnEnabled = ! ! checkbox . checked ;
469+ const queueWarnEnabled = checkbox . checked ;
460470 const s0 = ui . getSettings ( ) ;
461471 const newSettings : Settings = { ...s0 , queueWarnEnabled } ;
462472 ui . setSettings ( newSettings ) ;
@@ -467,7 +477,7 @@ export function openManagerModal(ui: UIHandlers): void {
467477 const input = target as HTMLInputElement ;
468478 const s0 = ui . getSettings ( ) ;
469479 const num = parseInt ( input . value , 10 ) ;
470- const value = Number . isFinite ( num ) && num > 1 ? num : ( s0 . queueMaxSize ?? 80 ) ;
480+ const value = Number . isFinite ( num ) && num > 1 ? num : s0 . queueMaxSize ;
471481 const newSettings : Settings = { ...s0 , queueMaxSize : value } ;
472482 ui . setSettings ( newSettings ) ;
473483 return ;
@@ -476,14 +486,14 @@ export function openManagerModal(ui: UIHandlers): void {
476486 const input = target as HTMLInputElement ;
477487 const s0 = ui . getSettings ( ) ;
478488 const num = parseInt ( input . value , 10 ) ;
479- const value = Number . isFinite ( num ) && num >= 0 ? num : ( s0 . queueWarnThreshold ?? 5 ) ;
489+ const value = Number . isFinite ( num ) && num >= 0 ? num : s0 . queueWarnThreshold ;
480490 const newSettings : Settings = { ...s0 , queueWarnThreshold : value } ;
481491 ui . setSettings ( newSettings ) ;
482492 return ;
483493 }
484494 if ( target . id === "qs-prompt-manual-before-replace" ) {
485495 const checkbox = target as HTMLInputElement ;
486- const promptManualBeforeReplace = ! ! checkbox . checked ;
496+ const promptManualBeforeReplace = checkbox . checked ;
487497 const s0 = ui . getSettings ( ) ;
488498 const newSettings : Settings = { ...s0 , promptManualBeforeReplace } ;
489499 ui . setSettings ( newSettings ) ;
0 commit comments