Skip to content

Commit

Permalink
auto close filters
Browse files Browse the repository at this point in the history
  • Loading branch information
cbartondock committed Jun 12, 2024
1 parent 4ff3b48 commit 7474673
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions src/renderer/components/preview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, ChangeDetectionStrategy, ChangeDetectorRef, OnDestroy, Rende
import { ActivatedRoute } from '@angular/router';
import { Subscription, BehaviorSubject } from 'rxjs';
import { PreviewService, SettingsService, ImageProviderService, IpcService, UserExceptionsService } from "../services";
import { PreviewData, PreviewDataApp, PreviewDataApps, PreviewVariables, AppSettings, ImageContent, SelectItem, UserConfiguration, ArtworkViewType, ArtworkType, isArtworkType, ImageProviderType, UserExceptionData } from "../../models";
import { PreviewData, PreviewDataApp, PreviewDataApps, PreviewVariables, AppSettings, ImageContent, SelectItem, UserConfiguration, ArtworkViewType, ArtworkType, isArtworkType, ImageProviderType, UserExceptionData, SteamList } from "../../models";
import { APP } from '../../variables';
import { FileSelector } from '../../lib';
import { artworkTypes, artworkViewTypes, artworkViewNames, artworkDimsDict } from '../../lib/artwork-types';
Expand Down Expand Up @@ -65,13 +65,7 @@ export class PreviewComponent implements OnDestroy {
detailsOriginalExcludeArt: boolean = false;

showExcludes: boolean = false;
excludedAppIds: {
[steamDirectory: string]: {
[userId: string]: {
[appId: string]: boolean
}
}
} = {};
excludedAppIds: SteamList<{[appId: string]: boolean}> = {};
excludePutBacks: {[exceptionKey: string]: boolean} = {};
exclusionCount: number = 0;

Expand Down Expand Up @@ -134,10 +128,19 @@ export class PreviewComponent implements OnDestroy {
return isArtworkType(artworkViewType)
}

generatePreviewData() {
closeAll() {
this.closeFilters()
this.closeRight();
}

closeRight() {
this.closeDetails();
this.closeListImages();
this.cancelExcludes();
}

generatePreviewData() {
this.closeRight();
this.previewService.generatePreviewData();
}

Expand Down Expand Up @@ -342,18 +345,28 @@ export class PreviewComponent implements OnDestroy {
}
}
return this.previewService.saveData({removeAll: false, batchWrite: false}).then((noError: boolean | void) => {
if (noError)
if (noError) {
this.closeAll()
this.previewService.clearPreviewData();
}
});
}

closeFilters() {
this.showFilters = false;
this.renderer.setStyle(this.elementRef.nativeElement,'--filters-width','0%',RendererStyleFlags2.DashCase);
}

openFilters() {
this.showFilters = true;
this.renderer.setStyle(this.elementRef.nativeElement, '--filters-width', '300px', RendererStyleFlags2.DashCase);
}

toggleFilters() {
if(this.showFilters) {
this.showFilters = false;
this.renderer.setStyle(this.elementRef.nativeElement,'--filters-width','0%',RendererStyleFlags2.DashCase);
this.closeFilters();
} else {
this.showFilters = true;
this.renderer.setStyle(this.elementRef.nativeElement, '--filters-width', '300px', RendererStyleFlags2.DashCase);
this.openFilters();
}
this.changeDetectionRef.detectChanges();
}
Expand Down

0 comments on commit 7474673

Please sign in to comment.