diff --git a/src/components/Share.jsx b/src/components/Share.jsx index 31054de..c441d6a 100644 --- a/src/components/Share.jsx +++ b/src/components/Share.jsx @@ -11,7 +11,7 @@ import { Text } from './Text'; const FREE_PUBLIC_ITEM_COUNT = 1; const BASE_URL = location.origin; -export function Share({ user, item, onVisibilityChange }) { +export function Share({ user, item, onVisibilityChange, onLoginBtnClick }) { const [publicItemCount, setPublicItemCount] = useState(0); useEffect(() => { if (!user) return; @@ -62,8 +62,8 @@ export function Share({ user, item, onVisibilityChange }) { if (!user) { return ( - Login to share this creation - diff --git a/src/components/app.jsx b/src/components/app.jsx index b017363..d86d9a1 100644 --- a/src/components/app.jsx +++ b/src/components/app.jsx @@ -1126,7 +1126,11 @@ export default class App extends Component { } shareBtnClickHandler() { trackEvent('ui', 'shareBtnClick'); - this.setState({ isShareModalOpen: true }); + if (!window.user || this.state.currentItem.id) { + this.setState({ isShareModalOpen: true }); + } else { + alertsService.add('Please save your creation before sharing.'); + } } detachedPreviewBtnHandler() { trackEvent('ui', 'detachPreviewBtnClick'); @@ -1783,21 +1787,7 @@ export default class App extends Component { onChange={this.onExternalLibChange.bind(this)} /> - this.setState({ isAssetsOpen: false })} - > - { - this.proBtnClickHandler(); - this.setState({ isAssetsOpen: false }); - }} - onLoginBtnClick={() => { - this.loginBtnClickHandler(); - this.setState({ isAssetsOpen: false }); - }} - /> - + @@ -1818,13 +1808,7 @@ export default class App extends Component { onChange={this.updateSetting.bind(this)} /> - this.setState({ isLoginModalOpen: false })} - > - - + this.setState({ isProfileModalOpen: false })} @@ -1834,6 +1818,21 @@ export default class App extends Component { logoutBtnHandler={this.logout.bind(this)} /> + this.setState({ isAssetsOpen: false })} + > + { + this.setState({ isAssetsOpen: false }); + this.proBtnClickHandler(); + }} + onLoginBtnClick={() => { + this.setState({ isAssetsOpen: false }); + this.loginBtnClickHandler(); + }} + /> + this.setState({ isShareModalOpen: false })} @@ -1848,6 +1847,10 @@ export default class App extends Component { }; this.setState({ currentItem: item }); }} + onLoginBtnClick={() => { + this.setState({ isShareModalOpen: false }); + this.loginBtnClickHandler(); + }} /> + + {/* Login modal is intentionally kept here after assets & share modal because + they trigger this modal and if order isn't maintainer, the modal overlay doesn't + show properly */} + this.setState({ isLoginModalOpen: false })} + > + + + this.setState({ isHelpModalOpen: false })}