From c74fad179379260dcf46edeae22c1f04ee842508 Mon Sep 17 00:00:00 2001 From: Ashelyn Rose Date: Sat, 2 Dec 2023 16:29:03 -0700 Subject: Manual static image optimization --- app/about/page.tsx | 8 ++-- app/contact/page.tsx | 76 +----------------------------- components/ContactForm.tsx | 69 +++++++++++++++++++++++++++ components/Image/index.tsx | 108 +++++++++++++++++++++++++++++++++++++++++++ components/InfoBar/index.tsx | 8 ++-- components/layout/Header.tsx | 8 ++-- config/system.json | 12 +++-- next-env.d.ts | 1 - next.config.js | 5 +- package-lock.json | 8 ++-- package.json | 2 +- styles/layout.css | 5 +- utils/profiles.ts | 8 ---- 13 files changed, 210 insertions(+), 108 deletions(-) create mode 100644 components/ContactForm.tsx create mode 100644 components/Image/index.tsx delete mode 100644 utils/profiles.ts diff --git a/app/about/page.tsx b/app/about/page.tsx index 863bea9..255f403 100644 --- a/app/about/page.tsx +++ b/app/about/page.tsx @@ -1,8 +1,7 @@ -import Image from 'next/image' +import Image from 'components/Image' import system from '~/config/system.json' import styles from '~/styles/about.module.css' -import profilePics from '~/utils/profiles' export interface Member { name: string, @@ -11,6 +10,7 @@ export interface Member { color: string, bioShort: string, readMore: string, + profileImg: string, } export default function About() { @@ -32,7 +32,7 @@ export default function About() { alt="" width={150} height={150} - src={profilePics[member.name.toLowerCase()]} + src={member.profileImg} />

{member.name}

{member.mainPronouns}

@@ -61,7 +61,7 @@ export default function About() { alt="" width={80} height={80} - src={profilePics[member.name.toLowerCase()]} + src={member.profileImg} />

{member.name}

{member.mainPronouns}

diff --git a/app/contact/page.tsx b/app/contact/page.tsx index 1c144c2..6af8ad1 100644 --- a/app/contact/page.tsx +++ b/app/contact/page.tsx @@ -1,56 +1,7 @@ -'use client' -import { useState, useRef, FormEvent } from 'react' import InfoBar from "~/components/InfoBar/" - -import styles from '~/styles/form.module.css' - -const submitUrl = 'https://contact.tempest.dev/api/contact/me' +import ContactForm from "~/components/ContactForm" export default function Contact() { - const [submitting, setSubmitting] = useState(false) - const [status, setStatus] = useState('') - - const nameRef = useRef() - const emailRef = useRef() - const messageRef = useRef() - - const submit = async (ev: FormEvent) => { - ev.preventDefault() - - setStatus('') - - const name = nameRef.current.value - const email = emailRef.current.value - const message = messageRef.current.value - - if (!name) setStatus(s => s + ' Name required.') - if (!email) setStatus(s => s + ' Email required.') - if (!message) setStatus(s => s + ' Message required.') - - if (!name || !email || !message) - return - - setSubmitting(true) - - try { - - await fetch(submitUrl, { - method: 'post', - headers: { - 'content-type': 'application/json' - }, - body: JSON.stringify({ - name, email, message - }) - }) - - setStatus('Message sent successfully') - } catch { - setStatus('Error submitting message, please try again') - } finally { - setSubmitting(false) - } - } return ( <> @@ -61,30 +12,7 @@ export default function Contact() { Be nice. Please don't make us regret putting this here -
- - - - - - - -