fix: update masonry grid sizing logic and notebook list padding
This commit is contained in:
@@ -47,19 +47,18 @@ export function RecentNotesSection({ recentNotes, onEdit }: RecentNotesSectionPr
|
||||
}
|
||||
|
||||
// Compact card - matching your app's clean design
|
||||
function CompactCard({
|
||||
note,
|
||||
function CompactCard({
|
||||
note,
|
||||
index,
|
||||
onEdit
|
||||
}: {
|
||||
onEdit
|
||||
}: {
|
||||
note: Note
|
||||
index: number
|
||||
onEdit?: (note: Note, readOnly?: boolean) => void
|
||||
onEdit?: (note: Note, readOnly?: boolean) => void
|
||||
}) {
|
||||
const { language } = useLanguage()
|
||||
// NOTE: Using updatedAt here, but note-card.tsx uses createdAt
|
||||
// If times are incorrect, consider using createdAt instead or ensure dates are properly parsed
|
||||
const timeAgo = getCompactTime(note.updatedAt, language)
|
||||
// Use contentUpdatedAt - only reflects actual content changes, not property changes (size, color, etc.)
|
||||
const timeAgo = getCompactTime(note.contentUpdatedAt || note.updatedAt, language)
|
||||
const isFirstNote = index === 0
|
||||
|
||||
return (
|
||||
@@ -76,8 +75,8 @@ function CompactCard({
|
||||
isFirstNote
|
||||
? "bg-gradient-to-b from-primary to-primary/70"
|
||||
: index === 1
|
||||
? "bg-primary/80 dark:bg-primary/70"
|
||||
: "bg-muted dark:bg-muted/60"
|
||||
? "bg-primary/80 dark:bg-primary/70"
|
||||
: "bg-muted dark:bg-muted/60"
|
||||
)} />
|
||||
|
||||
{/* Content with left padding for accent line */}
|
||||
@@ -126,13 +125,13 @@ function CompactCard({
|
||||
function getCompactTime(date: Date | string, language: string): string {
|
||||
const now = new Date()
|
||||
const then = date instanceof Date ? date : new Date(date)
|
||||
|
||||
|
||||
// Validate date
|
||||
if (isNaN(then.getTime())) {
|
||||
console.warn('Invalid date provided to getCompactTime:', date)
|
||||
return language === 'fr' ? 'date invalide' : 'invalid date'
|
||||
}
|
||||
|
||||
|
||||
const seconds = Math.floor((now.getTime() - then.getTime()) / 1000)
|
||||
const minutes = Math.floor(seconds / 60)
|
||||
const hours = Math.floor(minutes / 60)
|
||||
|
||||
Reference in New Issue
Block a user