aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/views/personal-files.ts
blob: 66d4e77b3765e35a8115beff4f3afc143d0b6879 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
 * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
import { translate as t } from '@nextcloud/l10n'
import { View, getNavigation } from '@nextcloud/files'

import { getContents } from '../services/PersonalFiles'
import AccountIcon from '@mdi/svg/svg/account.svg?raw'
import { loadState } from '@nextcloud/initial-state'

export default () => {
	// Don't show this view if the user has no storage quota
	const storageStats = loadState('files', 'storageStats', { quota: -1 })
	if (storageStats.quota === 0) {
		return
	}

	const Navigation = getNavigation()
	Navigation.register(new View({
		id: 'personal',
		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,
		order: 5,

		getContents,
	}))
}