carnet panel contact

This commit is contained in:
alma 2025-04-20 19:15:59 +02:00
parent c6a8b4729f
commit da9094e92d
2 changed files with 16 additions and 2 deletions

View File

@ -298,6 +298,15 @@ export default function CarnetPage() {
console.log('Selected folder:', folder);
setSelectedFolder(folder);
setLayoutMode("item-selection");
// Reset selected contact when changing folders
setSelectedContact(null);
};
const handleContactSelect = (contact: Contact) => {
setSelectedContact(contact);
if (isMobile) {
setShowNotes(false);
}
};
const handleNewNote = () => {
@ -385,7 +394,7 @@ export default function CarnetPage() {
{selectedFolder === 'Contacts' ? (
<ContactsView
contacts={contacts}
onContactSelect={setSelectedContact}
onContactSelect={handleContactSelect}
selectedContact={selectedContact}
loading={isLoadingNotes}
/>

View File

@ -159,7 +159,12 @@ export default function Navigation({ nextcloudFolders, onFolderSelect }: Navigat
return (
<button
key={file.id}
onClick={() => onFolderSelect(`Contacts/${file.basename}`)}
onClick={() => {
// When clicking a VCF file, we want to select the Contacts folder
// and pass the file information to the parent component
onFolderSelect('Contacts');
// You might want to add a callback here to handle the selected contact
}}
className="w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-carnet-text-muted hover:bg-carnet-hover"
>
<span>{file.basename.replace('.vcf', '')}</span>