import * as React from "react"; import * as Constants from "~/common/constants"; import * as Actions from "~/common/actions"; import { css } from "@emotion/core"; import { ButtonPrimary } from "~/components/system/components/Buttons"; import { dispatchCustomEvent } from "~/common/custom-events"; const STYLES_MODAL = css` text-align: center; padding-bottom: 64px; box-sizing: border-box; max-width: 680px; width: 95vw; min-height: 630px; border-radius: 4px; background-color: ${Constants.system.white}; overflow: hidden; box-shadow: 0 0 60px 8px rgba(0, 0, 0, 0.03); `; const STYLES_BUTTON_SECONDARY = { backgroundColor: Constants.system.white, boxShadow: `0 0 0 1px ${Constants.system.brand} inset`, color: Constants.system.brand, marginRight: 16, width: 160, textDecoration: `none`, }; const STYLES_IMAGE = css` width: 100%; background-color: ${Constants.system.black}; `; const STYLES_TITLE = css` font-family: ${Constants.font.semiBold}; font-size: 32px; padding-top: 40px; margin-bottom: 16px; `; const STYLES_TEXT = css` font-family: ${Constants.font.text}; font-size: 18px; margin-bottom: 24px; padding: 0 64px; `; const STYLES_LINK = css` text-decoration: none; color: ${Constants.system.white}; :visited { color: ${Constants.system.white}; } `; export const announcements = ["New On Slate: Grid System 2.0"]; export class OnboardingModal extends React.Component { state = { step: 0, slides: [], }; componentDidMount = () => { Actions.updateOnboardingStatus({ onboarding: this.props.unseenAnnouncements }); let slides = []; if (this.props.newAccount) { slides = this.onboardingCopy; } for (let feature of this.announcements) { if (this.props.unseenAnnouncements.includes(feature.title)) { slides.push(feature); } } if (!slides.length) { dispatchCustomEvent({ name: "delete-modal", detail: {}, }); } this.setState({ slides }); }; announcements = [ { title: "New On Slate: Grid System 2.0", text: "We just introduced a completely new layout engine that gives you total control over the way you can organize and display your slates.", image: ( grid layout ), button: ( this._handleClick(1)}> Try it out ), }, ]; onboardingCopy = [ { title: "Welcome to Slate", text: "Slate is distributed file-sharing network designed for private and public storage. Drag and drop your files into the app to easily start uploading your books, images, and documents.", image: ( ), button: ( this._handleClick(1)}> Got it ), }, { title: "Upload from Anywhere", text: "Use the Slate Chrome extension to upload images and screenshots to your account from anywhere on the web.", image: ( ), button: ( Get extension this._handleClick(1)}> Next ), }, { title: "Organize and share", text: "Organize your files into slates to organize research, create mood boards, and collect your thoughts to share with other people.", image: ( ), button: ( this._handleClick(1)}> Start using Slate ), }, ]; _handleClick = (i) => { if (this.state.step + i >= this.state.slides.length) { dispatchCustomEvent({ name: "delete-modal", detail: {}, }); } else { this.setState({ step: this.state.step + i }); } }; render() { if (!this.state.slides || !this.state.slides.length) { return null; } return (
{this.state.slides[this.state.step].image}
{this.state.slides[this.state.step].title}
{this.state.slides[this.state.step].text}
{this.state.slides[this.state.step].button}
); } }