fix: Highlight folder icon for correct folder / media (#2560)

- Closes: #2128 
 - Closes: #2129
This commit is contained in:
Dermot Duffy
2026-07-02 10:26:30 -07:00
committed by GitHub
parent 3bb5ccd14f
commit 6a6d65d5c5
4 changed files with 156 additions and 2 deletions
+19 -2
View File
@@ -871,7 +871,7 @@ export class MenuButtonController {
if (folders.length === 1) {
const folderID = folders[0][0];
const isSelected = !!view?.query?.getFolderQueries(folderID).length;
const isSelected = !!view?.query?.hasFolderQueries(folderID);
const folder = folders[0][1];
return {
@@ -886,7 +886,7 @@ export class MenuButtonController {
}
const submenuItems = folders.map(([id, folder]) => {
const isSelected = !!view?.query?.getFolderQueries(id).length;
const isSelected = !!view?.query?.hasFolderQueries(id);
return {
enabled: true,
@@ -951,6 +951,23 @@ export class MenuButtonController {
continue;
}
// Unlike other views, a folder action targets a specific folder, so
// emphasize it only when that folder is the one being viewed. Matching
// on the view name alone would emphasize every folder button at once.
// An action without a folder ID keeps the plain view-name match.
if (
action.advanced_camera_card_action === 'folder' ||
action.advanced_camera_card_action === 'folders'
) {
const emphasized = action.folder
? !!options?.view?.query?.hasFolderQueries(action.folder)
: !!options?.view?.is(action.advanced_camera_card_action);
if (emphasized) {
return this._getEmphasizedStyle();
}
continue;
}
if (
VIEWS_USER_SPECIFIED.some(
(viewName) =>
+4
View File
@@ -58,6 +58,10 @@ export class UnifiedQuery {
);
}
public hasFolderQueries(folderID?: string): boolean {
return this.getFolderQueries(folderID).length > 0;
}
public getNonMediaQueries(): QueryNode[] {
return this._nodes.filter((node) => !this._isMediaQuery(node));
}