Skip to content

Commit 0d42275

Browse files
authored
Change the email copy to mailto (#33)
This replaces the mechanism to copy the sponsors emails to using the 'mailto:' attribute, in order to launch an email client and write the email directly. A suggested 'subject' was included as well, to simplify the contact from possible sponsors.
1 parent d24cc03 commit 0d42275

2 files changed

Lines changed: 4 additions & 28 deletions

File tree

src/pages/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export const SPONSORS_EMAIL = 'sponsors@2026.es.pycon.org'
2+
export const SPONSORS_SUBJECT = 'Interés de patrocinio para PyConES2026'

src/pages/index.astro

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
import Layout from '../layouts/Layout.astro'
33
import '@fontsource-variable/jetbrains-mono'
4-
import { SPONSORS_EMAIL } from './constants'
4+
import { SPONSORS_EMAIL, SPONSORS_SUBJECT } from './constants'
55
---
66

77
<Layout title="PyConES 2026">
@@ -29,6 +29,7 @@ import { SPONSORS_EMAIL } from './constants'
2929
id="actions"
3030
class="mt-12 flex flex-col md:flex-row gap-6 justify-center items-center opacity-0 transition-opacity duration-1000 ease-in"
3131
>
32+
<a href={`mailto:${SPONSORS_EMAIL}?subject=${encodeURIComponent(SPONSORS_SUBJECT)}`}>
3233
<button
3334
id="sponsor-btn"
3435
type="button"
@@ -49,6 +50,7 @@ import { SPONSORS_EMAIL } from './constants'
4950
</span>
5051
<span id="sponsor-hint" class="sr-only">Copia el email de contacto para patrocinadores</span>
5152
</button>
53+
</a>
5254

5355
<div
5456
id="copy-confirmation"
@@ -129,33 +131,6 @@ import { SPONSORS_EMAIL } from './constants'
129131
}, 1500)
130132
}
131133

132-
// COPY MAIL LOGIC
133-
const sponsorBtn = document.getElementById('sponsor-btn')
134-
const copyConfirmation = document.getElementById('copy-confirmation')
135-
const email = sponsorBtn?.dataset.email as string
136-
137-
if (sponsorBtn && copyConfirmation && email) {
138-
sponsorBtn.onclick = async () => {
139-
try {
140-
await navigator.clipboard.writeText(email)
141-
142-
// Hide button, show confirmation
143-
sponsorBtn.classList.add('hidden')
144-
copyConfirmation.classList.remove('hidden')
145-
copyConfirmation.focus()
146-
147-
setTimeout(() => {
148-
// Hide confirmation, show button and restore focus
149-
copyConfirmation.classList.add('hidden')
150-
sponsorBtn.classList.remove('hidden')
151-
sponsorBtn.focus()
152-
}, 2000)
153-
} catch (err) {
154-
console.error('Failed to copy', err)
155-
window.location.href = `mailto:${email}`
156-
}
157-
}
158-
}
159134
}
160135

161136
//not needed now

0 commit comments

Comments
 (0)