diff --git a/backend/src/index.js b/backend/src/index.js index 2e6e9b4..1c16b92 100644 --- a/backend/src/index.js +++ b/backend/src/index.js @@ -117,7 +117,7 @@ app.use('/api/media_assets', passport.authenticate('jwt', {session: false}), med app.use('/api/section_media_links', passport.authenticate('jwt', {session: false}), section_media_linksRoutes); -app.use('/api/contact_submissions', passport.authenticate('jwt', {session: false}), contact_submissionsRoutes); +app.use('/api/contact_submissions', contact_submissionsRoutes); app.use('/api/career_postings', passport.authenticate('jwt', {session: false}), career_postingsRoutes); diff --git a/frontend/src/pages/index.tsx b/frontend/src/pages/index.tsx index 3db9935..4fa4556 100644 --- a/frontend/src/pages/index.tsx +++ b/frontend/src/pages/index.tsx @@ -1,166 +1,157 @@ - -import React, { useEffect, useState } from 'react'; +import React, { useState, useEffect } from 'react'; import type { ReactElement } from 'react'; import Head from 'next/head'; import Link from 'next/link'; -import BaseButton from '../components/BaseButton'; -import CardBox from '../components/CardBox'; -import SectionFullScreen from '../components/SectionFullScreen'; +import axios from 'axios'; import LayoutGuest from '../layouts/Guest'; -import BaseDivider from '../components/BaseDivider'; -import BaseButtons from '../components/BaseButtons'; import { getPageTitle } from '../config'; -import { useAppSelector } from '../stores/hooks'; -import CardBoxComponentTitle from "../components/CardBoxComponentTitle"; -import { getPexelsImage, getPexelsVideo } from '../helpers/pexels'; +const JocketLanding = () => { + const [formData, setFormData] = useState({ visitor_name: '', visitor_email: '', message: '' }); + const [isSubmitting, setIsSubmitting] = useState(false); + const [submitted, setSubmitted] = useState(false); + const [showForm, setShowForm] = useState(false); -export default function Starter() { - const [illustrationImage, setIllustrationImage] = useState({ - src: undefined, - photographer: undefined, - photographer_url: undefined, - }) - const [illustrationVideo, setIllustrationVideo] = useState({video_files: []}) - const [contentType, setContentType] = useState('image'); - const [contentPosition, setContentPosition] = useState('background'); - const textColor = useAppSelector((state) => state.style.linkColor); - - const title = 'Jocket Stealth Site' - - // Fetch Pexels image/video - useEffect(() => { - async function fetchData() { - const image = await getPexelsImage(); - const video = await getPexelsVideo(); - setIllustrationImage(image); - setIllustrationVideo(video); - } - fetchData(); - }, []); - - const imageBlock = (image) => ( -
-
- - Photo by {image?.photographer} on Pexels - -
-
- ); - - const videoBlock = (video) => { - if (video?.video_files?.length > 0) { - return ( -
- -
- - Video by {video.user.name} on Pexels - -
-
) - } - }; + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + setIsSubmitting(true); + try { + await axios.post('/contact_submissions', { data: { ...formData, source: 'Stealth Landing' } }); + setSubmitted(true); + } catch (err) { + console.error('Submission failed', err); + } finally { + setIsSubmitting(false); + } + }; return ( -
+
- {getPageTitle('Starter Page')} + {getPageTitle('JOCKET')} - -
- {contentType === 'image' && contentPosition !== 'background' - ? imageBlock(illustrationImage) - : null} - {contentType === 'video' && contentPosition !== 'background' - ? videoBlock(illustrationVideo) - : null} -
- - - -
-

This is a React.js/Node.js app generated by the Flatlogic Web App Generator

-

For guides and documentation please check - your local README.md and the Flatlogic documentation

-
- - - + + {Array.from({ length: 24 }).map((_, i) => ( + + ))} + + + +
+ + {/* Main Content */} +
+

+ JOCKET +

+

+ Propulsion Systems +

+ + {!showForm ? ( + + ) : ( +
+ {submitted ? ( +

+ Awaiting clearance. +

+ ) : ( +
+ setFormData({ ...formData, visitor_name: e.target.value })} /> + setFormData({ ...formData, visitor_email: e.target.value })} + /> +