TagSpaces is an offline, open source, document manager with tagging support
feat: make existing perspectives configurable in the settings and extconfig
Ilian Sapundshieve668147889ec
diff --git a/scripts/extconfig-perspectives.js b/scripts/extconfig-perspectives.jsnew file mode 100644index 000000000..032fbc846--- /dev/null+++ b/scripts/extconfig-perspectives.js@@ -0,0 +1,11 @@+// Sample: distributor whitelist of perspectives. When ExtEnabledPerspectives+// is set, the Settings → Perspectives tab becomes read-only and the+// perspective switcher only shows the listed IDs. The user's own toggles in+// state.settings.enabledPerspectives are ignored on every load.+//+// Optionally pin the initial perspective for newly opened folders that have+// no per-folder preference in .ts/tsm.json.+//+// Available IDs: grid, list, gallery, mapique, kanban, folderviz, calendar.+window.ExtEnabledPerspectives = ['grid', 'list', 'kanban'];+window.ExtDefaultPerspective = 'grid';diff --git a/src/renderer/components/FolderContainer.tsx b/src/renderer/components/FolderContainer.tsxindex ebb3b0a35..7ea83f267 100644--- a/src/renderer/components/FolderContainer.tsx+++ b/src/renderer/components/FolderContainer.tsx@@ -34,12 +34,13 @@ import { useBrowserHistoryContext } from '-/hooks/useBrowserHistoryContext';import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';import { useOpenedEntryContext } from '-/hooks/useOpenedEntryContext';-import { AvailablePerspectives, PerspectiveIDs } from '-/perspectives';+import { getVisiblePerspectives, PerspectiveIDs } from '-/perspectives';import { Pro } from '-/pro';import { getProgress } from '-/reducers/app';import {getDefaultAIProvider,getDesktopMode,+ getEnabledPerspectives,getKeyBindingObject,isDevMode,isHideProFeatures,@@ -94,8 +95,14 @@ function FolderContainer({ toggleDrawer, drawerOpened, hidden }: Props) {const isDesktopMode = useSelector(getDesktopMode);const hideProFeatures: boolean = useSelector(isHideProFeatures);+ const enabledPerspectives: string[] = useSelector(getEnabledPerspectives);const progress = useSelector(getProgress);+ const visiblePerspectives = useMemo(+ () => getVisiblePerspectives(enabledPerspectives, hideProFeatures, Pro),+ [enabledPerspectives, hideProFeatures],+ );+const [perspectiveMenuAnchorEl, setPerspectiveMenuAnchorEl] =useState<null | HTMLElement>(null);const [hasAIChat, setHasAIChat] = useState<boolean>(false);@@ -107,6 +114,22 @@ function FolderContainer({ toggleDrawer, drawerOpened, hidden }: Props) {.catch(() => setHasAIChat(false));}, [currentDirectory?.path]);+ // Fallback when the active perspective is no longer in the visible set:+ // route to the first visible one (typically Grid). Per-folder preference in+ // tsm.json is left untouched — if the perspective is re-enabled later, the+ // folder reverts to it on next open.+ useEffect(() => {+ if (!currentPerspective || currentPerspective === PerspectiveIDs.UNSPECIFIED) {+ return;+ }+ const stillVisible = visiblePerspectives.some(+ (p) => p.id === currentPerspective,+ );+ if (!stillVisible && visiblePerspectives.length > 0) {+ setManualDirectoryPerspective(visiblePerspectives[0].id);+ }+ }, [currentPerspective, visiblePerspectives, setManualDirectoryPerspective]);+const openPerspectiveMenu = useCallback((event: React.MouseEvent<HTMLElement>) =>setPerspectiveMenuAnchorEl(event.currentTarget),@@ -154,74 +177,63 @@ function FolderContainer({ toggleDrawer, drawerOpened, hidden }: Props) {// Memoized toggle buttons for perspectivesconst perspectiveToggleButtons = useMemo(() =>- AvailablePerspectives.map((perspective) => {- let includePerspective = true;- if (hideProFeatures && !Pro && perspective.pro === true) {- includePerspective = false;- }- return (- includePerspective && (- <TsToggleButton- value={perspective.id}- aria-label={perspective.id}- key={perspective.id}- data-tid={perspective.key}- onClick={() => switchPerspective(perspective.id)}- sx={{- opacity: 0.9,- backgroundColor: theme.palette.background.default,- border: `1px solid ${theme.palette.divider}`,- }}- >- <Tooltip- title={- perspective.title +- (perspective.beta- ? ' ' + t('core:betaStatus').toUpperCase()- : '')- }- >- <Box sx={{ display: 'flex' }}>{perspective.icon}</Box>- </Tooltip>- </TsToggleButton>- )- );- }),- [theme.palette.background.default, theme.palette.divider, t],+ visiblePerspectives.map((perspective) => (+ <TsToggleButton+ value={perspective.id}+ aria-label={perspective.id}+ key={perspective.id}+ data-tid={perspective.key}+ onClick={() => switchPerspective(perspective.id)}+ sx={{+ opacity: 0.9,+ backgroundColor: theme.palette.background.default,+ border: `1px solid ${theme.palette.divider}`,+ }}+ >+ <Tooltip+ title={+ perspective.title ++ (perspective.beta+ ? ' ' + t('core:betaStatus').toUpperCase()+ : '')+ }+ >+ <Box sx={{ display: 'flex' }}>{perspective.icon}</Box>+ </Tooltip>+ </TsToggleButton>+ )),+ [+ visiblePerspectives,+ theme.palette.background.default,+ theme.palette.divider,+ t,+ ],);// Memoized menu items for perspectivesconst perspectiveMenuItems = useMemo(() =>- AvailablePerspectives.map((perspective) => {- let includePerspective = true;- if (hideProFeatures && !Pro && perspective.pro === true) {- includePerspective = false;- }- return (- includePerspective && (- <MenuItem- key={perspective.key}- data-tid={perspective.key}- onClick={() => {- handlePerspectiveMenuClose();- switchPerspective(perspective.id);- }}- >- <ListItemIcon>{perspective.icon}</ListItemIcon>- <ListItemText- primary={- <>- {perspective.title}- {perspective.beta && <BetaLabel />}- </>- }- />- </MenuItem>- )- );- }),- [handlePerspectiveMenuClose],+ visiblePerspectives.map((perspective) => (+ <MenuItem+ key={perspective.key}+ data-tid={perspective.key}+ onClick={() => {+ handlePerspectiveMenuClose();+ switchPerspective(perspective.id);+ }}+ >+ <ListItemIcon>{perspective.icon}</ListItemIcon>+ <ListItemText+ primary={+ <>+ {perspective.title}+ {perspective.beta && <BetaLabel />}+ </>+ }+ />+ </MenuItem>+ )),+ [visiblePerspectives, handlePerspectiveMenuClose],);// Memoized CircularProgress with labeldiff --git a/src/renderer/components/PerspectiveSelector.tsx b/src/renderer/components/PerspectiveSelector.tsxindex 63b618cf6..63172b946 100644--- a/src/renderer/components/PerspectiveSelector.tsx+++ b/src/renderer/components/PerspectiveSelector.tsx@@ -19,9 +19,10 @@import AppConfig from '-/AppConfig';import { BetaLabel } from '-/components/HelperComponents';import TsSelect from '-/components/TsSelect';-import { AvailablePerspectives, PerspectiveIDs } from '-/perspectives';+import { getVisiblePerspectives, PerspectiveIDs } from '-/perspectives';import { Pro } from '-/pro';import {+ getEnabledPerspectives,isDesktopMode,isDevMode,isHideProFeatures,@@ -47,8 +48,15 @@ function PerspectiveSelector(props: Props) {const devMode: boolean = useSelector(isDevMode);const desktopMode = useSelector(isDesktopMode);const hideProFeatures: boolean = useSelector(isHideProFeatures);+ const enabledPerspectives: string[] = useSelector(getEnabledPerspectives);const { t } = useTranslation();+ const visiblePerspectives = getVisiblePerspectives(+ enabledPerspectives,+ hideProFeatures,+ Pro,+ );+const perspectiveSelectorMenuItems = [];perspectiveSelectorMenuItems.push(<MenuItem@@ -64,24 +72,18 @@ function PerspectiveSelector(props: Props) {</MenuItem>,);- AvailablePerspectives.forEach((perspective) => {- let includePerspective = true;- if (hideProFeatures && !Pro && perspective.pro === true) {- includePerspective = false;- }- if (includePerspective) {- perspectiveSelectorMenuItems.push(- <MenuItem key={perspective.key} value={perspective.id}>- <Box sx={{ display: 'flex', alignItems: 'center' }}>- <ListItemIcon>{perspective.icon}</ListItemIcon>- <ListItemText>- {perspective.title} - {perspective.beta && <BetaLabel />}- </ListItemText>- </Box>- </MenuItem>,- );- }+ visiblePerspectives.forEach((perspective) => {+ perspectiveSelectorMenuItems.push(+ <MenuItem key={perspective.key} value={perspective.id}>+ <Box sx={{ display: 'flex', alignItems: 'center' }}>+ <ListItemIcon>{perspective.icon}</ListItemIcon>+ <ListItemText>+ {perspective.title} + {perspective.beta && <BetaLabel />}+ </ListItemText>+ </Box>+ </MenuItem>,+ );});return (diff --git a/src/renderer/components/dialogs/SettingsDialog.tsx b/src/renderer/components/dialogs/SettingsDialog.tsxindex 8b466f9e9..7353f204d 100644--- a/src/renderer/components/dialogs/SettingsDialog.tsx+++ b/src/renderer/components/dialogs/SettingsDialog.tsx@@ -32,11 +32,13 @@ import SettingsExtensions from '-/components/dialogs/components/SettingsExtensioimport SettingsFileTypes from '-/components/dialogs/components/SettingsFileTypes';import SettingsGeneral from '-/components/dialogs/components/SettingsGeneral';import SettingsKeyBindings from '-/components/dialogs/components/SettingsKeyBindings';+import SettingsPerspectives from '-/components/dialogs/components/SettingsPerspectives';import SettingsTemplates from '-/components/dialogs/components/SettingsTemplates';import TsDialogActions from '-/components/dialogs/components/TsDialogActions';import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';import { openURLExternally } from '-/services/utils-io';import ArticleIcon from '@mui/icons-material/Article';+import GridViewIcon from '@mui/icons-material/GridView';import Dialog from '@mui/material/Dialog';import DialogContent from '@mui/material/DialogContent';import Paper from '@mui/material/Paper';@@ -54,6 +56,7 @@ export enum SettingsTab {Templates = 'templates',KeyBindings = 'keyBindings',Extensions = 'extensions',+ Perspectives = 'perspectives',Advanced = 'advanced',AI = 'ai',}@@ -173,6 +176,17 @@ function SettingsDialog(props: Props) {data-tid="extensionsSettingsDialog"label={t('core:extensionsTab')}/>+ <Tab+ value={SettingsTab.Perspectives}+ sx={{+ textTransform: 'unset',+ justifyContent: 'flex-start',+ }}+ iconPosition="start"+ icon={smallScreen ? '' : <GridViewIcon />}+ data-tid="perspectivesSettingsDialog"+ label={t('core:perspectivesSettingsTab')}+ /><Tabvalue={SettingsTab.Advanced}sx={{@@ -214,6 +228,7 @@ function SettingsDialog(props: Props) {{currentTab === SettingsTab.Templates && <SettingsTemplates />}{currentTab === SettingsTab.KeyBindings && <SettingsKeyBindings />}{currentTab === SettingsTab.Extensions && <SettingsExtensions />}+ {currentTab === SettingsTab.Perspectives && <SettingsPerspectives />}{currentTab === SettingsTab.Advanced && <SettingsAdvanced />}{currentTab === SettingsTab.AI && (<SettingsAI closeSettings={onClose} />diff --git a/src/renderer/components/dialogs/components/SettingsPerspectives.tsx b/src/renderer/components/dialogs/components/SettingsPerspectives.tsxnew file mode 100644index 000000000..365c47eba--- /dev/null+++ b/src/renderer/components/dialogs/components/SettingsPerspectives.tsx@@ -0,0 +1,144 @@+/**+ * TagSpaces - universal file and folder organizer+ * Copyright (C) 2017-present TagSpaces GmbH+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License (version 3) as+ * published by the Free Software Foundation.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ */++import { BetaLabel } from '-/components/HelperComponents';+import { useNotificationContext } from '-/hooks/useNotificationContext';+import { AvailablePerspectives } from '-/perspectives';+import { Pro } from '-/pro';+import {+ actions as SettingsActions,+ getEnabledPerspectives,+ isEnabledPerspectivesLocked,+ isHideProFeatures,+} from '-/reducers/settings';+import Box from '@mui/material/Box';+import Chip from '@mui/material/Chip';+import List from '@mui/material/List';+import ListItem from '@mui/material/ListItem';+import ListItemIcon from '@mui/material/ListItemIcon';+import ListItemText from '@mui/material/ListItemText';+import Switch from '@mui/material/Switch';+import Tooltip from '@mui/material/Tooltip';+import Typography from '@mui/material/Typography';+import { ChangeEvent } from 'react';+import { useTranslation } from 'react-i18next';+import { useDispatch, useSelector } from 'react-redux';++function SettingsPerspectives() {+ const { t } = useTranslation();+ const dispatch = useDispatch();+ const { showNotification } = useNotificationContext();+ const enabledPerspectives: string[] = useSelector(getEnabledPerspectives);+ const hideProFeatures: boolean = useSelector(isHideProFeatures);+ const configLocked: boolean = isEnabledPerspectivesLocked();+ const hasPro = Pro ? true : false;++ const handleToggle =+ (perspectiveId: string, currentlyEnabled: boolean) =>+ (event: ChangeEvent<HTMLInputElement>) => {+ if (configLocked) {+ return;+ }+ const next = event.target.checked;+ if (!next) {+ const remaining = enabledPerspectives.filter(+ (id) => id !== perspectiveId,+ );+ if (remaining.length === 0) {+ showNotification(+ t('core:cannotDisableLastPerspective'),+ 'warning',+ true,+ );+ return;+ }+ }+ dispatch(SettingsActions.setPerspectiveEnabled(perspectiveId, next));+ };++ return (+ <Box+ sx={{+ overflowX: 'hidden',+ overflowY: 'auto',+ height: '100%',+ padding: '10px',+ }}+ >+ <Typography variant="body2" sx={{ marginBottom: 1 }}>+ {configLocked+ ? t('core:perspectivesConfiguredByExtConfig')+ : t('core:perspectivesSettingsHelp')}+ </Typography>+ <List>+ {AvailablePerspectives.map((perspective) => {+ if (perspective.pro === true && hideProFeatures && !hasPro) {+ return null;+ }+ const enabled = enabledPerspectives.includes(perspective.id);+ const proLocked = perspective.pro === true && !hasPro;+ const disabled = proLocked || configLocked;+ const switchControl = (+ <Switch+ data-tid={'enablePerspective_' + perspective.id}+ checked={enabled}+ disabled={disabled}+ onChange={handleToggle(perspective.id, enabled)}+ />+ );+ let wrappedSwitch = switchControl;+ if (configLocked) {+ wrappedSwitch = (+ <Tooltip title={t('core:perspectivesConfiguredByExtConfig')}>+ <span>{switchControl}</span>+ </Tooltip>+ );+ } else if (proLocked) {+ wrappedSwitch = (+ <Tooltip title={t('core:thisFunctionalityIsAvailableInPro')}>+ <span>{switchControl}</span>+ </Tooltip>+ );+ }+ return (+ <ListItem+ key={perspective.id}+ data-tid={'perspectiveRow_' + perspective.id}+ secondaryAction={wrappedSwitch}+ >+ <ListItemIcon>{perspective.icon}</ListItemIcon>+ <ListItemText+ primary={+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>+ {perspective.title}+ {perspective.pro && (+ <Chip size="small" color="primary" label="PRO" />+ )}+ {perspective.beta && <BetaLabel />}+ </Box>+ }+ />+ </ListItem>+ );+ })}+ </List>+ </Box>+ );+}++export default SettingsPerspectives;diff --git a/src/renderer/locales/en/core.json b/src/renderer/locales/en/core.jsonindex 07374ced8..c53ea6d90 100644--- a/src/renderer/locales/en/core.json+++ b/src/renderer/locales/en/core.json@@ -76,6 +76,10 @@"keyBindingsTab": "Key Bindings","advancedSettingsTab": "Advanced","extensionsTab": "Extensions",+ "perspectivesSettingsTab": "Perspectives",+ "perspectivesSettingsHelp": "Choose which perspectives are available in the perspective switcher. Disabled perspectives stay hidden until you re-enable them here.",+ "perspectivesConfiguredByExtConfig": "The available perspectives are configured by your administrator and cannot be changed here.",+ "cannotDisableLastPerspective": "At least one perspective must remain enabled.","enableDevMode": "Enable Developer Mode","hideProFeatures": "Hide Pro Features","autoSaveDescription": "Auto-save description changes",diff --git a/src/renderer/perspectives/index.tsx b/src/renderer/perspectives/index.tsxindex 659ba2160..c826eccf1 100644--- a/src/renderer/perspectives/index.tsx+++ b/src/renderer/perspectives/index.tsx@@ -99,11 +99,41 @@ export const CalendarPerspectiveMeta = {title: 'Calendar Perspective',};-export const AvailablePerspectives = [];-AvailablePerspectives.push(GridPerspectiveMeta);-AvailablePerspectives.push(ListPerspectiveMeta);-AvailablePerspectives.push(GalleryPerspectiveMeta);-AvailablePerspectives.push(MapiquePerspectiveMeta);-AvailablePerspectives.push(KanbanPerspectiveMeta);-AvailablePerspectives.push(FolderVizPerspectiveMeta);-AvailablePerspectives.push(CalendarPerspectiveMeta);+export type PerspectiveMeta = {+ id: string;+ key: string;+ pro: boolean;+ beta: boolean;+ icon: React.ReactNode;+ title: string;+};++export const AvailablePerspectives: PerspectiveMeta[] = [+ GridPerspectiveMeta,+ ListPerspectiveMeta,+ GalleryPerspectiveMeta,+ MapiquePerspectiveMeta,+ KanbanPerspectiveMeta,+ FolderVizPerspectiveMeta,+ CalendarPerspectiveMeta,+];++export const DefaultEnabledPerspectives: string[] = AvailablePerspectives.map(+ (p) => p.id,+);++export function getVisiblePerspectives(+ enabledPerspectives: string[],+ hideProFeatures: boolean,+ pro: any,+): PerspectiveMeta[] {+ return AvailablePerspectives.filter((p) => {+ if (!enabledPerspectives.includes(p.id)) {+ return false;+ }+ if (hideProFeatures && !pro && p.pro === true) {+ return false;+ }+ return true;+ });+}diff --git a/src/renderer/reducers/index.ts b/src/renderer/reducers/index.tsindex 4334cace7..bc241900b 100644--- a/src/renderer/reducers/index.ts+++ b/src/renderer/reducers/index.ts@@ -86,7 +86,15 @@ function configureApp(extConfigObj) {extConfigObj.ExtHideProFeatures ?? AppConfig.ExtHideProFeatures;AppConfig.ExtTheme = extConfigObj.ExtTheme ?? AppConfig.ExtTheme;AppConfig.ExtDefaultPerspective =- extConfigObj.ExtDefaultPerspective ?? AppConfig.ExtDefaultPerspective; // currently not implemented+ extConfigObj.ExtDefaultPerspective ?? AppConfig.ExtDefaultPerspective;+ // ExtEnabledPerspectives: array of perspective IDs to expose to the user.+ // When set, this is authoritative on every app load — the Settings tab+ // toggles become read-only and end-user preferences in+ // state.settings.enabledPerspectives are ignored. Unknown IDs are silently+ // dropped by getVisiblePerspectives at render time.+ if (Array.isArray(extConfigObj.ExtEnabledPerspectives)) {+ AppConfig.ExtEnabledPerspectives = extConfigObj.ExtEnabledPerspectives;+ }AppConfig.ExtLightThemeLightColor =extConfigObj.ExtLightThemeLightColor ?? AppConfig.ExtLightThemeLightColor; // do not apply currentlyAppConfig.ExtLightThemeMainColor =diff --git a/src/renderer/reducers/settings-default.ts b/src/renderer/reducers/settings-default.tsindex 09dfb9bec..2f69be295 100644--- a/src/renderer/reducers/settings-default.ts+++ b/src/renderer/reducers/settings-default.ts@@ -18,7 +18,7 @@import AppConfig from '-/AppConfig';import { extensionsFound, supportedFileTypes } from '-/extension-config';-import { PerspectiveIDs } from '-/perspectives';+import { DefaultEnabledPerspectives, PerspectiveIDs } from '-/perspectives';import keyBindings from '-/reducers/keybindings-default';let desktopMode = !AppConfig.isMobile;@@ -277,5 +277,7 @@ export default {? [...extensionsFound, ...AppConfig.ExtExtensionsFound]: extensionsFound,enabledExtensions: [],+ enabledPerspectives: DefaultEnabledPerspectives,+ seenPerspectiveOnboardings: {} as Record<string, boolean>,mapTileServers: [],};diff --git a/src/renderer/reducers/settings.ts b/src/renderer/reducers/settings.tsindex 73aee4c82..615ddc51a 100644--- a/src/renderer/reducers/settings.ts+++ b/src/renderer/reducers/settings.ts@@ -110,6 +110,11 @@ export const types = {SET_FILE_EDIT_HISTORY: 'SET_FILE_EDIT_HISTORY',SET_HIDE_PRO_FEATURES: 'SETTINGS/SET_HIDE_PRO_FEATURES',SET_AUTO_SAVE_DESCRIPTION: 'SETTINGS/SET_AUTO_SAVE_DESCRIPTION',+ SET_PERSPECTIVE_ENABLED: 'SETTINGS/SET_PERSPECTIVE_ENABLED',+ SET_ENABLED_PERSPECTIVES: 'SETTINGS/SET_ENABLED_PERSPECTIVES',+ MARK_PERSPECTIVE_ONBOARDING_SEEN:+ 'SETTINGS/MARK_PERSPECTIVE_ONBOARDING_SEEN',+ RESET_PERSPECTIVE_ONBOARDING: 'SETTINGS/RESET_PERSPECTIVE_ONBOARDING',};function generateUniqueName(array: Array<any>, baseName: string): string {@@ -533,6 +538,42 @@ export default (state: any = defaultSettings, action: any) => {fileEditHistory: action.fileEditHistory,};}+ case types.SET_PERSPECTIVE_ENABLED: {+ const current: string[] = Array.isArray(state.enabledPerspectives)+ ? state.enabledPerspectives+ : [];+ const isEnabled = current.includes(action.perspectiveId);+ let next: string[];+ if (action.enabled && !isEnabled) {+ next = [...current, action.perspectiveId];+ } else if (!action.enabled && isEnabled) {+ next = current.filter((id) => id !== action.perspectiveId);+ } else {+ return state;+ }+ return { ...state, enabledPerspectives: next };+ }+ case types.SET_ENABLED_PERSPECTIVES: {+ return { ...state, enabledPerspectives: action.enabledPerspectives };+ }+ case types.MARK_PERSPECTIVE_ONBOARDING_SEEN: {+ const seen = state.seenPerspectiveOnboardings || {};+ if (seen[action.perspectiveId] === true) {+ return state;+ }+ return {+ ...state,+ seenPerspectiveOnboardings: {+ ...seen,+ [action.perspectiveId]: true,+ },+ };+ }+ case types.RESET_PERSPECTIVE_ONBOARDING: {+ const seen = { ...(state.seenPerspectiveOnboardings || {}) };+ delete seen[action.perspectiveId];+ return { ...state, seenPerspectiveOnboardings: seen };+ }case types.TOGGLE_TAGGROUP: {let tagGroupCollapsed;if (state.tagGroupCollapsed) {@@ -697,6 +738,23 @@ export const actions = {type: types.SET_DEFAULTPERSPECTIVE,defaultPerspective,}),+ setPerspectiveEnabled: (perspectiveId: string, enabled: boolean) => ({+ type: types.SET_PERSPECTIVE_ENABLED,+ perspectiveId,+ enabled,+ }),+ setEnabledPerspectives: (enabledPerspectives: string[]) => ({+ type: types.SET_ENABLED_PERSPECTIVES,+ enabledPerspectives,+ }),+ markPerspectiveOnboardingSeen: (perspectiveId: string) => ({+ type: types.MARK_PERSPECTIVE_ONBOARDING_SEEN,+ perspectiveId,+ }),+ resetPerspectiveOnboarding: (perspectiveId: string) => ({+ type: types.RESET_PERSPECTIVE_ONBOARDING,+ perspectiveId,+ }),setColoredFileExtension: (coloredFileExtension: boolean) => ({type: types.SET_COLOREDFILEEXTENSION,coloredFileExtension,@@ -996,7 +1054,25 @@ export const getEntryPropertiesHeight = (state: any) =>export const getUseDefaultLocation = (state: any) =>state.settings.useDefaultLocation;export const getDefaultPerspective = (state: any) =>- state.settings.defaultPerspective;+ AppConfig.ExtDefaultPerspective ?? state.settings.defaultPerspective;+// Precedence: when extconfig.json defines ExtEnabledPerspectives, it is+// authoritative on every app load — the user's persisted toggles in+// state.settings.enabledPerspectives are ignored. Distributors / admins win+// over end-user preference; the Settings tab reflects this by rendering the+// rows read-only (see isEnabledPerspectivesLocked).+export const getEnabledPerspectives = (state: any): string[] => {+ if (Array.isArray(AppConfig.ExtEnabledPerspectives)) {+ return AppConfig.ExtEnabledPerspectives;+ }+ return Array.isArray(state.settings.enabledPerspectives)+ ? state.settings.enabledPerspectives+ : [];+};+export const isEnabledPerspectivesLocked = (): boolean =>+ Array.isArray(AppConfig.ExtEnabledPerspectives);+export const getSeenPerspectiveOnboardings = (+ state: any,+): Record<string, boolean> => state.settings.seenPerspectiveOnboardings || {};export const getColoredFileExtension = (state: any) =>state.settings.coloredFileExtension;export const getShowTagAreaOnStartup = (state: any) =>