refactor(dev-only): hide non-applicable options in display options menu
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
|||||||
isSmartView,
|
isSmartView,
|
||||||
isSystemView,
|
isSystemView,
|
||||||
PrefKey,
|
PrefKey,
|
||||||
|
SystemViewId,
|
||||||
TagMutator,
|
TagMutator,
|
||||||
TagPreferences,
|
TagPreferences,
|
||||||
VectorIconNameOrEmoji,
|
VectorIconNameOrEmoji,
|
||||||
@@ -23,6 +24,7 @@ import NoSubscriptionBanner from '@/Components/NoSubscriptionBanner/NoSubscripti
|
|||||||
import MenuRadioButtonItem from '@/Components/Menu/MenuRadioButtonItem'
|
import MenuRadioButtonItem from '@/Components/Menu/MenuRadioButtonItem'
|
||||||
import MenuSwitchButtonItem from '@/Components/Menu/MenuSwitchButtonItem'
|
import MenuSwitchButtonItem from '@/Components/Menu/MenuSwitchButtonItem'
|
||||||
import { Pill } from '@/Components/Preferences/PreferencesComponents/Content'
|
import { Pill } from '@/Components/Preferences/PreferencesComponents/Content'
|
||||||
|
import { featureTrunkEnabled, FeatureTrunkName } from '@/FeatureTrunk'
|
||||||
|
|
||||||
const DailyEntryModeEnabled = true
|
const DailyEntryModeEnabled = true
|
||||||
|
|
||||||
@@ -201,6 +203,9 @@ const DisplayOptionsMenu: FunctionComponent<DisplayOptionsMenuProps> = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isFilesTableViewEnabled = featureTrunkEnabled(FeatureTrunkName.FilesTableView)
|
||||||
|
const shouldHideNonApplicableOptions = isFilesTableViewEnabled && selectedTag?.uuid === SystemViewId.Files
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Menu className="text-sm" a11yLabel="Notes list options menu" isOpen={isOpen}>
|
<Menu className="text-sm" a11yLabel="Notes list options menu" isOpen={isOpen}>
|
||||||
<div className="my-1 px-3 text-base font-semibold uppercase text-text lg:text-xs">Preferences for</div>
|
<div className="my-1 px-3 text-base font-semibold uppercase text-text lg:text-xs">Preferences for</div>
|
||||||
@@ -283,6 +288,8 @@ const DisplayOptionsMenu: FunctionComponent<DisplayOptionsMenuProps> = ({
|
|||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</MenuRadioButtonItem>
|
</MenuRadioButtonItem>
|
||||||
|
{!shouldHideNonApplicableOptions && (
|
||||||
|
<>
|
||||||
<MenuItemSeparator />
|
<MenuItemSeparator />
|
||||||
<div className="px-3 py-1 text-base font-semibold uppercase text-text lg:text-xs">View</div>
|
<div className="px-3 py-1 text-base font-semibold uppercase text-text lg:text-xs">View</div>
|
||||||
{!isFilesSmartView && (
|
{!isFilesSmartView && (
|
||||||
@@ -353,6 +360,8 @@ const DisplayOptionsMenu: FunctionComponent<DisplayOptionsMenuProps> = ({
|
|||||||
>
|
>
|
||||||
Show trashed
|
Show trashed
|
||||||
</MenuSwitchButtonItem>
|
</MenuSwitchButtonItem>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{currentMode === 'tag' && DailyEntryModeEnabled && (
|
{currentMode === 'tag' && DailyEntryModeEnabled && (
|
||||||
<>
|
<>
|
||||||
@@ -376,8 +385,9 @@ const DisplayOptionsMenu: FunctionComponent<DisplayOptionsMenuProps> = ({
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{!shouldHideNonApplicableOptions && (
|
||||||
|
<>
|
||||||
<MenuItemSeparator />
|
<MenuItemSeparator />
|
||||||
|
|
||||||
<NewNotePreferences
|
<NewNotePreferences
|
||||||
disabled={controlsDisabled}
|
disabled={controlsDisabled}
|
||||||
application={application}
|
application={application}
|
||||||
@@ -385,6 +395,8 @@ const DisplayOptionsMenu: FunctionComponent<DisplayOptionsMenuProps> = ({
|
|||||||
mode={currentMode}
|
mode={currentMode}
|
||||||
changePreferencesCallback={changePreferences}
|
changePreferencesCallback={changePreferences}
|
||||||
/>
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Menu>
|
</Menu>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user