@@ -5,9 +5,38 @@ import { Button } from '@/app/components/ui/button';
55import { Heading1 as H1 } from '@/app/components/reusables/headers' ;
66import { TextContent as C } from '@/app/components/reusables/content' ;
77import { motion } from 'framer-motion' ;
8+ import { Toaster , toast } from 'sonner' ;
9+ import { useCopyToClipboard } from 'react-use' ;
10+
11+ import { EMAIL , GPG_PUBLIC_KEY_INTERNAL_URL } from '@/lib/constants' ;
812
9- import { EMAIL } from '@/lib/constants' ;
1013export default function Main ( ) {
14+ const [ , copyToClipboard ] = useCopyToClipboard ( ) ;
15+
16+ const successToast = ( ) => {
17+ toast . message ( 'GPG KEY ID: 79821E0224D34EC4969FF6A8E5168EE090AE80D0' , {
18+ description : 'Public key has been copied to your clipboard' ,
19+ } ) ;
20+ } ;
21+
22+ const failToast = ( message ?: string ) => {
23+ toast . message ( 'Oops! Looks like something went wrong!' , {
24+ description : message ,
25+ } ) ;
26+ } ;
27+
28+ async function copyGPG ( ) {
29+ const res = await fetch ( GPG_PUBLIC_KEY_INTERNAL_URL , {
30+ method : 'GET' ,
31+ } ) ;
32+ if ( ! res . ok ) {
33+ const failureMessage = await res . text ( ) ;
34+ failToast ( failureMessage ) ;
35+ }
36+ const key = await res . text ( ) ;
37+ copyToClipboard ( key ) ;
38+ successToast ( ) ;
39+ }
1140 return (
1241 < div className = "flex flex-col" >
1342 < main className = "flex-1" >
@@ -20,15 +49,25 @@ export default function Main() {
2049 </ H1 >
2150 < div className = "mx-auto max-w-[600px]" >
2251 < C >
23- I'm available for business inquiries, and new
24- opportunities. Feel free to reach out through email. I will
25- get back to you as soon as possible.
52+ Feel free to reach out through email. I will get back to you
53+ as soon as possible. If you prefer to communicate securely
54+ use my < span > </ span >
55+ < button
56+ onClick = { async ( ) => {
57+ await copyGPG ( ) ;
58+ } }
59+ >
60+ < strong className = "text-white glows underline" >
61+ GPG
62+ </ strong >
63+ </ button >
64+ < span > </ span > key to encrypt messages before you
2665 </ C >
2766 </ div >
2867 </ div >
2968 < div className = "mx-auto max-w-sm space-y-2" >
3069 < motion . div
31- className = "space-y-4 glowsup "
70+ className = "space-y-4 "
3271 initial = { {
3372 opacity : 0 ,
3473 scale : 0.8 ,
@@ -43,7 +82,9 @@ export default function Main() {
4382 } }
4483 >
4584 < Link href = { `mailto:${ EMAIL } ` } >
46- < Button variant = "navbar" > email me</ Button >
85+ < Button className = "glowsup" variant = "navbar" >
86+ email me
87+ </ Button >
4788 </ Link >
4889 </ motion . div >
4990 </ div >
@@ -52,6 +93,7 @@ export default function Main() {
5293 </ section >
5394 </ main >
5495 < Footer />
96+ < Toaster />
5597 </ div >
5698 ) ;
5799}
0 commit comments