UI: Agregar notificaciones toast a todas las funciones de copiar en Mensajes
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m43s

This commit is contained in:
2025-12-03 09:37:55 -06:00
parent c0af0a3478
commit 768d8ee8e2
3 changed files with 39 additions and 0 deletions

View File

@@ -130,11 +130,24 @@ const lastMessagePreview = computed(() => {
return ''
})
const toast = useToast()
const copyToClipboard = async (text: string) => {
try {
await navigator.clipboard.writeText(text)
toast.add({
title: 'Copiado al portapapeles',
icon: 'i-lucide-check',
color: 'success',
timeout: 2000
})
} catch (err) {
console.error('Failed to copy:', err)
toast.add({
title: 'Error al copiar',
icon: 'i-lucide-x',
color: 'error',
timeout: 2000
})
}
}

View File

@@ -316,11 +316,24 @@ const formatTime = (date: Date) => {
})
}
const toast = useToast()
const copyToClipboard = async (text: string) => {
try {
await navigator.clipboard.writeText(text)
toast.add({
title: 'Copiado al portapapeles',
icon: 'i-lucide-check',
color: 'success',
timeout: 2000
})
} catch (err) {
console.error('Failed to copy:', err)
toast.add({
title: 'Error al copiar',
icon: 'i-lucide-x',
color: 'error',
timeout: 2000
})
}
}
</script>

View File

@@ -472,11 +472,24 @@ watch(messages, () => {
}, { deep: true })
// Copy to clipboard function
const toast = useToast()
const copyToClipboard = async (text: string) => {
try {
await navigator.clipboard.writeText(text)
toast.add({
title: 'Copiado al portapapeles',
icon: 'i-lucide-check',
color: 'success',
timeout: 2000
})
} catch (err) {
console.error('Failed to copy:', err)
toast.add({
title: 'Error al copiar',
icon: 'i-lucide-x',
color: 'error',
timeout: 2000
})
}
}