diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsx index 28e9bd656b..92fbd85a25 100644 --- a/web/apps/photos/src/components/Collections/CollectionShare.tsx +++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx @@ -718,11 +718,12 @@ const ManageEmailShare: React.FC = ({ const { showLoadingBar, hideLoadingBar } = usePhotosAppContext(); const galleryContext = useContext(GalleryContext); - const [addParticipantView, setAddParticipantView] = useState(false); - const [manageParticipantView, setManageParticipantView] = useState(false); - - const closeAddParticipant = () => setAddParticipantView(false); - const openAddParticipant = () => setAddParticipantView(true); + const { show: showAddParticipant, props: addParticipantVisibilityProps } = + useModalVisibility(); + const { + show: showManageParticipant, + props: manageParticipantVisibilityProps, + } = useModalVisibility(); const participantType = useRef<"COLLABORATOR" | "VIEWER">(null); @@ -730,12 +731,12 @@ const ManageEmailShare: React.FC = ({ const openAddCollab = () => { participantType.current = "COLLABORATOR"; - openAddParticipant(); + showAddParticipant(); }; const openAddViewer = () => { participantType.current = "VIEWER"; - openAddParticipant(); + showAddParticipant(); }; const handleRootClose = () => { @@ -773,11 +774,7 @@ const ManageEmailShare: React.FC = ({ selectedParticipant.current = collection.sharees.find( (sharee) => sharee.email === email, ); - setManageParticipantView(true); - }; - - const closeManageParticipant = () => { - setManageParticipantView(false); + showManageParticipant(); }; return ( @@ -864,21 +861,19 @@ const ManageEmailShare: React.FC = ({ - + ); };