feat: Added per-tag preference to use table layout and removed "Files Table View" from Labs

This commit is contained in:
Aman Harwara
2023-01-06 17:00:19 +05:30
parent eea97362f8
commit dd8ccdeadc
16 changed files with 98 additions and 76 deletions

View File

@@ -1,5 +1,5 @@
import { ListableContentItem } from '@/Components/ContentListView/Types/ListableContentItem'
import { destroyAllObjectProperties } from '@/Utils'
import { destroyAllObjectProperties, isMobileScreen } from '@/Utils'
import {
ApplicationEvent,
CollectionSort,
@@ -71,6 +71,7 @@ export class ItemListController extends AbstractViewController implements Intern
hideNotePreview: false,
hideEditorIcon: false,
}
isTableViewEnabled = false
private reloadItemsPromise?: Promise<unknown>
override deinit() {
@@ -451,6 +452,10 @@ export class ItemListController extends AbstractViewController implements Intern
this.selectionController.deselectItem(activeItem)
if (this.shouldSelectFirstItem(itemsReloadSource)) {
if (this.isTableViewEnabled && !isMobileScreen()) {
return
}
log(LoggingDomain.Selection, 'Selecting next item after closing active one')
this.selectionController.selectNextItem({ userTriggered: false })
}
@@ -513,6 +518,8 @@ export class ItemListController extends AbstractViewController implements Intern
? this.application.getPreference(PrefKey.SystemViewPreferences)?.[selectedTag.uuid as SystemViewId]
: selectedTag?.preferences
this.isTableViewEnabled = Boolean(selectedTagPreferences?.useTableView)
const currentSortBy = this.displayOptions.sortBy
let sortBy =
selectedTagPreferences?.sortBy ||
@@ -729,6 +736,10 @@ export class ItemListController extends AbstractViewController implements Intern
selectFirstItem = async () => {
const item = this.getFirstNonProtectedItem()
if (this.isTableViewEnabled && !isMobileScreen()) {
return
}
if (item) {
log(LoggingDomain.Selection, 'Selecting first item', item.uuid)