feat: Added per-tag preference to use table layout and removed "Files Table View" from Labs
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
InternalEventPublishStrategy,
|
||||
VectorIconNameOrEmoji,
|
||||
isTag,
|
||||
PrefKey,
|
||||
} from '@standardnotes/snjs'
|
||||
import { action, computed, makeAutoObservable, makeObservable, observable, reaction, runInAction } from 'mobx'
|
||||
import { WebApplication } from '../../Application/Application'
|
||||
@@ -268,6 +269,14 @@ export class NavigationController
|
||||
return tag.uuid === SystemViewId.Files
|
||||
}
|
||||
|
||||
tagUsesTableView(tag: AnyTag): boolean {
|
||||
const isSystemView = tag instanceof SmartView && Object.values(SystemViewId).includes(tag.uuid as SystemViewId)
|
||||
const useTableView = isSystemView
|
||||
? this.application.getPreference(PrefKey.SystemViewPreferences)?.[tag.uuid as SystemViewId]
|
||||
: tag?.preferences
|
||||
return Boolean(useTableView)
|
||||
}
|
||||
|
||||
public isInAnySystemView(): boolean {
|
||||
return (
|
||||
this.selected instanceof SmartView && Object.values(SystemViewId).includes(this.selected.uuid as SystemViewId)
|
||||
@@ -466,8 +475,8 @@ export class NavigationController
|
||||
.catch(console.error)
|
||||
}
|
||||
|
||||
if (tag && this.isTagFilesView(tag)) {
|
||||
this.application.paneController.setPaneLayout(PaneLayout.FilesView)
|
||||
if (tag && (this.isTagFilesView(tag) || this.tagUsesTableView(tag))) {
|
||||
this.application.paneController.setPaneLayout(PaneLayout.TableView)
|
||||
} else if (userTriggered) {
|
||||
this.application.paneController.setPaneLayout(PaneLayout.ItemSelection)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user