1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-05 19:15:30 -04:00

update cloudflare turnstile

This commit is contained in:
2025-05-09 11:07:23 -04:00
parent afcced7707
commit cce48e558f
4 changed files with 34 additions and 32 deletions
+9 -9
View File
@@ -2,7 +2,7 @@
import { env } from "@/lib/env";
import { useActionState, useState } from "react";
import Turnstile from "react-turnstile";
import { Turnstile } from "@marsidev/react-turnstile";
import { SendIcon, Loader2Icon, CheckIcon, XIcon } from "lucide-react";
import Link from "@/components/link";
import Input from "@/components/ui/input";
@@ -37,9 +37,9 @@ const ContactForm = () => {
setFormFields({ ...formFields, name: e.target.value });
}}
disabled={pending || formState.success}
aria-invalid={!pending && formState.errors?.name ? "true" : undefined}
aria-invalid={formState.errors?.name ? "true" : undefined}
/>
{!pending && formState.errors?.name && (
{formState.errors?.name && (
<span className="text-destructive text-[0.8rem] font-semibold">{formState.errors.name[0]}</span>
)}
</div>
@@ -55,9 +55,9 @@ const ContactForm = () => {
setFormFields({ ...formFields, email: e.target.value });
}}
disabled={pending || formState.success}
aria-invalid={!pending && formState.errors?.email ? "true" : undefined}
aria-invalid={formState.errors?.email ? "true" : undefined}
/>
{!pending && formState.errors?.email && (
{formState.errors?.email && (
<span className="text-destructive text-[0.8rem] font-semibold">{formState.errors.email[0]}</span>
)}
</div>
@@ -71,10 +71,10 @@ const ContactForm = () => {
setFormFields({ ...formFields, message: e.target.value });
}}
disabled={pending || formState.success}
aria-invalid={!pending && formState.errors?.message ? "true" : undefined}
aria-invalid={formState.errors?.message ? "true" : undefined}
className="min-h-[6lh] resize-y"
/>
{!pending && formState.errors?.message && (
{formState.errors?.message && (
<span className="text-destructive text-[0.8rem] font-semibold">{formState.errors.message[0]}</span>
)}
@@ -102,8 +102,8 @@ const ContactForm = () => {
</div>
<div>
<Turnstile sitekey={env.NEXT_PUBLIC_TURNSTILE_SITE_KEY} fixedSize />
{!pending && formState.errors?.["cf-turnstile-response"] && (
<Turnstile siteKey={env.NEXT_PUBLIC_TURNSTILE_SITE_KEY} />
{formState.errors?.["cf-turnstile-response"] && (
<span className="text-destructive text-[0.8rem] font-semibold">
{formState.errors["cf-turnstile-response"][0]}
</span>
+4 -2
View File
@@ -38,7 +38,9 @@ const Page = async () => {
Object.entries(postsByYear).forEach(([year, posts]) => {
sections.push(
<section className="my-8 first-of-type:mt-6 last-of-type:mb-6" key={year}>
<h2 className="mt-0 mb-4 text-3xl font-bold md:text-4xl">{year}</h2>
<h2 id={year} className="mt-0 mb-4 text-3xl font-bold md:text-4xl">
{year}
</h2>
<ul className="space-y-4">
{posts.map(({ slug, date, title, htmlTitle, views }) => (
<li className="flex text-base leading-relaxed" key={slug}>
@@ -52,7 +54,7 @@ const Page = async () => {
{views > 0 && (
<span className="bg-muted text-muted-foreground inline-flex h-5 flex-nowrap items-center gap-1 rounded-md px-1.5 align-text-top text-xs font-semibold text-nowrap shadow select-none">
<EyeIcon className="inline-block size-4 shrink-0" />
<span className="inline-block leading-5">
<span className="inline-block leading-none">
{Intl.NumberFormat(env.NEXT_PUBLIC_SITE_LOCALE).format(views)}
</span>
</span>