From d94d6845dc71c04993dc8f9841cf75c8f4d58365 Mon Sep 17 00:00:00 2001 From: zguiyang Date: Sat, 2 May 2026 09:51:38 +0800 Subject: [PATCH] chore: hide contact info behind eye toggle instead of MD5 --- src/components/ContactCard.astro | 22 +++++++-------- src/components/ContactReveal.tsx | 47 ++++++++++++++++++++++++++++++++ src/i18n/translations.ts | 16 +++++++---- src/lib/data/contact.ts | 6 ++-- src/lib/data/personal-info.ts | 2 +- 5 files changed, 71 insertions(+), 22 deletions(-) create mode 100644 src/components/ContactReveal.tsx diff --git a/src/components/ContactCard.astro b/src/components/ContactCard.astro index 156e4e0..b9a2d7e 100644 --- a/src/components/ContactCard.astro +++ b/src/components/ContactCard.astro @@ -1,5 +1,6 @@ --- import { contactIntents, contactMethods } from "@/lib/data"; +import ContactReveal from "@/components/ContactReveal"; import type { Lang } from "@/types/i18n"; interface Props { @@ -40,18 +41,15 @@ const isZh = lang === "zh"; diff --git a/src/components/ContactReveal.tsx b/src/components/ContactReveal.tsx new file mode 100644 index 0000000..d782243 --- /dev/null +++ b/src/components/ContactReveal.tsx @@ -0,0 +1,47 @@ +import { useState } from "react"; +import { Eye, EyeOff } from "lucide-react"; + +interface ContactRevealProps { + label: string; + value: string; + href?: string; + isZh?: boolean; +} + +export default function ContactReveal({ label, value, href, isZh }: ContactRevealProps) { + const [revealed, setRevealed] = useState(false); + const masked = "******"; + + return ( +
  • + {label} + + {revealed ? ( + href ? ( + + {value} + + ) : ( + {value} + ) + ) : ( + {masked} + )} + + +
  • + ); +} diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts index 7ee64c3..0d9720f 100644 --- a/src/i18n/translations.ts +++ b/src/i18n/translations.ts @@ -151,18 +151,20 @@ export const translations = { methods: [ { label: "Email", - value: "32df4a784e33b3964f4c06f6c6aeeecd", + value: "zhaoguiyang18@outlook.com", icon: "mail", + link: "mailto:zhaoguiyang18@outlook.com", }, { label: "WeChat", - value: "1b2f7b05fca4d2b892e7fa7741d077ee", + value: "Joey_Zhao_dev", icon: "wechat", }, { label: "Telegram", - value: "592dff213bb5e79a511c34a37f7edbb5", + value: "joey_zgy", icon: "send", + link: "https://t.me/joey_zgy", }, ], }, @@ -379,18 +381,20 @@ export const translations = { methods: [ { label: "邮箱", - value: "32df4a784e33b3964f4c06f6c6aeeecd", + value: "zhaoguiyang18@outlook.com", icon: "mail", + link: "mailto:zhaoguiyang18@outlook.com", }, { label: "微信", - value: "1b2f7b05fca4d2b892e7fa7741d077ee", + value: "Joey_Zhao_dev", icon: "wechat", }, { label: "Telegram", - value: "592dff213bb5e79a511c34a37f7edbb5", + value: "joey_zgy", icon: "send", + link: "https://t.me/joey_zgy", }, ], }, diff --git a/src/lib/data/contact.ts b/src/lib/data/contact.ts index 4358b94..17c3e82 100644 --- a/src/lib/data/contact.ts +++ b/src/lib/data/contact.ts @@ -39,14 +39,14 @@ export const contactIntents: ContactIntent[] = [ export const contactMethods: ContactMethod[] = [ { label: { en: "Email (Secondary)", zh: "邮箱(备用)" }, - value: "32df4a784e33b3964f4c06f6c6aeeecd", + value: "zhaoguiyang18@outlook.com", }, { label: { en: "WeChat", zh: "微信" }, - value: "1b2f7b05fca4d2b892e7fa7741d077ee", + value: "Joey_Zhao_dev", }, { label: { en: "Telegram", zh: "Telegram" }, - value: "592dff213bb5e79a511c34a37f7edbb5", + value: "joey_zgy", }, ]; diff --git a/src/lib/data/personal-info.ts b/src/lib/data/personal-info.ts index d9c10ff..3bf919a 100644 --- a/src/lib/data/personal-info.ts +++ b/src/lib/data/personal-info.ts @@ -4,7 +4,7 @@ export const personalInfo: PersonalInfo = { name: "Joey Z.", location: "Chengdu, China", avatar: "https://avatars.githubusercontent.com/u/24975063?v=4", - email: "32df4a784e33b3964f4c06f6c6aeeecd", + email: "zhaoguiyang18@outlook.com", github: "https://github.com/zguiyang", linkedin: "", website: "https://zhaoguiyang.com",