|
4 | 4 | */ |
5 | 5 | import type { Folder, Node } from '@nextcloud/files' |
6 | 6 |
|
| 7 | +import { FileType, View, getNavigation } from '@nextcloud/files' |
| 8 | +import { getCanonicalLocale, getLanguage, t } from '@nextcloud/l10n' |
| 9 | +import { getFavoriteNodes } from '@nextcloud/files/dav' |
7 | 10 | import { subscribe } from '@nextcloud/event-bus' |
8 | | -import { FileType, View, getFavoriteNodes, getNavigation } from '@nextcloud/files' |
9 | | -import { getLanguage, translate as t } from '@nextcloud/l10n' |
10 | | -import { client } from '../services/WebdavClient.ts' |
| 11 | + |
11 | 12 | import FolderSvg from '@mdi/svg/svg/folder.svg?raw' |
12 | 13 | import StarSvg from '@mdi/svg/svg/star.svg?raw' |
13 | 14 |
|
| 15 | +import { client } from '../services/WebdavClient.ts' |
14 | 16 | import { getContents } from '../services/Favorites' |
15 | 17 | import { hashCode } from '../utils/hashUtils' |
16 | 18 | import logger from '../logger' |
@@ -118,7 +120,7 @@ export const registerFavoritesView = async () => { |
118 | 120 | * update the order property of the existing views |
119 | 121 | */ |
120 | 122 | const updateAndSortViews = function() { |
121 | | - favoriteFolders.sort((a, b) => a.path.localeCompare(b.path, getLanguage(), { ignorePunctuation: true })) |
| 123 | + favoriteFolders.sort((a, b) => a.basename.localeCompare(b.basename, [getLanguage(), getCanonicalLocale()], { ignorePunctuation: true, numeric: true, usage: 'sort' })) |
122 | 124 | favoriteFolders.forEach((folder, index) => { |
123 | 125 | const view = favoriteFoldersViews.find((view) => view.id === generateIdFromPath(folder.path)) |
124 | 126 | if (view) { |
@@ -176,4 +178,6 @@ export const registerFavoritesView = async () => { |
176 | 178 | removePathFromFavorites(favoriteFolder.path) |
177 | 179 | addToFavorites(node) |
178 | 180 | } |
| 181 | + |
| 182 | + updateAndSortViews() |
179 | 183 | } |
0 commit comments