diff --git a/k-notes-frontend/public/locales/de/translation.json b/k-notes-frontend/public/locales/de/translation.json index 5321e3d..0217c55 100644 --- a/k-notes-frontend/public/locales/de/translation.json +++ b/k-notes-frontend/public/locales/de/translation.json @@ -17,6 +17,7 @@ "Configure the application settings.": "Konfiguriere die Anwendungseinstellungen.", "Configure the backend API URL for this application": "Konfiguriere die Backend-API-URL für diese Anwendung", "Content": "Inhalt", + "Copy note": "Notiz kopieren", "Create": "Erstellen", "Create Note": "Notiz erstellen", "Current API URL": "Aktuelle API-URL", @@ -31,6 +32,7 @@ "Export failed": "Export fehlgeschlagen", "Export successful": "Export erfolgreich", "Export your notes for backup or import from a JSON file.": "Exportiere deine Notizen für ein Backup oder importiere aus einer JSON-Datei.", + "Failed to copy note": "Fehler beim Kopieren der Notiz", "Grid View": "Rasteransicht", "History": "Verlauf", "Import Data": "Daten importieren", @@ -47,6 +49,7 @@ "No notes with tag \"${activeTag}\"": "Keine Notizen mit Tag \"${activeTag}\"", "No tags yet": "Noch keine Tags", "Note content... Type / for commands": "Notizinhalt... Tippe / für Befehle", + "Note copied to clipboard": "Notiz in die Zwischenablage kopiert", "Note created": "Notiz erstellt", "Note title": "Notiztitel", "Note updated": "Notiz aktualisiert", diff --git a/k-notes-frontend/public/locales/en/translation.json b/k-notes-frontend/public/locales/en/translation.json index 58311e9..171c6dc 100644 --- a/k-notes-frontend/public/locales/en/translation.json +++ b/k-notes-frontend/public/locales/en/translation.json @@ -17,6 +17,7 @@ "Configure the application settings.": "Configure the application settings.", "Configure the backend API URL for this application": "Configure the backend API URL for this application", "Content": "Content", + "Copy note": "Copy note", "Create": "Create", "Create Note": "Create Note", "Current API URL": "Current API URL", @@ -31,6 +32,7 @@ "Export failed": "Export failed", "Export successful": "Export successful", "Export your notes for backup or import from a JSON file.": "Export your notes for backup or import from a JSON file.", + "Failed to copy note": "Failed to copy note", "Grid View": "Grid View", "History": "History", "Import Data": "Import Data", @@ -47,6 +49,7 @@ "No notes with tag \"${activeTag}\"": "No notes with tag \"${activeTag}\"", "No tags yet": "No tags yet", "Note content... Type / for commands": "Note content... Type / for commands", + "Note copied to clipboard": "Note copied to clipboard", "Note created": "Note created", "Note title": "Note title", "Note updated": "Note updated", @@ -78,4 +81,4 @@ "Update": "Update", "work, todo, ideas": "work, todo, ideas", "Your notes will appear here. Click + to create one.": "Your notes will appear here. Click + to create one." -} +} \ No newline at end of file diff --git a/k-notes-frontend/public/locales/es/translation.json b/k-notes-frontend/public/locales/es/translation.json index 44a9a97..76a2fc5 100644 --- a/k-notes-frontend/public/locales/es/translation.json +++ b/k-notes-frontend/public/locales/es/translation.json @@ -20,6 +20,7 @@ "Configure the application settings.": "Configura los ajustes de la aplicación.", "Configure the backend API URL for this application": "Configura la URL de API del backend para esta aplicación", "Content": "Contenido", + "Copy note": "Copiar nota", "Create": "Crear", "Create Note": "Crear nota", "Current API URL": "URL de API actual", @@ -35,6 +36,7 @@ "Export failed": "Exportación fallida", "Export successful": "Exportación exitosa", "Export your notes for backup or import from a JSON file.": "Exporta tus notas para hacer una copia de seguridad o importa desde un archivo JSON.", + "Failed to copy note": "Error al copiar la nota", "Grid View": "Vista de cuadrícula", "History": "Historial", "Import Data": "Importar datos", @@ -51,6 +53,7 @@ "No notes with tag \"${activeTag}\"": "No hay notas con la etiqueta \"${activeTag}\"", "No tags yet": "Aún no hay etiquetas", "Note content... Type / for commands": "Contenido de la nota... Escribe / para ver comandos", + "Note copied to clipboard": "Nota copiada al portapapeles", "Note created": "Nota creada", "Note title": "Título de la nota", "Note updated": "Nota actualizada", diff --git a/k-notes-frontend/public/locales/fr/translation.json b/k-notes-frontend/public/locales/fr/translation.json index 2347601..0836afc 100644 --- a/k-notes-frontend/public/locales/fr/translation.json +++ b/k-notes-frontend/public/locales/fr/translation.json @@ -20,6 +20,7 @@ "Configure the application settings.": "Configure les paramètres de l'application.", "Configure the backend API URL for this application": "Configure l'URL de l'API backend pour cette application", "Content": "Contenu", + "Copy note": "Copier la note", "Create": "Créer", "Create Note": "Créer une note", "Current API URL": "URL de l'API actuelle", @@ -35,6 +36,7 @@ "Export failed": "Échec de l'exportation", "Export successful": "Exportation réussie", "Export your notes for backup or import from a JSON file.": "Exporte tes notes pour une sauvegarde ou importe depuis un fichier JSON.", + "Failed to copy note": "Échec de la copie de la note", "Grid View": "Vue en grille", "History": "Historique", "Import Data": "Importer les données", @@ -51,6 +53,7 @@ "No notes with tag \"${activeTag}\"": "Aucune note avec l'étiquette \"${activeTag}\"", "No tags yet": "Pas encore d'étiquettes", "Note content... Type / for commands": "Contenu de la note... Tape / pour les commandes", + "Note copied to clipboard": "Note copiée dans le presse-papiers", "Note created": "Note créée", "Note title": "Titre de la note", "Note updated": "Note mise à jour", diff --git a/k-notes-frontend/public/locales/pl/translation.json b/k-notes-frontend/public/locales/pl/translation.json index db9f3b3..221789c 100644 --- a/k-notes-frontend/public/locales/pl/translation.json +++ b/k-notes-frontend/public/locales/pl/translation.json @@ -23,6 +23,7 @@ "Configure the application settings.": "Skonfiguruj ustawienia aplikacji.", "Configure the backend API URL for this application": "Skonfiguruj URL API backendu dla tej aplikacji", "Content": "Treść", + "Copy note": "Kopiuj notatkę", "Create": "Utwórz", "Create Note": "Utwórz notatkę", "Current API URL": "Aktualny URL API", @@ -39,6 +40,7 @@ "Export failed": "Eksport nie powiódł się", "Export successful": "Eksport zakończony sukcesem", "Export your notes for backup or import from a JSON file.": "Wyeksportuj swoje notatki do kopii zapasowej lub zaimportuj z pliku JSON.", + "Failed to copy note": "Nie udało się skopiować notatki", "Grid View": "Widok siatki", "History": "Historia", "Import Data": "Importuj dane", @@ -55,6 +57,7 @@ "No notes with tag \"${activeTag}\"": "Brak notatek z tagiem \"${activeTag}\"", "No tags yet": "Nie ma jeszcze tagów", "Note content... Type / for commands": "Treść notatki... Wpisz / aby zobaczyć komendy", + "Note copied to clipboard": "Notatka skopiowana do schowka", "Note created": "Notatka utworzona", "Note title": "Tytuł notatki", "Note updated": "Notatka zaktualizowana", diff --git a/k-notes-frontend/src/components/note-card.tsx b/k-notes-frontend/src/components/note-card.tsx index 05b74da..12022b8 100644 --- a/k-notes-frontend/src/components/note-card.tsx +++ b/k-notes-frontend/src/components/note-card.tsx @@ -2,7 +2,7 @@ import { type Note, useDeleteNote, useUpdateNote } from "@/hooks/use-notes"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; -import { Pin, Archive, Trash2, Edit, History } from "lucide-react"; +import { Pin, Archive, Trash2, Edit, History, Copy } from "lucide-react"; import { format } from "date-fns"; import { toast } from "sonner"; import { useState } from "react"; @@ -64,6 +64,17 @@ export function NoteCard({ note }: NoteCardProps) { } } + const handleCopy = async (e: React.MouseEvent) => { + e.stopPropagation(); + try { + const textToCopy = `${note.title}\n\n${note.content}`; + await navigator.clipboard.writeText(textToCopy); + toast.success(t("Note copied to clipboard")); + } catch (err) { + toast.error(t("Failed to copy note")); + } + } + const handleEdit = (data: any) => { const tags = data.tags ? data.tags.split(",").map((t: string) => t.trim()).filter(Boolean) @@ -134,6 +145,9 @@ export function NoteCard({ note }: NoteCardProps) { +