aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/views/personal-files.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/src/views/personal-files.ts')
-rw-r--r--apps/files/src/views/personal-files.ts38
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/files/src/views/personal-files.ts b/apps/files/src/views/personal-files.ts
new file mode 100644
index 00000000000..241582057d1
--- /dev/null
+++ b/apps/files/src/views/personal-files.ts
@@ -0,0 +1,38 @@
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import { t } from '@nextcloud/l10n'
+import { View, getNavigation } from '@nextcloud/files'
+import { getContents } from '../services/PersonalFiles.ts'
+import { defaultView, hasPersonalFilesView } from '../utils/filesViews.ts'
+
+import AccountIcon from '@mdi/svg/svg/account-outline.svg?raw'
+
+export const VIEW_ID = 'personal'
+
+/**
+ * Register the personal files view if allowed
+ */
+export function registerPersonalFilesView(): void {
+ if (!hasPersonalFilesView()) {
+ return
+ }
+
+ const Navigation = getNavigation()
+ Navigation.register(new View({
+ id: VIEW_ID,
+ name: t('files', 'Personal files'),
+ caption: t('files', 'List of your files and folders that are not shared.'),
+
+ emptyTitle: t('files', 'No personal files found'),
+ emptyCaption: t('files', 'Files that are not shared will show up here.'),
+
+ icon: AccountIcon,
+ // if this is the default view we set it at the top of the list - otherwise default position of fifth
+ order: defaultView() === VIEW_ID ? 0 : 5,
+
+ getContents,
+ }))
+}