Skip to content

Commit 161db39

Browse files
authored
Merge pull request #384 from whyboris/minor-fixes
remember scroll offset when returning to root in folder view
2 parents 345a8f1 + c6c6ea0 commit 161db39

File tree

9 files changed

+52
-56
lines changed

9 files changed

+52
-56
lines changed

.gitignore

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,14 @@
1-
# See http://help.github.com/ignore-files/ for more about ignoring files.
1+
/node_modules
22

3-
# compiled output
43
/dist
54
/release
65
/tmp
76
/out-tsc
87
/app-builds
9-
main.js
10-
main-extract.js
11-
main-filenames.js
12-
main-globals.js
13-
main-rescan.js
14-
main-support.js
15-
utility.js
16-
src/**/*.js
17-
*.js.map
18-
19-
# TS to JS
20-
/interfaces/*.js
21-
22-
# dependencies
23-
/node_modules
24-
25-
# IDEs and editors
26-
/.idea
27-
.project
28-
.classpath
29-
.c9/
30-
*.launch
31-
.settings/
32-
*.sublime-workspace
338

34-
# IDE - VSCode
35-
.vscode/*
36-
!.vscode/settings.json
37-
!.vscode/tasks.json
38-
!.vscode/launch.json
39-
!.vscode/extensions.json
40-
41-
# misc
42-
npm-debug.log
9+
*.js
10+
*.js.map
11+
*.log
4312

44-
# System Files
4513
.DS_Store
4614
Thumbs.db

.vscode/extensions.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
22
"recommendations": [
3-
"angular.ng-template",
3+
"Angular.ng-template",
44
"coenraads.bracket-pair-colorizer",
55
"editorconfig.editorconfig",
66
"ms-vscode.vscode-typescript-tslint-plugin",
7-
"shinnn.stylelint",
87
]
98
}

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"files.exclude": {
33
"*.js": true,
4+
"**/*.js": true,
45
"**/dist": true,
56
"**/node_modules": true,
67
"**/release": true,

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Boris
3+
Copyright (c) 2020 Boris
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.br.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ As principais dependências utilizadas:
3636

3737
| Library | Version | Date | Comment |
3838
| ------- | ------- | ---- | ------- |
39-
| Angular | v8.2.3 | August 2019 | |
40-
| Angular-CLI | v8.2.3 | August 2019 | |
41-
| Electron | v6.0.6 | August 2019 | (internally uses Node v12.4.0 and Chromium 76) |
42-
| Electron Builder | v21.2.0 | August 2019 | |
39+
| Angular | v9.0.1 | February 2020 | |
40+
| Angular-CLI | v9.0.2 | February 2020 | |
41+
| Electron | v8.0.1 | February 2020 | (internally uses Node v12.13.0 and Chromium 80) |
42+
| Electron Builder | v22.3.2 | February 2020 | |
4343

4444
O programa funcionar com as últimas versões do Node e NPM (Junho de 2019). Note que você vai precisar instalar o [Angular CLI](https://cli.angular.io) para rodar o projeto (`npm install -g @angular/cli`).
4545

electron-builder.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
{
22
"productName": "Video Hub App 2",
33
"appId": "com.videohubapp.videohubapp2",
4-
"copyright": "Copyright © 2019 Boris Yakubchik",
4+
"copyright": "Copyright © 2020 Boris Yakubchik",
55
"directories": {
66
"output": "release/"
77
},
88
"files": [
99
"**/*",
1010
"!**/*.ts",
11-
"!*.code-workspace",
1211
"!LICENSE.md",
1312
"!package.json",
1413
"!package-lock.json",
1514
"!src/",
16-
"!e2e/",
17-
"!hooks/",
1815
"!angular.json",
19-
"!_config.yml",
20-
"!karma.conf.js",
2116
"!tsconfig.json",
2217
"!tslint.json"
2318
],

src/app/common/colors.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
export enum Colors {
22
autoFileTags = '#a8bffb',
33
autoFolderTags = '#fec02f',
4-
manualTags = '#63ff61',
4+
manualTags = '#f1ceb8', // same as `manual-tag-color` (see variables.scss)
55
// don't alphabetize below
66
// this is the order in which filters appear
77
folderUnion = '#FFD672',
88
folderIntersection = '#ffe5a5',
9-
fileUnion = '#6e96ff',
9+
fileUnion = '#97b3fc', // like `fileIntersection` but darker
1010
fileIntersection = '#b1c6fd',
1111
exclude = '#FF8888',
12-
tagUnion = '#6e96ff',
13-
tagIntersection = '#b1c6fd',
12+
tagUnion = '#ecbb9d', // like `tagIntersection` but darker
13+
tagIntersection = '#f1ceb8', // same as `manual-tag-color` (see variables.scss)
1414
tagExclusion = '#FF8888',
1515
}

src/app/components/home.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@
648648
class="breadcrumbs"
649649
@breadcrumbsAppear
650650
>
651-
<app-icon class="breadcrumb-folder-icon" [icon]="'icon-folder-blank'" (click)="folderViewNavigationPath = ''"></app-icon>
651+
<app-icon class="breadcrumb-folder-icon" [icon]="'icon-folder-blank'" (click)="breadcrumbHomeIconClick()"></app-icon>
652652
<span
653653
*ngFor="let item of folderViewNavigationPath.split('/'); index as idx"
654654
(click)="handleBbreadcrumbClicked(idx)"

src/app/components/home.component.ts

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ export class HomeComponent implements OnInit, AfterViewInit {
288288

289289
deletePipeHack: boolean = false; // to force deletePipe to update
290290

291+
// crappy hack to remember where to navigate to when in folder view and returning back to root
292+
folderNavigationScrollOffset: number = 0;
293+
291294
// ========================================================================
292295
// Please add new variables below if they don't fit into any other section
293296
// ------------------------------------------------------------------------
@@ -1081,12 +1084,17 @@ export class HomeComponent implements OnInit, AfterViewInit {
10811084
}
10821085

10831086
/**
1084-
* Handle clicking on FOLDER in gallery, or the folder icon in breadcrumbs
1087+
* Handle clicking on FOLDER in gallery, or the folder icon in breadcrumbs, or the `UP` folder
10851088
* @param filter
10861089
*/
10871090
handleFolderIconClicked(filter: string): void {
1091+
if (this.folderNavigationScrollOffset === 0) {
1092+
this.folderNavigationScrollOffset = this.virtualScroller.viewPortInfo.scrollStartPosition;
1093+
}
1094+
10881095
this.folderViewNavigationPath = filter;
1089-
this.scrollToTop();
1096+
1097+
this.scrollAppropriately(filter);
10901098
}
10911099

10921100
/**
@@ -1098,6 +1106,31 @@ export class HomeComponent implements OnInit, AfterViewInit {
10981106
this.scrollToTop();
10991107
}
11001108

1109+
/**
1110+
* Scroll appropriately after navigating back to root folder
1111+
*
1112+
* Rather hacky thing, but works in the basic case
1113+
* Fails if user enters folder, changes some search or sort filter, and navigates back
1114+
*/
1115+
scrollAppropriately(filter: string) {
1116+
if (filter === '') {
1117+
// TODO -- change `1` to `0` once the bug is fixed:
1118+
// https://github.com/rintoj/ngx-virtual-scroller/issues/420
1119+
this.virtualScroller.scrollToPosition(this.folderNavigationScrollOffset, 1);
1120+
this.folderNavigationScrollOffset = 0;
1121+
} else {
1122+
this.scrollToTop();
1123+
}
1124+
}
1125+
1126+
/**
1127+
* Go back to root and scroll to last-seen location
1128+
*/
1129+
breadcrumbHomeIconClick(): void {
1130+
this.folderViewNavigationPath = '';
1131+
this.scrollAppropriately('');
1132+
}
1133+
11011134
/**
11021135
* Open folder that contains the (current) clicked file
11031136
*/

0 commit comments

Comments
 (0)