Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions client/web/src/pages/hacker/dashboard/DashboardPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { LucideIcon } from "lucide-react";
import { BookOpen, ChevronRight, Mail, MessageSquare } from "lucide-react";
import { useEffect, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import { Link } from "react-router";
import { toast } from "sonner";

import { getRequest } from "@/shared/lib/api";
import type { Application, NotificationFeedItem } from "@/types";
Expand Down Expand Up @@ -76,6 +77,18 @@ export default function DashboardPage() {
const [feed, setFeed] = useState<NotificationFeedItem[]>([]);
const [hackerPackURL, setHackerPackURL] = useState("");

// Desktop browsers with no registered mail handler make the mailto: link a
// dead click, so also copy the address and confirm it. The href still fires
// for anyone who does have a mail client.
const handleCopyEmail = useCallback(async () => {
try {
await navigator.clipboard.writeText(CONTACT_EMAIL);
toast(`Copied ${CONTACT_EMAIL} to clipboard`);
} catch {
// Clipboard unavailable (insecure context or denied) — mailto: handles it
}
}, []);

useEffect(() => {
const controller = new AbortController();
const load = async () => {
Expand Down Expand Up @@ -247,7 +260,14 @@ export default function DashboardPage() {
{content}
</Link>
) : (
<a key={label} href={href} className={className}>
<a
key={label}
href={href}
onClick={
href?.startsWith("mailto:") ? handleCopyEmail : undefined
}
className={className}
>
{content}
</a>
);
Expand Down
Loading