aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/views/files.ts
blob: 1be58fdaf9a8dbcb15dedd2c34d72f04c88ab44c (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
/**
 * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

import { View, getNavigation } from '@nextcloud/files'
import { t } from '@nextcloud/l10n'
import { getContents } from '../services/Files.ts'
import { defaultView } from '../utils/filesViews.ts'

import FolderSvg from '@mdi/svg/svg/folder.svg?raw'

export const VIEW_ID = 'files'

/**
 * Register the files view to the navigation
 */
export function registerFilesView() {
	const Navigation = getNavigation()
	Navigation.register(new View({
		id: VIEW_ID,
		name: t('files', 'All files'),
		caption: t('files', 'List of your files and folders.'),

		icon: FolderSvg,
		// if this is the default view we set it at the top of the list - otherwise below it
		order: defaultView() === VIEW_ID ? 0 : 5,

		getContents,
	}))
}