diff --git a/package.json b/package.json index 1c2787a..7985a03 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "react-dom": "16.13.1", "react-firebaseui": "^4.1.0", "react-github-corner": "^2.5.0", + "react-joyride": "^2.3.0", "react-redux": "^7.2.2", "redux": "^4.0.5", "redux-devtools-extension": "^2.13.8", @@ -92,4 +93,4 @@ "ts-jest": "^26.4.4", "typescript": "^4.1.3" } -} \ No newline at end of file +} diff --git a/pages/poll/create.tsx b/pages/poll/create.tsx index 9164fa6..d47abfa 100644 --- a/pages/poll/create.tsx +++ b/pages/poll/create.tsx @@ -12,8 +12,9 @@ import { OverlayTrigger, Tooltip, } from "react-bootstrap"; -import { InfoCircleFill } from "react-bootstrap-icons"; +import { InfoCircleFill, QuestionCircleFill } from "react-bootstrap-icons"; import { useState } from "react"; +import Joyride, { CallBackProps, STATUS, Step } from "react-joyride"; import Layout from "../../src/components/Layout"; import ResponseMessage from "../../src/components/ResponseMessage"; import { encrypt } from "../../src/helpers/helpers"; @@ -45,6 +46,43 @@ const Create = (): JSX.Element => { msg: "", }); + const [tourRun, setTourRun] = useState(false); + + // Run automatically for first time users + if (typeof window !== "undefined") { + if (localStorage.visited !== "true") { + localStorage.setItem("visited", "true"); + setTourRun(true); + } + } + + const tourSteps: Step[] = [ + { + disableBeacon: true, + target: "#formPlainTextTitle", + content: "Give your event the memorable title it deserves.", + }, + { + target: "#formPlainTextDescription", + content: + "Add a description to let your invitees know what this is all about.", + }, + { + target: ".rat-AvailableTimes_buttons", + content: + "Are you an early planner? Use these button to schedule in the future. (ps: Time travel powers not included)", + }, + { + target: ".rat-Slider_component", + content: + "Click and drag to create a time slot. You can create more than one. These will be the choices that are generated in the poll", + }, + { + target: ".create-poll-btn", + content: "Click here when you're all done to get a sharable link", + }, + ]; + const handleTitleChange = (e: React.ChangeEvent): void => { const { value } = e.target; setTitle(value); @@ -136,8 +174,37 @@ const Create = (): JSX.Element => { } }; + const handleStartTour = (): void => { + setTourRun(true); + }; + + const handleJoyrideCallback = (data: CallBackProps): void => { + const { status, type } = data; + const finishedStatuses: string[] = [STATUS.FINISHED, STATUS.SKIPPED]; + + if (finishedStatuses.includes(status) || type === "beacon") { + setTourRun(false); + } + }; + return ( +
@@ -174,6 +241,10 @@ const Create = (): JSX.Element => { > +
@@ -191,17 +262,17 @@ const Create = (): JSX.Element => { {!disabled ? ( `Create Poll` ) : ( - <> -