// @flow import * as MODALS from 'constants/modal_types'; import * as ICONS from 'constants/icons'; import React from 'react'; import classnames from 'classnames'; import Button from 'component/button'; import usePersistedState from 'effects/use-persisted-state'; type Props = { uri: string, doOpenModal: (string, {}) => void, fileAction?: boolean, disableSupport: boolean, user: ?User, }; export default function ClaimSupportButton(props: Props) { const { doOpenModal, uri, fileAction, disableSupport, user } = props; const [showNudge, setShowNudge] = React.useState(false); const [nudgeAcknowledged, setNudgeAcknowledged] = usePersistedState('nudge:support-acknowledge', false); const emailVerified = user && user.has_verified_email; React.useEffect(() => { if (!emailVerified && !nudgeAcknowledged && fileAction) { setShowNudge(true); } }, [emailVerified, nudgeAcknowledged, fileAction]); if (disableSupport) { return null; } return ( <>