From 4bb788153320458a2be3a38e48097f60e61b284c Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 26 Dec 2023 10:28:31 +0700 Subject: [PATCH 1/7] remove tooltip of base section list --- .../SelectionList/BaseSelectionList.js | 3 -- src/components/SelectionList/RadioListItem.js | 31 ++++++------------- src/components/SelectionList/UserListItem.js | 31 ++++++------------- .../SelectionList/selectionListPropTypes.js | 3 -- 4 files changed, 20 insertions(+), 48 deletions(-) diff --git a/src/components/SelectionList/BaseSelectionList.js b/src/components/SelectionList/BaseSelectionList.js index 454127612e0d..3bf16a098113 100644 --- a/src/components/SelectionList/BaseSelectionList.js +++ b/src/components/SelectionList/BaseSelectionList.js @@ -302,8 +302,6 @@ function BaseSelectionList({ const normalizedIndex = index + lodashGet(section, 'indexOffset', 0); const isDisabled = section.isDisabled || item.isDisabled; const isItemFocused = !isDisabled && focusedIndex === normalizedIndex; - // We only create tooltips for the first 10 users or so since some reports have hundreds of users, causing performance to degrade. - const showTooltip = normalizedIndex < 10; return ( selectRow(item, true)} disableIsFocusStyle={disableInitialFocusOptionStyle} diff --git a/src/components/SelectionList/RadioListItem.js b/src/components/SelectionList/RadioListItem.js index 2de0c96932ea..0583aca5ee55 100644 --- a/src/components/SelectionList/RadioListItem.js +++ b/src/components/SelectionList/RadioListItem.js @@ -1,38 +1,27 @@ import React from 'react'; import {View} from 'react-native'; import Text from '@components/Text'; -import Tooltip from '@components/Tooltip'; import useThemeStyles from '@hooks/useThemeStyles'; import {radioListItemPropTypes} from './selectionListPropTypes'; -function RadioListItem({item, showTooltip, textStyles, alternateTextStyles}) { +function RadioListItem({item, textStyles, alternateTextStyles}) { const styles = useThemeStyles(); return ( - + {item.text} + + + {Boolean(item.alternateText) && ( - {item.text} + {item.alternateText} - - - {Boolean(item.alternateText) && ( - - - {item.alternateText} - - )} ); diff --git a/src/components/SelectionList/UserListItem.js b/src/components/SelectionList/UserListItem.js index 39b7e02df3eb..16b64ac6ff1f 100644 --- a/src/components/SelectionList/UserListItem.js +++ b/src/components/SelectionList/UserListItem.js @@ -3,11 +3,10 @@ import React from 'react'; import {View} from 'react-native'; import SubscriptAvatar from '@components/SubscriptAvatar'; import Text from '@components/Text'; -import Tooltip from '@components/Tooltip'; import useThemeStyles from '@hooks/useThemeStyles'; import {userListItemPropTypes} from './selectionListPropTypes'; -function UserListItem({item, textStyles, alternateTextStyles, showTooltip}) { +function UserListItem({item, textStyles, alternateTextStyles}) { const styles = useThemeStyles(); return ( <> @@ -15,33 +14,23 @@ function UserListItem({item, textStyles, alternateTextStyles, showTooltip}) { )} - + {item.text} + + {Boolean(item.alternateText) && ( - {item.text} + {item.alternateText} - - {Boolean(item.alternateText) && ( - - - {item.alternateText} - - )} {Boolean(item.rightElement) && item.rightElement} diff --git a/src/components/SelectionList/selectionListPropTypes.js b/src/components/SelectionList/selectionListPropTypes.js index b753607cda61..35a9708a3bb1 100644 --- a/src/components/SelectionList/selectionListPropTypes.js +++ b/src/components/SelectionList/selectionListPropTypes.js @@ -16,9 +16,6 @@ const commonListItemPropTypes = { /** Whether this item is disabled */ isDisabled: PropTypes.bool, - /** Whether this item should show Tooltip */ - showTooltip: PropTypes.bool.isRequired, - /** Whether to use the Checkbox (multiple selection) instead of the Checkmark (single selection) */ canSelectMultiple: PropTypes.bool, From 453c966ff80d8cb6c6229a189f8e487b8fbeee4c Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 9 Jan 2024 16:03:58 +0700 Subject: [PATCH 2/7] only remove tooltip of timezone selection list --- .../SelectionList/BaseSelectionList.js | 4 +++ src/components/SelectionList/RadioListItem.js | 31 +++++++++++++------ src/components/SelectionList/UserListItem.js | 31 +++++++++++++------ .../SelectionList/selectionListPropTypes.js | 6 ++++ 4 files changed, 52 insertions(+), 20 deletions(-) diff --git a/src/components/SelectionList/BaseSelectionList.js b/src/components/SelectionList/BaseSelectionList.js index 3bf16a098113..4b0caa335c33 100644 --- a/src/components/SelectionList/BaseSelectionList.js +++ b/src/components/SelectionList/BaseSelectionList.js @@ -62,6 +62,7 @@ function BaseSelectionList({ disableKeyboardShortcuts = false, children, shouldStopPropagation = false, + shouldShowTooltip = true, shouldUseDynamicMaxToRenderPerBatch = false, }) { const theme = useTheme(); @@ -302,6 +303,8 @@ function BaseSelectionList({ const normalizedIndex = index + lodashGet(section, 'indexOffset', 0); const isDisabled = section.isDisabled || item.isDisabled; const isItemFocused = !isDisabled && focusedIndex === normalizedIndex; + // We only create tooltips for the first 10 users or so since some reports have hundreds of users, causing performance to degrade. + const showTooltip = normalizedIndex < 10; return ( selectRow(item, true)} disableIsFocusStyle={disableInitialFocusOptionStyle} diff --git a/src/components/SelectionList/RadioListItem.js b/src/components/SelectionList/RadioListItem.js index 0583aca5ee55..2de0c96932ea 100644 --- a/src/components/SelectionList/RadioListItem.js +++ b/src/components/SelectionList/RadioListItem.js @@ -1,27 +1,38 @@ import React from 'react'; import {View} from 'react-native'; import Text from '@components/Text'; +import Tooltip from '@components/Tooltip'; import useThemeStyles from '@hooks/useThemeStyles'; import {radioListItemPropTypes} from './selectionListPropTypes'; -function RadioListItem({item, textStyles, alternateTextStyles}) { +function RadioListItem({item, showTooltip, textStyles, alternateTextStyles}) { const styles = useThemeStyles(); return ( - - {item.text} - - - {Boolean(item.alternateText) && ( - {item.alternateText} + {item.text} + + + {Boolean(item.alternateText) && ( + + + {item.alternateText} + + )} ); diff --git a/src/components/SelectionList/UserListItem.js b/src/components/SelectionList/UserListItem.js index 16b64ac6ff1f..ebf30b4219cf 100644 --- a/src/components/SelectionList/UserListItem.js +++ b/src/components/SelectionList/UserListItem.js @@ -3,10 +3,11 @@ import React from 'react'; import {View} from 'react-native'; import SubscriptAvatar from '@components/SubscriptAvatar'; import Text from '@components/Text'; +import Tooltip from '@components/Tooltip'; import useThemeStyles from '@hooks/useThemeStyles'; import {userListItemPropTypes} from './selectionListPropTypes'; -function UserListItem({item, textStyles, alternateTextStyles}) { +function UserListItem({item, textStyles, alternateTextStyles, showTooltip}) { const styles = useThemeStyles(); return ( <> @@ -14,23 +15,33 @@ function UserListItem({item, textStyles, alternateTextStyles}) { )} - - {item.text} - - {Boolean(item.alternateText) && ( - {item.alternateText} + {item.text} + + {Boolean(item.alternateText) && ( + + + {item.alternateText} + + )} {Boolean(item.rightElement) && item.rightElement} diff --git a/src/components/SelectionList/selectionListPropTypes.js b/src/components/SelectionList/selectionListPropTypes.js index 35a9708a3bb1..b2e4d206da20 100644 --- a/src/components/SelectionList/selectionListPropTypes.js +++ b/src/components/SelectionList/selectionListPropTypes.js @@ -16,6 +16,9 @@ const commonListItemPropTypes = { /** Whether this item is disabled */ isDisabled: PropTypes.bool, + /** Whether this item should show Tooltip */ + showTooltip: PropTypes.bool.isRequired, + /** Whether to use the Checkbox (multiple selection) instead of the Checkmark (single selection) */ canSelectMultiple: PropTypes.bool, @@ -187,6 +190,9 @@ const propTypes = { /** Custom content to display in the footer */ footerContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]), + /** Whether to show the toolip text */ + shouldShowTooltip: PropTypes.bool, + /** Whether to use dynamic maxToRenderPerBatch depending on the visible number of elements */ shouldUseDynamicMaxToRenderPerBatch: PropTypes.bool, }; From 4c15f280839dcd73562af5e06f0af5ef3626e763 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 9 Jan 2024 16:05:42 +0700 Subject: [PATCH 3/7] revert change --- src/components/SelectionList/UserListItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SelectionList/UserListItem.js b/src/components/SelectionList/UserListItem.js index ebf30b4219cf..2af4073d6efa 100644 --- a/src/components/SelectionList/UserListItem.js +++ b/src/components/SelectionList/UserListItem.js @@ -15,7 +15,7 @@ function UserListItem({item, textStyles, alternateTextStyles, showTooltip}) { )} From 6f04e1f09b4ed531bf718f5c6c660f3d075486d1 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 9 Jan 2024 16:06:22 +0700 Subject: [PATCH 4/7] revert change --- src/components/SelectionList/UserListItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SelectionList/UserListItem.js b/src/components/SelectionList/UserListItem.js index 2af4073d6efa..39b7e02df3eb 100644 --- a/src/components/SelectionList/UserListItem.js +++ b/src/components/SelectionList/UserListItem.js @@ -15,7 +15,7 @@ function UserListItem({item, textStyles, alternateTextStyles, showTooltip}) { )} From cc4da564f5a6c2601f278fcbb39e689f0eefc68d Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 9 Jan 2024 22:51:26 +0700 Subject: [PATCH 5/7] add shouldShowTooltip prop to time zone selector page --- src/pages/settings/Profile/TimezoneSelectPage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/settings/Profile/TimezoneSelectPage.js b/src/pages/settings/Profile/TimezoneSelectPage.js index 2586be9fb673..4addb63a6c90 100644 --- a/src/pages/settings/Profile/TimezoneSelectPage.js +++ b/src/pages/settings/Profile/TimezoneSelectPage.js @@ -96,6 +96,7 @@ function TimezoneSelectPage(props) { sections={[{data: timezoneOptions, indexOffset: 0, isDisabled: timezone.automatic}]} initiallyFocusedOptionKey={_.get(_.filter(timezoneOptions, (tz) => tz.text === timezone.selected)[0], 'keyForList')} showScrollIndicator + shouldShowTooltip={false} /> ); From c45612b8e4882923644c4d565b7ad98f30bd4e14 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Wed, 10 Jan 2024 21:52:49 +0700 Subject: [PATCH 6/7] remove tooltip of value picker --- src/components/SelectionList/BaseSelectionList.js | 6 +++--- src/components/SelectionList/selectionListPropTypes.js | 2 +- src/components/ValuePicker/ValueSelectorModal.js | 1 + src/pages/settings/Profile/TimezoneSelectPage.js | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/SelectionList/BaseSelectionList.js b/src/components/SelectionList/BaseSelectionList.js index b02ba2add482..d2f45b40df66 100644 --- a/src/components/SelectionList/BaseSelectionList.js +++ b/src/components/SelectionList/BaseSelectionList.js @@ -63,7 +63,7 @@ function BaseSelectionList({ disableKeyboardShortcuts = false, children, shouldStopPropagation = false, - shouldShowTooltip = true, + shouldShowTooltips = true, shouldUseDynamicMaxToRenderPerBatch = false, }) { const theme = useTheme(); @@ -304,7 +304,7 @@ function BaseSelectionList({ const isDisabled = section.isDisabled || item.isDisabled; const isItemFocused = !isDisabled && focusedIndex === normalizedIndex; // We only create tooltips for the first 10 users or so since some reports have hundreds of users, causing performance to degrade. - const showTooltip = normalizedIndex < 10; + const showTooltip = shouldShowTooltips && normalizedIndex < 10; return ( selectRow(item, true)} disableIsFocusStyle={disableInitialFocusOptionStyle} diff --git a/src/components/SelectionList/selectionListPropTypes.js b/src/components/SelectionList/selectionListPropTypes.js index b2e4d206da20..13f6f15287ad 100644 --- a/src/components/SelectionList/selectionListPropTypes.js +++ b/src/components/SelectionList/selectionListPropTypes.js @@ -191,7 +191,7 @@ const propTypes = { footerContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]), /** Whether to show the toolip text */ - shouldShowTooltip: PropTypes.bool, + shouldShowTooltips: PropTypes.bool, /** Whether to use dynamic maxToRenderPerBatch depending on the visible number of elements */ shouldUseDynamicMaxToRenderPerBatch: PropTypes.bool, diff --git a/src/components/ValuePicker/ValueSelectorModal.js b/src/components/ValuePicker/ValueSelectorModal.js index 79608edb3ef4..f4da7c091054 100644 --- a/src/components/ValuePicker/ValueSelectorModal.js +++ b/src/components/ValuePicker/ValueSelectorModal.js @@ -69,6 +69,7 @@ function ValueSelectorModal({items, selectedItem, label, isVisible, onClose, onI onSelectRow={onItemSelected} initiallyFocusedOptionKey={selectedItem.value} shouldStopPropagation + shouldShowTooltips={false} /> diff --git a/src/pages/settings/Profile/TimezoneSelectPage.js b/src/pages/settings/Profile/TimezoneSelectPage.js index 4addb63a6c90..8280d9b5c604 100644 --- a/src/pages/settings/Profile/TimezoneSelectPage.js +++ b/src/pages/settings/Profile/TimezoneSelectPage.js @@ -96,7 +96,7 @@ function TimezoneSelectPage(props) { sections={[{data: timezoneOptions, indexOffset: 0, isDisabled: timezone.automatic}]} initiallyFocusedOptionKey={_.get(_.filter(timezoneOptions, (tz) => tz.text === timezone.selected)[0], 'keyForList')} showScrollIndicator - shouldShowTooltip={false} + shouldShowTooltips={false} /> ); From 34a1db339d700ab0d0b594433c367f6a17714962 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 11 Jan 2024 16:35:20 +0700 Subject: [PATCH 7/7] add shouldShowTooltips for ValuePicker --- src/components/ValuePicker/ValueSelectorModal.js | 8 ++++++-- src/components/ValuePicker/index.js | 7 ++++++- src/pages/workspace/WorkspaceNewRoomPage.js | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/ValuePicker/ValueSelectorModal.js b/src/components/ValuePicker/ValueSelectorModal.js index f4da7c091054..e45ba873d8a3 100644 --- a/src/components/ValuePicker/ValueSelectorModal.js +++ b/src/components/ValuePicker/ValueSelectorModal.js @@ -26,6 +26,9 @@ const propTypes = { /** Function to call when the user closes the modal */ onClose: PropTypes.func, + + /** Whether to show the toolip text */ + shouldShowTooltips: PropTypes.bool, }; const defaultProps = { @@ -34,9 +37,10 @@ const defaultProps = { label: '', onClose: () => {}, onItemSelected: () => {}, + shouldShowTooltips: true, }; -function ValueSelectorModal({items, selectedItem, label, isVisible, onClose, onItemSelected}) { +function ValueSelectorModal({items, selectedItem, label, isVisible, onClose, onItemSelected, shouldShowTooltips}) { const styles = useThemeStyles(); const [sectionsData, setSectionsData] = useState([]); @@ -69,7 +73,7 @@ function ValueSelectorModal({items, selectedItem, label, isVisible, onClose, onI onSelectRow={onItemSelected} initiallyFocusedOptionKey={selectedItem.value} shouldStopPropagation - shouldShowTooltips={false} + shouldShowTooltips={shouldShowTooltips} /> diff --git a/src/components/ValuePicker/index.js b/src/components/ValuePicker/index.js index a21402b9993f..d96333e08241 100644 --- a/src/components/ValuePicker/index.js +++ b/src/components/ValuePicker/index.js @@ -34,6 +34,9 @@ const propTypes = { /** A ref to forward to MenuItemWithTopDescription */ forwardedRef: refPropTypes, + + /** Whether to show the toolip text */ + shouldShowTooltips: PropTypes.bool, }; const defaultProps = { @@ -45,9 +48,10 @@ const defaultProps = { errorText: '', furtherDetails: undefined, onInputChange: () => {}, + shouldShowTooltips: true, }; -function ValuePicker({value, label, items, placeholder, errorText, onInputChange, furtherDetails, forwardedRef}) { +function ValuePicker({value, label, items, placeholder, errorText, onInputChange, furtherDetails, shouldShowTooltips, forwardedRef}) { const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); const [isPickerVisible, setIsPickerVisible] = useState(false); @@ -92,6 +96,7 @@ function ValuePicker({value, label, items, placeholder, errorText, onInputChange items={items} onClose={hidePickerModal} onItemSelected={updateInput} + shouldShowTooltips={shouldShowTooltips} /> ); diff --git a/src/pages/workspace/WorkspaceNewRoomPage.js b/src/pages/workspace/WorkspaceNewRoomPage.js index 21c93b87806a..74f55a58ecd1 100644 --- a/src/pages/workspace/WorkspaceNewRoomPage.js +++ b/src/pages/workspace/WorkspaceNewRoomPage.js @@ -320,6 +320,7 @@ function WorkspaceNewRoomPage(props) { onValueChange={setVisibility} value={visibility} furtherDetails={visibilityDescription} + shouldShowTooltips={false} />