Skip to content

Commit 221afaf

Browse files
moodyjmzclaude
andcommitted
feat(overview): sort files by recent edit, favourites first
Uses sortNodes from @nextcloud/files with sortFavoritesFirst and mtime descending so the most recently edited files appear first with starred items pinned to the top. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
1 parent bf0db90 commit 221afaf

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/views/OfficeOverview.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
</template>
7777

7878
<script>
79+
import { sortNodes } from '@nextcloud/files'
7980
import { loadState } from '@nextcloud/initial-state'
8081
import { generateUrl } from '@nextcloud/router'
8182
import NcAppContent from '@nextcloud/vue/dist/Components/NcAppContent.js'
@@ -120,11 +121,14 @@ export default {
120121
computed: {
121122
files() {
122123
const byCategory = filterByCategory(this.allFiles, this.currentView)
123-
if (!this.searchQuery) {
124-
return byCategory
125-
}
126-
const q = this.searchQuery.toLowerCase()
127-
return byCategory.filter(f => f.basename.toLowerCase().includes(q))
124+
const filtered = this.searchQuery
125+
? byCategory.filter(f => f.basename.toLowerCase().includes(this.searchQuery.toLowerCase()))
126+
: byCategory
127+
return sortNodes(filtered, {
128+
sortFavoritesFirst: true,
129+
sortingMode: 'mtime',
130+
sortingOrder: 'asc',
131+
})
128132
},
129133
130134
emptyMessage() {

0 commit comments

Comments
 (0)