From 75ed38d9e2da83231dbb849d5595207121c21a22 Mon Sep 17 00:00:00 2001 From: Aminejv Date: Tue, 16 Nov 2021 18:11:56 +0100 Subject: [PATCH] feat(Onboarding/Tags): update privacy popup --- components/core/Onboarding/Popup.js | 2 + components/core/Onboarding/Tags.js | 100 ++++++++++++++++------------ 2 files changed, 61 insertions(+), 41 deletions(-) diff --git a/components/core/Onboarding/Popup.js b/components/core/Onboarding/Popup.js index 0a557c97..73158335 100644 --- a/components/core/Onboarding/Popup.js +++ b/components/core/Onboarding/Popup.js @@ -1,11 +1,13 @@ import * as React from "react"; import * as System from "~/components/system"; +import * as Styles from "~/common/styles"; import { motion } from "framer-motion"; import { css } from "@emotion/react"; import { ModalPortal } from "../ModalPortal"; const STYLES_ONBOARDING_POPUP = (theme) => css` + ${Styles.VERTICAL_CONTAINER}; position: fixed; left: 24px; bottom: 28px; diff --git a/components/core/Onboarding/Tags.js b/components/core/Onboarding/Tags.js index b5bc91f3..3944264a 100644 --- a/components/core/Onboarding/Tags.js +++ b/components/core/Onboarding/Tags.js @@ -1,9 +1,11 @@ import * as React from "react"; import * as System from "~/components/system"; import * as Actions from "~/common/actions"; +import * as SVG from "~/common/svg"; import { ModalPortal } from "~/components/core/ModalPortal"; import { useIsomorphicLayoutEffect } from "~/common/hooks"; +import { css } from "@emotion/react"; import OnboardingPopup from "~/components/core/Onboarding/Popup"; @@ -15,14 +17,14 @@ const TagsOnboardingContext = React.createContext(); export const useTagsOnboardingContext = () => React.useContext(TagsOnboardingContext); const steps = { - tagsTrigger: "tagsTrigger", - tagsJumper: "tagsJumper", + trigger: "trigger", + jumper: "jumper", finish: "finish", }; function Provider({ children, onAction, viewer, ...props }) { const [currentStep, setCurrentStep] = React.useState( - viewer?.onboarding?.tags ? steps.finish : steps.tagsTrigger + viewer?.onboarding?.tags ? steps.finish : steps.trigger ); useIsomorphicLayoutEffect(() => { @@ -42,7 +44,7 @@ function Provider({ children, onAction, viewer, ...props }) { goToNextStep() { if (currentStep === steps.finish) return; - const nextStep = { tagsTrigger: "tagsJumper", tagsJumper: "finish" }; + const nextStep = { trigger: "jumper", jumper: "finish" }; setCurrentStep((prev) => nextStep[prev]); }, }), @@ -60,6 +62,17 @@ function Provider({ children, onAction, viewer, ...props }) { * TagsWalkthrought * -----------------------------------------------------------------------------------------------*/ +const STYLES_TAGS_BUTTON = (theme) => css` + display: inline-flex; + justify-content: center; + align-items: center; + background-color: ${theme.semantic.bgGrayLight4}; + border-radius: 8px; + padding: 2px; + position: relative; + top: 3px; +`; + function TagsWalkthrought() { const [isOrganizeTagsPopupVisible, setOrganizeTagsPopupVisiblity] = React.useState(true); const hideOrganizeTagsPopup = () => setOrganizeTagsPopupVisiblity(false); @@ -69,45 +82,50 @@ function TagsWalkthrought() { const { currentStep, steps } = useTagsOnboardingContext(); - if (currentStep === steps.tagsTrigger) - return isOrganizeTagsPopupVisible ? ( - - - - Hover over the object and click on “#” button to apply tags to it. - - - Got it - - - - ) : null; - - if (currentStep === steps.tagsJumper) { + if ( + (currentStep === steps.trigger && isOrganizeTagsPopupVisible) || + (currentStep === steps.jumper && isTagsPrivacyPopupVisible) + ) { return ( - {isTagsPrivacyPopupVisible ? ( - - - All your objects are link-access only by default. If you apply public tags on them, - they will show up on your profile. - - - Got it - - - ) : null} + + {currentStep === steps.trigger ? ( + <> + + Hover over the object, then select + + + + to apply tags to it. + + + Got it + + + ) : null} + {currentStep === steps.jumper ? ( + <> + + All your objects are link-access only by default. If you apply public tags on them, + they will show up on your profile. + + + Got it + + + ) : null} + ); }