From 069db130a7c66f21e35219021278edd7c40afe2f Mon Sep 17 00:00:00 2001 From: Kevin Yeh Date: Fri, 25 Nov 2022 15:01:40 -0800 Subject: [PATCH 1/6] feat: recursive folder view --- lib/Controller/ApiBase.php | 2 +- src/components/Timeline.vue | 5 ++++- src/components/top-matter/FolderTopMatter.vue | 21 ++++++++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/Controller/ApiBase.php b/lib/Controller/ApiBase.php index 7a882d30..19d92633 100644 --- a/lib/Controller/ApiBase.php +++ b/lib/Controller/ApiBase.php @@ -187,7 +187,7 @@ class ApiBase extends Controller protected function isRecursive() { - return null === $this->request->getParam('folder'); + return null === $this->request->getParam('folder') || "1" === $this->request->getParam('recursive'); } protected function isArchive() diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index b5c79554..0ad6e269 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -240,7 +240,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) { @Watch("$route") async routeChange(to: any, from?: any) { - if (from?.path !== to.path) { + if (from?.path !== to.path || from.query.recursive !== to.query.recursive) { await this.refresh(); } @@ -565,6 +565,9 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) { // Folder if (this.$route.name === "folders") { query.set("folder", utils.getFolderRoutePath(this.config_foldersPath)); + if(this.$route.query.recursive === "1") { + query.set("recursive", "1"); + } } // Archive diff --git a/src/components/top-matter/FolderTopMatter.vue b/src/components/top-matter/FolderTopMatter.vue index aa2ef1d0..aeab4a66 100644 --- a/src/components/top-matter/FolderTopMatter.vue +++ b/src/components/top-matter/FolderTopMatter.vue @@ -15,7 +15,17 @@
- + + + {{ t("memories", recursive ? "Show folders" : "Timeline") }} + + import("@nextcloud/vue/dist/Components/NcBreadcrumb"); import NcActions from "@nextcloud/vue/dist/Components/NcActions"; import NcActionButton from "@nextcloud/vue/dist/Components/NcActionButton"; +import NcActionRouter from "@nextcloud/vue/dist/Components/NcActionRouter"; import GlobalMixin from "../../mixins/GlobalMixin"; @@ -48,6 +59,8 @@ import FolderShareModal from "../modal/FolderShareModal.vue"; import HomeIcon from "vue-material-design-icons/Home.vue"; import ShareIcon from "vue-material-design-icons/ShareVariant.vue"; +import TimelineIcon from "vue-material-design-icons/ImageMultiple.vue"; +import FoldersIcon from "vue-material-design-icons/FolderMultiple.vue"; @Component({ components: { @@ -55,13 +68,17 @@ import ShareIcon from "vue-material-design-icons/ShareVariant.vue"; NcBreadcrumb, NcActions, NcActionButton, + NcActionRouter, FolderShareModal, HomeIcon, ShareIcon, + TimelineIcon, + FoldersIcon }, }) export default class FolderTopMatter extends Mixins(GlobalMixin) { private topMatter?: TopMatterFolder = null; + private recursive: boolean = false; @Watch("$route") async routeChange(from: any, to: any) { @@ -90,8 +107,10 @@ export default class FolderTopMatter extends Mixins(GlobalMixin) { }; }), }; + this.recursive = this.$route.query.recursive === '1' } else { this.topMatter = null; + this.recursive = false; } } } From bd3f5434c97a861d61e43258bba76465a872cb54 Mon Sep 17 00:00:00 2001 From: Kevin Yeh Date: Fri, 25 Nov 2022 21:55:07 -0800 Subject: [PATCH 2/6] fix: adjust icons --- src/components/top-matter/FolderTopMatter.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/top-matter/FolderTopMatter.vue b/src/components/top-matter/FolderTopMatter.vue index aeab4a66..2d70c056 100644 --- a/src/components/top-matter/FolderTopMatter.vue +++ b/src/components/top-matter/FolderTopMatter.vue @@ -22,8 +22,8 @@ > {{ t("memories", recursive ? "Show folders" : "Timeline") }} Date: Sat, 26 Nov 2022 14:45:49 -0800 Subject: [PATCH 3/6] fix: shallow comparison of route query object --- src/components/Timeline.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index 0ad6e269..52acb803 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -240,7 +240,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) { @Watch("$route") async routeChange(to: any, from?: any) { - if (from?.path !== to.path || from.query.recursive !== to.query.recursive) { + if (from?.path !== to.path || from.query !== to.query) { await this.refresh(); } From 992b7bb277ba9fdc3618f856e2794d43e2d0377e Mon Sep 17 00:00:00 2001 From: Kevin Yeh Date: Thu, 5 Jan 2023 11:01:43 -0800 Subject: [PATCH 4/6] Fix folder breadcrumbs overflowing --- src/components/top-matter/FolderTopMatter.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/top-matter/FolderTopMatter.vue b/src/components/top-matter/FolderTopMatter.vue index 38f987d7..cd6e2b93 100644 --- a/src/components/top-matter/FolderTopMatter.vue +++ b/src/components/top-matter/FolderTopMatter.vue @@ -124,6 +124,10 @@ export default defineComponent({ display: flex; vertical-align: middle; + .breadcrumb { + min-width: 0; + } + .right-actions { margin-right: 40px; z-index: 50; From 1e4f808e33d918f6c3acc641eac37600a3d7532f Mon Sep 17 00:00:00 2001 From: Kevin Yeh Date: Thu, 5 Jan 2023 13:15:59 -0800 Subject: [PATCH 5/6] Fix unnecessary refresh on routeChange --- src/components/Timeline.vue | 5 ++++- src/components/viewer/Viewer.vue | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index e3dfd68c..8f9dd609 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -321,7 +321,10 @@ export default defineComponent({ methods: { async routeChange(to: any, from?: any) { - if (from?.path !== to.path || from.query !== to.query) { + if ( + from?.path !== to.path || + JSON.stringify(from.query) !== JSON.stringify(to.query) + ) { await this.refresh(); } diff --git a/src/components/viewer/Viewer.vue b/src/components/viewer/Viewer.vue index c534c6ae..324a51ea 100644 --- a/src/components/viewer/Viewer.vue +++ b/src/components/viewer/Viewer.vue @@ -813,6 +813,7 @@ export default defineComponent({ if (this.$route.hash?.startsWith("#v")) { this.$router.replace({ hash: "", + query: this.$route.query, }); } } From 9053ca7bae137c84da3dad04f61e4171526d36cb Mon Sep 17 00:00:00 2001 From: Kevin Yeh Date: Thu, 5 Jan 2023 15:47:37 -0800 Subject: [PATCH 6/6] Fix URL path for recursive folder view --- src/components/top-matter/FolderTopMatter.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/top-matter/FolderTopMatter.vue b/src/components/top-matter/FolderTopMatter.vue index cd6e2b93..efdff8b3 100644 --- a/src/components/top-matter/FolderTopMatter.vue +++ b/src/components/top-matter/FolderTopMatter.vue @@ -17,7 +17,7 @@
{{ t("memories", recursive ? "Show folders" : "Timeline") }}