Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: with perspective configuration in LITE version

Ilian Sapundshiev0170da072a4d
diff --git a/src/renderer/components/dialogs/components/SettingsPerspectives.tsx b/src/renderer/components/dialogs/components/SettingsPerspectives.tsx
index 9812de739..57bd30bd0 100644
--- a/src/renderer/components/dialogs/components/SettingsPerspectives.tsx
+++ b/src/renderer/components/dialogs/components/SettingsPerspectives.tsx
@@ -59,6 +59,18 @@ function SettingsPerspectives() {
openPerspectiveOnboarding(perspectiveId);
};
+ // A perspective only "counts" as a fallback for the guard if the user
+ // can actually use it — Pro entries on a Lite build are perpetually
+ // enabled in redux (defaults add them all) but the user can never reach
+ // them through the switcher, so they shouldn't suppress the
+ // last-enabled warning when the user disables Grid or List.
+ const isUserUsable = (id: string): boolean => {
+ const meta = AvailablePerspectives.find((p) => p.id === id);
+ if (!meta) return false;
+ if (meta.pro === true && !hasPro) return false;
+ return true;
+ };
+
const handleToggle =
(perspectiveId: string, currentlyEnabled: boolean) =>
(event: ChangeEvent<HTMLInputElement>) => {
@@ -68,7 +80,7 @@ function SettingsPerspectives() {
const next = event.target.checked;
if (!next) {
const remaining = enabledPerspectives.filter(
- (id) => id !== perspectiveId,
+ (id) => id !== perspectiveId && isUserUsable(id),
);
if (remaining.length === 0) {
showNotification(