feat: MVP-3 Sprint 1 - Usage tracking, smart dashboard, scoring boost
## Registro de Uso - Nuevo modelo NoteUsage en Prisma - Tipos de eventos: view, search_click, related_click, link_click, copy_command, copy_snippet - Funciones: trackNoteUsage, getUsageStats, getRecentlyUsedNotes - localStorage: recentlyViewed (últimas 10 notas) - Rastreo de copias en markdown-content.tsx ## Dashboard Rediseñado - 5 bloques: Recientes, Más usadas, Comandos recientes, Snippets recientes, Según actividad - Nuevo src/lib/dashboard.ts con getDashboardData() - Recomendaciones basadas en recentlyViewed ## Scoring con Uso Real - search.ts: +1 per 5 views (max +3), +2 recency boost - related.ts: mismo sistema de usage boost - No eclipsa match textual fuerte ## Tests - 110 tests pasando (usage, dashboard, related, search) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+9
-27
@@ -1,37 +1,19 @@
|
||||
import { prisma } from '@/lib/prisma'
|
||||
import { Dashboard } from '@/components/dashboard'
|
||||
import { NoteType } from '@/types/note'
|
||||
|
||||
async function getNotes() {
|
||||
const notes = await prisma.note.findMany({
|
||||
include: { tags: { include: { tag: true } } },
|
||||
orderBy: { updatedAt: 'desc' },
|
||||
})
|
||||
return notes
|
||||
}
|
||||
import { getDashboardData } from '@/lib/dashboard'
|
||||
|
||||
export default async function HomePage() {
|
||||
const allNotes = await getNotes()
|
||||
|
||||
const notesWithTags = allNotes.map(note => ({
|
||||
...note,
|
||||
createdAt: note.createdAt.toISOString(),
|
||||
updatedAt: note.updatedAt.toISOString(),
|
||||
type: note.type as NoteType,
|
||||
tags: note.tags.map(nt => ({ tag: nt.tag })),
|
||||
}))
|
||||
|
||||
const recentNotes = notesWithTags.slice(0, 6)
|
||||
const favoriteNotes = notesWithTags.filter(n => n.isFavorite)
|
||||
const pinnedNotes = notesWithTags.filter(n => n.isPinned)
|
||||
const data = await getDashboardData(6)
|
||||
|
||||
return (
|
||||
<main className="container mx-auto pt-8 px-4">
|
||||
<Dashboard
|
||||
recentNotes={recentNotes}
|
||||
favoriteNotes={favoriteNotes}
|
||||
pinnedNotes={pinnedNotes}
|
||||
recentNotes={data.recentNotes}
|
||||
mostUsedNotes={data.mostUsedNotes}
|
||||
recentCommands={data.recentCommands}
|
||||
recentSnippets={data.recentSnippets}
|
||||
activityBasedNotes={data.activityBasedNotes}
|
||||
hasActivity={data.hasActivity}
|
||||
/>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user