From 4c21a61dcfd1602bddb21c98c9d3e6cc6ba1d5f0 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Fri, 2 Feb 2024 20:57:00 +0530 Subject: [PATCH] chore: show selected tag options by default when opening display options menu --- .../ContentListView/Header/DisplayOptionsMenu.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/web/src/javascripts/Components/ContentListView/Header/DisplayOptionsMenu.tsx b/packages/web/src/javascripts/Components/ContentListView/Header/DisplayOptionsMenu.tsx index e8d62d3e3..06e55b7db 100644 --- a/packages/web/src/javascripts/Components/ContentListView/Header/DisplayOptionsMenu.tsx +++ b/packages/web/src/javascripts/Components/ContentListView/Header/DisplayOptionsMenu.tsx @@ -10,6 +10,7 @@ import { TagPreferences, VectorIconNameOrEmoji, PrefDefaults, + isTag, } from '@standardnotes/snjs' import { observer } from 'mobx-react-lite' import { FunctionComponent, useCallback, useEffect, useState } from 'react' @@ -86,13 +87,16 @@ const DisplayOptionsMenu: FunctionComponent = ({ selectedTag, paneController, }) => { + const isRegularTag = isTag(selectedTag) const isSystemTag = isSmartView(selectedTag) && isSystemView(selectedTag) const selectedTagPreferences = isSystemTag ? application.getPreference(PrefKey.SystemViewPreferences)?.[selectedTag.uuid as SystemViewId] : selectedTag.preferences - const [currentMode, setCurrentMode] = useState(selectedTagPreferences ? 'tag' : 'global') - const [preferences, setPreferences] = useState({}) const hasSubscription = application.subscriptionController.hasFirstPartyOnlineOrOfflineSubscription() + const [currentMode, setCurrentMode] = useState( + (hasSubscription && isRegularTag) || selectedTagPreferences ? 'tag' : 'global', + ) + const [preferences, setPreferences] = useState({}) const controlsDisabled = currentMode === 'tag' && !hasSubscription const isDailyEntry = selectedTagPreferences?.entryMode === 'daily'