Skip to content

Commit 63a1dff

Browse files
committed
Make note cards clickable in NotesBrowser to open files
1 parent ba6f72b commit 63a1dff

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

src/components/public/NotesBrowser.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,22 @@ export default function NotesBrowser() {
267267
) : (
268268
<div className={styles.notesGrid}>
269269
{searchResults.map(note => (
270-
<div key={note.id} className={styles.noteCard}>
270+
<div
271+
key={note.id}
272+
className={styles.noteCard}
273+
onClick={() => window.open(note.fileUrl, '_blank')}
274+
style={{ cursor: "pointer" }}
275+
>
271276
<div className={styles.preview}>
272277
{getPreview(note)}
273278
</div>
274279
<div className={styles.noteContent}>
275280
<h4 className={styles.noteName} title={note.title}>{note.title}</h4>
276281
<p className={styles.noteMeta}>{new Date(note.createdAt?.seconds * 1000).toLocaleDateString()}</p>
277282
<div className={styles.actions}>
278-
<a href={note.fileUrl} target="_blank" rel="noopener noreferrer" className={styles.btn} title="View"><Eye size={18} /></a>
279-
<a href={note.fileUrl} download target="_blank" rel="noopener noreferrer" className={styles.btn} title="Download"><Download size={18} /></a>
280-
<button onClick={() => handleShare(note.fileUrl)} className={styles.btn} title="Share Link"><Share2 size={18} /></button>
283+
<a href={note.fileUrl} target="_blank" rel="noopener noreferrer" className={styles.btn} title="View" onClick={(e) => e.stopPropagation()}><Eye size={18} /></a>
284+
<a href={note.fileUrl} download target="_blank" rel="noopener noreferrer" className={styles.btn} title="Download" onClick={(e) => e.stopPropagation()}><Download size={18} /></a>
285+
<button onClick={(e) => { e.stopPropagation(); handleShare(note.fileUrl); }} className={styles.btn} title="Share Link"><Share2 size={18} /></button>
281286
</div>
282287
</div>
283288
</div>
@@ -417,17 +422,22 @@ export default function NotesBrowser() {
417422
) : (
418423
<div className={styles.notesGrid}>
419424
{filteredNotes.map(note => (
420-
<div key={note.id} className={styles.noteCard}>
425+
<div
426+
key={note.id}
427+
className={styles.noteCard}
428+
onClick={() => window.open(note.fileUrl, '_blank')}
429+
style={{ cursor: "pointer" }}
430+
>
421431
<div className={styles.preview}>
422432
{getPreview(note)}
423433
</div>
424434
<div className={styles.noteContent}>
425435
<h4 className={styles.noteName} title={note.title}>{note.title}</h4>
426436
<p className={styles.noteMeta}>{new Date(note.createdAt?.seconds * 1000).toLocaleDateString()}</p>
427437
<div className={styles.actions}>
428-
<a href={note.fileUrl} target="_blank" rel="noopener noreferrer" className={styles.btn} title="View"><Eye size={18} /></a>
429-
<a href={note.fileUrl} download target="_blank" rel="noopener noreferrer" className={styles.btn} title="Download"><Download size={18} /></a>
430-
<button onClick={() => handleShare(note.fileUrl)} className={styles.btn} title="Share Link"><Share2 size={18} /></button>
438+
<a href={note.fileUrl} target="_blank" rel="noopener noreferrer" className={styles.btn} title="View" onClick={(e) => e.stopPropagation()}><Eye size={18} /></a>
439+
<a href={note.fileUrl} download target="_blank" rel="noopener noreferrer" className={styles.btn} title="Download" onClick={(e) => e.stopPropagation()}><Download size={18} /></a>
440+
<button onClick={(e) => { e.stopPropagation(); handleShare(note.fileUrl); }} className={styles.btn} title="Share Link"><Share2 size={18} /></button>
431441
</div>
432442
</div>
433443
</div>

0 commit comments

Comments
 (0)