Skip to content

Commit

Permalink
some more fixes/better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
RiskyMH committed Jan 23, 2025
1 parent 7fbee67 commit 7e0f46a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/web/app/(emailthing.me)/emailme/[username]/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function emailMeForm(

const result = await turnstile.json();
if (!result.success) {
return { error: "Failed turnstile recapture test" };
return { error: "Failed cloudflare turnstile recapture test..." };
}
// return { success: "test done" }
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export function Form({ publicEmail, username }: { className?: string; publicEmai
useEffect(() => {
if (state?.error) {
(window as any)?.turnstile?.reset();

if (!document.querySelector(".cf-turnstile > div")) {
toast.error("Oh no, cloudflare is having issues displaying the verification to you :(", { description: () => <p className="text-foreground! italic">May need to refresh page to reset and try again</p>})
}
}
}, [state]);

Expand All @@ -27,7 +31,7 @@ export function Form({ publicEmail, username }: { className?: string; publicEmai
suppressHydrationWarning
id="emailme-form"
>
<input name="username" value={username} hidden />
<input name="username" value={username} hidden readOnly />
<div className="flex flex-col gap-2 sm:flex-row">
<ClientInput
placeholder="Name *"
Expand Down Expand Up @@ -110,9 +114,11 @@ export function Form({ publicEmail, username }: { className?: string; publicEmai
<Toaster message={state?.success} />
<script
suppressHydrationWarning
type="text/javascript"
// biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation>
dangerouslySetInnerHTML={{
__html: `{
const fn = () => {
const urlParams = new URLSearchParams(window.location.search);
const mailtoLink = document.getElementById("mailto-link");
Expand All @@ -132,6 +138,9 @@ if (name && nameElem) nameElem.value = name;
if (email && emailElem) emailElem.value = email;
if (subject && subjectElem) subjectElem.value = subject;
if (message && messageElem) messageElem.value = message;
};
document.addEventListener("DOMContentLoaded", fn);
document.addEventListener("load", fn);
}`.replaceAll("\n", " "),
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function NotFound() {
<div className="flex h-screen w-full flex-col items-center justify-center">
<h1 className="text-center font-bold text-4xl text-foreground">Not found</h1>
<p className="px-2 text-center text-muted-foreground">
This user can not be found, if this is you please
This user can not be found, if this is you please {" "}
<Link
href="https://emailthing.app/settings/emailthing-me"
className="underline hover:text-blue"
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/(emailthing.me)/emailme/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default async function Home() {
<h1 className="block font-heading text-3xl sm:text-5xl md:text-6xl">
<span className="inline-block whitespace-nowrap bg-gradient-to-br from-[#FF9797] to-[#6D6AFF] bg-clip-text text-transparent">
EmailThing.me
</span>
</span> {" "}
is your own contact page to make emailing easy!
</h1>

Expand Down

0 comments on commit 7e0f46a

Please sign in to comment.