blob: 194628a4089cde24f41daf2304af8be67ac3ab66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
export function shouldShowNavigationItem(
visibilityPreferencesKey: string | null,
isEditing: boolean,
data: Record<string, boolean> | null,
itemVisibilityPreferenceKey: string,
): boolean {
// If there are no visibility preferences,
// the item should always be shown.
if (!visibilityPreferencesKey) {
return true;
}
// If the visibility preference of an item
// is in an editing state, it should be shown.
if (isEditing) {
return true;
}
// Show the item if the visibility preference is to show it.
if (data && data[itemVisibilityPreferenceKey]) {
return true;
}
return false;
}
|