From 1f9f3024245067e678487da3beaa40ad89ba8bf9 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Thu, 25 Apr 2024 17:25:54 +0530 Subject: [PATCH] update share ux --- src/components/MainHeader.jsx | 10 +++++++--- src/components/Pro.jsx | 28 +++++++++++++++++++--------- src/components/Share.jsx | 35 ++++++++++++++++++++++++++--------- src/components/app.jsx | 13 ++++++++++++- src/style.css | 7 +++++++ 5 files changed, 71 insertions(+), 22 deletions(-) diff --git a/src/components/MainHeader.jsx b/src/components/MainHeader.jsx index a7dd976..d6d37f8 100644 --- a/src/components/MainHeader.jsx +++ b/src/components/MainHeader.jsx @@ -74,21 +74,25 @@ export function MainHeader(props) { )} + ) } features={[ 'Unlimited private creations', @@ -84,7 +94,7 @@ export function Pro({ user }) { - Prices are excluding taxes. 30 days refund policy if not satisfied. + 30 days refund policy if not satisfied. diff --git a/src/components/Share.jsx b/src/components/Share.jsx index e0dee2d..b34ac14 100644 --- a/src/components/Share.jsx +++ b/src/components/Share.jsx @@ -10,11 +10,19 @@ import { Text } from './Text'; const FREE_PUBLIC_ITEM_COUNT = 1; const BASE_URL = location.origin; -const TOGGLE_VISIBILITY_API = !window.location.origin.includes('localhost') +const TOGGLE_VISIBILITY_API = + /*!window.location.origin.includes('localhost') ? 'http://127.0.0.1:5001/web-maker-app/us-central1/toggleVisibility' - : 'https://togglevisibility-ajhkrtmkaq-uc.a.run.app'; -export function Share({ user, item, onVisibilityChange, onLoginBtnClick }) { - const [publicItemCount, setPublicItemCount] = useState(0); + : */ 'https://togglevisibility-ajhkrtmkaq-uc.a.run.app'; + +export function Share({ + user, + item, + onVisibilityChange, + onLoginBtnClick, + onProBtnClick +}) { + const [publicItemCount, setPublicItemCount] = useState(); useEffect(() => { if (!user) return; window.db.getPublicItemCount(user.uid).then(c => { @@ -35,10 +43,10 @@ export function Share({ user, item, onVisibilityChange, onLoginBtnClick }) { `${TOGGLE_VISIBILITY_API}?token=${token}&itemId=${item.id}` ); } catch (e) { - alertsService.add('Could not change visibility'); + alertsService.add('Could not set visiblity to public'); setTimeout(() => { setVal(!newVal); - }, 1000); + }, 400); return; } @@ -48,6 +56,9 @@ export function Share({ user, item, onVisibilityChange, onLoginBtnClick }) { alertsService.add('Visiblity set to public'); } else { alertsService.add('Could not set visiblity to public'); + setTimeout(() => { + setVal(!newVal); + }, 400); } } else { itemService.setItem(item.id, { isPublic: false }); @@ -103,11 +114,17 @@ export function Share({ user, item, onVisibilityChange, onLoginBtnClick }) { {!user?.isPro ? (

- You have {Math.max(0, FREE_PUBLIC_ITEM_COUNT - publicItemCount)}/ - {FREE_PUBLIC_ITEM_COUNT} public creations left. + Public creations available: {FREE_PUBLIC_ITEM_COUNT}. Used:{' '} + {publicItemCount === undefined ? '-' : publicItemCount}. Left:{' '} + {Math.max(0, FREE_PUBLIC_ITEM_COUNT - publicItemCount)}

- For unlimited public creations, upgrade to + + For unlimited public creations, + +

) : null} diff --git a/src/components/app.jsx b/src/components/app.jsx index 4b6f792..dd37f83 100644 --- a/src/components/app.jsx +++ b/src/components/app.jsx @@ -1088,6 +1088,7 @@ export default class App extends Component { trackEvent('fn', 'loggedOut'); auth.logout(); this.setState({ isProfileModalOpen: false }); + this.createNewItem(); alertsService.add('Log out successfull'); } @@ -1859,6 +1860,10 @@ export default class App extends Component { this.closeAllOverlays(); this.loginBtnClickHandler(); }} + onProBtnClick={() => { + this.closeAllOverlays(); + this.proBtnClickHandler(); + }} /> this.setState({ isProModalOpen: false })} extraClasses="pro-modal" > - + { + this.closeAllOverlays(); + this.loginBtnClickHandler(); + }} + /> {/* Login modal is intentionally kept here after assets & share modal because diff --git a/src/style.css b/src/style.css index 75dd409..54f913c 100644 --- a/src/style.css +++ b/src/style.css @@ -444,6 +444,13 @@ a > svg { align-items: center; } +.btn--small { + padding: 0.2rem 0.5rem; + text-transform: uppercase; + /* border-radius: 3px; */ + font-size: 0.8rem; +} + .btn:hover { --black-mix: 90%; text-decoration: none;