diff --git a/src/components/Collections/CollectionShare/publicShare/manage/deviceLimit.tsx b/src/components/Collections/CollectionShare/publicShare/manage/deviceLimit.tsx index 9ac1032e8..7a6889cc6 100644 --- a/src/components/Collections/CollectionShare/publicShare/manage/deviceLimit.tsx +++ b/src/components/Collections/CollectionShare/publicShare/manage/deviceLimit.tsx @@ -25,48 +25,46 @@ export function ManageDeviceLimit({ deviceLimit: newLimit, }); }; - const [shareDeviceLimitModalView, setDeviceLimitModalView] = - useState(false); - const [shareDeviceLimitValue, setDeviceLimitValue] = useState( - publicShareProp.deviceLimit - ); - useEffect(() => { - if (shareDeviceLimitModalView) { - setDeviceLimitModalView(true); - } else setDeviceLimitModalView(false); - }, [shareDeviceLimitModalView]); + const [changeDeviceLimitView, setChangeDeviceLimitView] = useState(false); const closeShareExpiryOptionsModalView = () => - setDeviceLimitModalView(false); - const openShareExpiryOptionsModalView = () => setDeviceLimitModalView(true); - const changeshareExpiryValue = (value: number) => () => { + setChangeDeviceLimitView(false); + const openShareExpiryOptionsModalView = () => + setChangeDeviceLimitView(true); + const changeDeviceLimitValue = (value: number) => () => { updateDeviceLimit(value); - setDeviceLimitValue(value); - setDeviceLimitModalView(false); + publicShareProp.deviceLimit = value; + setChangeDeviceLimitView(false); }; + + useEffect(() => { + if (changeDeviceLimitView) { + setChangeDeviceLimitView(true); + } else setChangeDeviceLimitView(false); + }, [changeDeviceLimitView]); + return ( <> } - subText={String(shareDeviceLimitValue)}> + subText={String(publicShareProp.deviceLimit)}> {t('LINK_DEVICE_LIMIT')} {t('LINK_EXPIRY')} - {/* */} {getDeviceLimitOptions().map((item) => ( {item.label} diff --git a/src/components/Collections/CollectionShare/publicShare/manage/linkExpiry.tsx b/src/components/Collections/CollectionShare/publicShare/manage/linkExpiry.tsx index 3e0d09106..1c17a0ff7 100644 --- a/src/components/Collections/CollectionShare/publicShare/manage/linkExpiry.tsx +++ b/src/components/Collections/CollectionShare/publicShare/manage/linkExpiry.tsx @@ -27,24 +27,25 @@ export function ManageLinkExpiry({ validTill: optionFn, }); }; + const [shareExpiryOptionsModalView, setShareExpiryOptionsModalView] = useState(false); + const [shareExpiryValue, setShareExpiryValue] = useState(0); + const [labelText, setLabelText] = useState( publicShareProp?.validTill ? formatDateTime(publicShareProp?.validTill / 1000) : 'never' ); - useEffect(() => { - if (shareExpiryOptionsModalView) { - setShareExpiryOptionsModalView(true); - } else setShareExpiryOptionsModalView(false); - }, [shareExpiryOptionsModalView]); + const closeShareExpiryOptionsModalView = () => setShareExpiryOptionsModalView(false); + const openShareExpiryOptionsModalView = () => setShareExpiryOptionsModalView(true); - const changeshareExpiryValue = (value: number) => () => { + + const changeShareExpiryValue = (value: number) => () => { updateDeviceExpiry(value); setLabelText( publicShareProp?.validTill @@ -55,6 +56,13 @@ export function ManageLinkExpiry({ shareExpiryValue; setShareExpiryOptionsModalView(false); }; + + useEffect(() => { + if (shareExpiryOptionsModalView) { + setShareExpiryOptionsModalView(true); + } else setShareExpiryOptionsModalView(false); + }, [shareExpiryOptionsModalView]); + return ( <> - {/* */} {shareExpiryOptions().map((item) => ( {item.label} diff --git a/src/components/Menu/menuItem.tsx b/src/components/Menu/menuItem.tsx index d7cd38dc5..bad403783 100644 --- a/src/components/Menu/menuItem.tsx +++ b/src/components/Menu/menuItem.tsx @@ -32,19 +32,11 @@ export function EnteMenuItem({ checked, }: Iprops) { const menuContext = useContext(OverflowMenuContext); - // const [buttonState, setButtonState] = useState< - // 'Default' | 'Loading' | 'Success' - // >('Default'); const handleClick = () => { - // setButtonState('Loading'); onClick(); if (!keepOpenAfterClick) { menuContext.close(); } - // setButtonState('Success'); - // setTimeout(() => { - // setButtonState('Default'); - // }, 2000); }; return ( {endIcon}