feat(quick-7): wire frontend pin-default-playlist feature end-to-end

- Add pinDefault state, getter, setter to favorites-store
- Add pinDefault getter and setPinDefault to favorites-controller
- Update sortedEntries in playlist-view to pin default playlist to top
- Add Pin to Top toggle in config page Favorites section
- Add Wails bindings for GetPinDefaultPlaylist/SetPinDefaultPlaylist
- React to PinDefault in FavoritesConfigChanged event payload
This commit is contained in:
2026-03-01 10:06:56 -05:00
parent 6e123bd47f
commit e6378e1f0d
6 changed files with 90 additions and 4 deletions
@@ -819,6 +819,21 @@ export class ConfigPage extends LitElement {
});
};
private handlePinDefaultChange = (
e: CustomEvent<ConfigFieldChangeEvent>,
): void => {
const pin = Boolean(e.detail.value);
this.favCtrl
.setPinDefault(pin)
.catch((err: unknown) => {
console.error(
'Failed to set pin default:',
err,
);
});
};
// ===================================================================
// TRACK LIST COLUMN HANDLERS
// ===================================================================
@@ -1082,6 +1097,18 @@ export class ConfigPage extends LitElement {
.iconStyle}
@config-change=${this.handleFavIconStyleChange}
></config-field>
<config-field
.schema=${{
key: 'pinDefaultPlaylist',
label: 'Pin to Top',
description:
'Always show the default playlist first, regardless of sort order.',
type: 'toggle' as const,
}}
.value=${this.favCtrl.pinDefault}
@config-change=${this.handlePinDefaultChange}
></config-field>
</config-section>
`;
}
@@ -1042,6 +1042,22 @@ export class PlaylistView
this.sortDirection === 'asc' ? 1 : -1;
return [...entries].sort((a, b) => {
// Pin default playlist to top when enabled.
if (this.favCtrl.pinDefault) {
const aIsDefault =
a.summary.ID ===
this.favCtrl.playlistId;
const bIsDefault =
b.summary.ID ===
this.favCtrl.playlistId;
if (aIsDefault && !bIsDefault)
return -1;
if (!aIsDefault && bIsDefault)
return 1;
}
let cmp = 0;
switch (this.sortField) {