From 12dcdfcb3c5c423007b2b176b239632e93631b15 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 9 Aug 2020 20:39:59 -0400 Subject: [PATCH] Sidepanel mode and card size is now configurable and can be set from the about dialog (temp location) --- src/app/app.component.html | 2 +- .../custom-playlists.component.html | 4 +-- .../custom-playlists.component.ts | 3 +- .../recent-videos.component.html | 4 +-- .../recent-videos/recent-videos.component.ts | 3 +- .../about-dialog/about-dialog.component.html | 28 +++++++++++++++++++ .../about-dialog/about-dialog.component.ts | 14 +++++++++- src/app/posts.services.ts | 10 +++++++ 8 files changed, 58 insertions(+), 10 deletions(-) diff --git a/src/app/app.component.html b/src/app/app.component.html index 4611d3a..6d80d45 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -38,7 +38,7 @@
- + Home Login diff --git a/src/app/components/custom-playlists/custom-playlists.component.html b/src/app/components/custom-playlists/custom-playlists.component.html index e45cb61..f5a90bd 100644 --- a/src/app/components/custom-playlists/custom-playlists.component.html +++ b/src/app/components/custom-playlists/custom-playlists.component.html @@ -1,8 +1,8 @@
-
- +
+
diff --git a/src/app/components/custom-playlists/custom-playlists.component.ts b/src/app/components/custom-playlists/custom-playlists.component.ts index 6d870bf..1f2549f 100644 --- a/src/app/components/custom-playlists/custom-playlists.component.ts +++ b/src/app/components/custom-playlists/custom-playlists.component.ts @@ -14,10 +14,9 @@ export class CustomPlaylistsComponent implements OnInit { playlists = null; playlists_received = false; - card_size = 'medium'; downloading_content = {'video': {}, 'audio': {}}; - constructor(private postsService: PostsService, private router: Router, private dialog: MatDialog) { } + constructor(public postsService: PostsService, private router: Router, private dialog: MatDialog) { } ngOnInit(): void { this.postsService.service_initialized.subscribe(init => { diff --git a/src/app/components/recent-videos/recent-videos.component.html b/src/app/components/recent-videos/recent-videos.component.html index 6a15bc5..6339a33 100644 --- a/src/app/components/recent-videos/recent-videos.component.html +++ b/src/app/components/recent-videos/recent-videos.component.html @@ -26,8 +26,8 @@
-
- +
+
diff --git a/src/app/components/recent-videos/recent-videos.component.ts b/src/app/components/recent-videos/recent-videos.component.ts index 60172e8..f9ee784 100644 --- a/src/app/components/recent-videos/recent-videos.component.ts +++ b/src/app/components/recent-videos/recent-videos.component.ts @@ -13,7 +13,6 @@ export class RecentVideosComponent implements OnInit { subscription_files_received = false; files: any[] = null; filtered_files: any[] = null; - card_size = 'medium'; downloading_content = {'video': {}, 'audio': {}}; search_mode = false; search_text = ''; @@ -48,7 +47,7 @@ export class RecentVideosComponent implements OnInit { }; filterProperty = this.filterProperties['upload_date']; - constructor(private postsService: PostsService, private router: Router) { } + constructor(public postsService: PostsService, private router: Router) { } ngOnInit(): void { this.postsService.service_initialized.subscribe(init => { diff --git a/src/app/dialogs/about-dialog/about-dialog.component.html b/src/app/dialogs/about-dialog/about-dialog.component.html index 954a428..e0941b4 100644 --- a/src/app/dialogs/about-dialog/about-dialog.component.html +++ b/src/app/dialogs/about-dialog/about-dialog.component.html @@ -24,6 +24,34 @@

Found a bug or have a suggestion? Click here to create an issue!

+ +
+
Personal settings:
+ + + + Over + + + Side + + + +
+ + + + Large + + + Medium + + + Small + + + +
diff --git a/src/app/dialogs/about-dialog/about-dialog.component.ts b/src/app/dialogs/about-dialog/about-dialog.component.ts index 1637d60..fb8c1fa 100644 --- a/src/app/dialogs/about-dialog/about-dialog.component.ts +++ b/src/app/dialogs/about-dialog/about-dialog.component.ts @@ -16,11 +16,13 @@ export class AboutDialogComponent implements OnInit { checking_for_updates = true; current_version_tag = CURRENT_VERSION; + sidepanel_mode = this.postsService.sidepanel_mode; + card_size = this.postsService.card_size; constructor(private postsService: PostsService) { } ngOnInit(): void { - this.getLatestGithubRelease() + this.getLatestGithubRelease(); } getLatestGithubRelease() { @@ -30,4 +32,14 @@ export class AboutDialogComponent implements OnInit { }); } + sidePanelModeChanged(new_mode) { + localStorage.setItem('sidepanel_mode', new_mode); + this.postsService.sidepanel_mode = new_mode; + } + + cardSizeOptionChanged(new_size) { + localStorage.setItem('card_size', new_size); + this.postsService.card_size = new_size; + } + } diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index c3dfa9a..c23548b 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -22,6 +22,8 @@ export class PostsService implements CanActivate { handShakeComplete = false; THEMES_CONFIG = THEMES_CONFIG; theme; + card_size = 'medium'; + sidepanel_mode = 'over'; settings_changed = new BehaviorSubject(false); auth_token = '4241b401-7236-493e-92b5-b72696b9d853'; session_id = null; @@ -102,6 +104,14 @@ export class PostsService implements CanActivate { this.reload_config.subscribe(yes_reload => { if (yes_reload) { this.reloadConfig(); } }); + + if (localStorage.getItem('sidepanel_mode')) { + this.sidepanel_mode = localStorage.getItem('sidepanel_mode'); + } + + if (localStorage.getItem('card_size')) { + this.card_size = localStorage.getItem('card_size'); + } } canActivate(route, state): Promise { return new Promise(resolve => {