π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
chore(PeopleSortOptions):added-comments
Aswin Asok22bbcda80a4b
diff --git a/web/packages/new/photos/components/PeopleSortOptions.tsx b/web/packages/new/photos/components/PeopleSortOptions.tsxindex d9641ebdcd..166e734c93 100644--- a/web/packages/new/photos/components/PeopleSortOptions.tsx+++ b/web/packages/new/photos/components/PeopleSortOptions.tsx@@ -46,13 +46,20 @@ export const PeopleSortOptions: React.FC<PeopleSortOptionsProps> = ({nestedInDialog,transparentTriggerButtonBackground,}) => {+ // Tracks the button element the menu is anchored to; its presence also+ // determines whether the menu is open.const [anchorEl, setAnchorEl] = useState<MenuProps["anchorEl"]>();++ // Holds the next sort choice until the menu close transition completes.const pendingSortByRef = useRef<PeopleSortBy | undefined>(undefined);const ariaID = "people-sort";+ // Split the current sort into its category and direction for simpler menu logic.const activeCategory = getPeopleSortCategory(activeSortBy);const activeAscending = isPeopleSortAscending(activeSortBy);+ // Re-selecting the active category flips its direction; choosing a new+ // category applies that category's default direction.const handleCategoryClick = (category: PeopleSortCategory) => {let nextSortBy: PeopleSortBy;if (category === activeCategory) {@@ -64,6 +71,8 @@ export const PeopleSortOptions: React.FC<PeopleSortOptionsProps> = ({setAnchorEl(undefined);};+ // Optionally remove the trigger button background when this control is+ // rendered inside layouts that already provide their own styling.const triggerButtonSxProps: IconButtonProps["sx"] = [transparentTriggerButtonBackground? {}@@ -147,6 +156,8 @@ const PeopleSortCategoryOption: React.FC<PeopleSortCategoryOptionProps> = ({label,directionLabel,}) => {+ // The selected option has a differnt color and arrow directions+ // and the below variables are for facilitating that.const isSelected = category === activeCategory;const arrowIcon = activeAscending ? ArrowUp02Icon : ArrowDown02Icon;