import * as React from "react"; import * as Strings from "~/common/strings"; import * as Constants from "~/common/constants"; import * as System from "~/components/system"; import * as Actions from "~/common/actions"; import * as Events from "~/common/custom-events"; import { css } from "@emotion/react"; const STYLES_HEADER = css` font-family: ${Constants.font.semiBold}; `; const STYLES_GROUPING = css` width: 100%; border: 1px solid rgba(196, 196, 196, 0.5); background-color: ${Constants.system.white}; border-radius: 6px; padding: 16px; margin-bottom: 24px; `; const STYLES_TEXT = css` color: ${Constants.semantic.textGray}; font-size: ${Constants.typescale.lvl0}; `; export default class SidebarHelp extends React.Component { state = { name: this.props.viewer?.name || "", email: "", twitter: "", message: "", }; _handleSubmit = async () => { if (Strings.isEmpty(this.state.email)) { Events.dispatchMessage({ message: "Please provide an email address where we can reach you" }); return; } if (!this.state.message || !this.state.message.length) { Events.dispatchMessage({ message: "Please provide a message" }); return; } this.props.onCancel(); Events.dispatchMessage({ message: "Message sent. You'll hear from us shortly", status: "INFO", }); const response = await Actions.createSupportMessage({ username: this.props.viewer?.username || "", name: this.state.name, email: this.state.email, twitter: this.state.twitter, message: this.state.message, stored: Strings.bytesToSize(this.props.viewer?.stats.bytes || 0), }); Events.hasError(response); }; _handleChange = (e) => { this.setState({ [e.target.name]: e.target.value }); }; render() { return (
Talk to us
this.props.onAction({ type: "SIDEBAR", value: "SIDEBAR_FAQ" })} > Check out our FAQ here!
Your Info Let us know how we can reach you!
Message
Send message
); } }