import { PageProps, Link, graphql } from 'gatsby' import React, { useState } from 'react' import Layout from '../components/layout' import Seo from '../components/seo' import { Section } from '../components/shared' import { SectionHeading, SectionDesc, SolidButton } from '../components/shared/styledComponents' import { StyledHeading, StyledLabel, ContactBackground } from '../styledComponents/contact' import contactBg from '../images/contact_bg.jpg' import '../styledComponents/contact.css' import { NostrController } from '../controllers' type DataProps = { site: { meta: { title: string description: string social: { linkedin: string } } } } const Contact: React.FC> = ({ data, location }) => { const nostrController = NostrController.getInstance() const [name, setName] = useState() const [email, setEmail] = useState() const [emailError, setEmailError] = useState(false) const [subject, setSubject] = useState() const [message, setMessage] = useState() const [notification, setNotification] = useState() const handleEmailChange = (e: React.ChangeEvent) => { const value = e.target.value setEmail(value) if ( value && (value.toLowerCase().includes('@gmail.com') || value.toLowerCase().includes('@googlemail.com')) ) { setEmailError(true) setNotification('Gmail addresses are not allowed.') } else { setEmailError(false) setNotification(undefined) } } const getBorderStyle = (value: string | undefined) => value === undefined ? {} : value ? {} : { border: '1px solid red' } return (
Schedule a Call Feel free to contact us at any time to book a demo and start your Data Controller journey. Our team will respond within 24 hours and help you proceed with the registration process. Contact Us
{ evt.preventDefault() // Prevent sending if emailError is set if (emailError) { return } if (name && email && subject && message) { const res = await nostrController .sendDM( 'npub1dc0000002dtkw7et06sztc9nvk79r6yju8gk69sr88rgrg0e8cvsnptgyv', `Name: ${name} Email: ${email} Subject: ${subject} Message: ${message}` ) .catch((err) => { setNotification( `Something went wrong. Please check the console for more information. Please try one more time.` ) console.log(`Sending message error: `, err) }) if (res && res.length) { setNotification(`Message sent. We'll contact you shortly.`) } else { setNotification( `Something went wrong. Please try one more time.` ) } } }} >
Name { setName(evt.target.value) setNotification(undefined) }} style={getBorderStyle(name)} />
Email address
We'll never share your email with anyone else.
Subject { setSubject(evt.target.value) setNotification(undefined) }} style={getBorderStyle(subject)} />
Message
Submit
{notification && {notification}}
) } export default Contact