feat: mobile app complet + flashcards fixes + drag handle améliorations
Mobile app: - Révision flashcards : liste decks, session flip-card SM-2, couleurs harmonisées web - Génération flashcards depuis note (FlashcardSheet + route /api/mobile/flashcards/generate) - Audio Whisper : hook useAudioRecorder reécrit, MicButton avec erreurs - IA : AISheet (améliorer/clarifier/résumer), TitleSheet (titre automatique) - Suppression note (soft delete + confirmation Alert) - Note du jour : titre lisible + HTML (plus JSON TipTap brut) - Parser TipTap→HTML côté mobile (tipTapToHtml) - Icône 🎓 dans header note → génération flashcards - Endpoint flashcardGenerate dans config.ts Web fixes: - Bug flashcards groupées par carnet → deck par note (migration + schema) - Bug filtre 'cartes dues' ignoré (suppression fallback buildSessionQueue) - Suppression UI création deck manuelle (inutile) - Fix setViewType is not defined dans home-client.tsx Drag handle menu: - Fix : clearNodes() avant transformation (heading→liste/code/citation) - Ajout : option 'Texte' (paragraphe) dans Transformer en - Ajout : Monter / Descendre le bloc - Ajout : Copier le contenu du bloc - Fix : sous-menu hover stable (délai 200ms) - Fix : Supprimer en rouge via classe --danger (plus :first-child) - i18n : nouvelles clés dans 15 locales Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,6 @@ import { NextRequest, NextResponse } from 'next/server'
|
||||
import { Prisma } from '@prisma/client'
|
||||
import { auth } from '@/auth'
|
||||
import { prisma } from '@/lib/prisma'
|
||||
import { getOrCreateDeckForNotebook } from '@/lib/flashcards/deck-utils'
|
||||
import type { FlashcardStyle } from '@/lib/flashcards/generate-flashcards'
|
||||
|
||||
interface CardInput {
|
||||
@@ -35,7 +34,7 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
|
||||
let notebookId: string | null = null
|
||||
let fallbackDeckName: string | undefined
|
||||
let noteName = 'Sans titre'
|
||||
if (noteId) {
|
||||
const note = await prisma.note.findFirst({
|
||||
where: { id: noteId, userId: session.user.id },
|
||||
@@ -45,14 +44,13 @@ export async function POST(request: NextRequest) {
|
||||
return NextResponse.json({ error: 'Note not found' }, { status: 404 })
|
||||
}
|
||||
notebookId = note.notebookId
|
||||
if (!notebookId) {
|
||||
fallbackDeckName = note.title?.trim() || 'General'
|
||||
}
|
||||
noteName = note.title?.trim() || 'Sans titre'
|
||||
}
|
||||
|
||||
let deckId = deckIdInput
|
||||
if (!deckId) {
|
||||
if (noteId) {
|
||||
// Chercher un deck déjà créé pour CETTE note spécifique
|
||||
const existingFromNote = await prisma.flashcard.findFirst({
|
||||
where: { noteId, deck: { userId: session.user.id } },
|
||||
select: { deckId: true },
|
||||
@@ -62,10 +60,9 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
}
|
||||
if (!deckId) {
|
||||
const deck = await getOrCreateDeckForNotebook({
|
||||
userId: session.user.id,
|
||||
notebookId,
|
||||
manualName: fallbackDeckName,
|
||||
// Créer un nouveau deck nommé d'après la note (pas le carnet)
|
||||
const deck = await prisma.flashcardDeck.create({
|
||||
data: { userId: session.user.id, notebookId, name: noteName },
|
||||
})
|
||||
deckId = deck.id
|
||||
}
|
||||
|
||||
41
memento-note/app/api/mobile/ai/improve/route.ts
Normal file
41
memento-note/app/api/mobile/ai/improve/route.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { getMobileUserId } from '@/lib/mobile-auth'
|
||||
import { paragraphRefactorService } from '@/lib/ai/services/paragraph-refactor.service'
|
||||
import { checkEntitlementOrThrow, QuotaExceededError, incrementUsageAsync } from '@/lib/entitlements'
|
||||
|
||||
const MODE_MAP: Record<string, 'clarify' | 'shorten' | 'improveStyle' | 'fix_grammar'> = {
|
||||
improve: 'improveStyle',
|
||||
shorten: 'shorten',
|
||||
clarify: 'clarify',
|
||||
fix_grammar: 'fix_grammar',
|
||||
}
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
const userId = getMobileUserId(req)
|
||||
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
|
||||
|
||||
const { text, mode = 'improve' } = await req.json().catch(() => ({}))
|
||||
if (!text?.trim()) return NextResponse.json({ error: 'Texte requis' }, { status: 400 })
|
||||
|
||||
const refactorMode = MODE_MAP[mode]
|
||||
if (!refactorMode) {
|
||||
return NextResponse.json({ error: 'Mode invalide. Valeurs: improve, shorten, clarify, fix_grammar' }, { status: 400 })
|
||||
}
|
||||
|
||||
const validation = paragraphRefactorService.validateWordCount(text)
|
||||
if (!validation.valid) return NextResponse.json({ error: validation.error }, { status: 400 })
|
||||
|
||||
try {
|
||||
await checkEntitlementOrThrow(userId, 'reformulate')
|
||||
} catch (err) {
|
||||
if (err instanceof QuotaExceededError) {
|
||||
return NextResponse.json({ error: 'quota_exceeded' }, { status: 402 })
|
||||
}
|
||||
throw err
|
||||
}
|
||||
|
||||
const result = await paragraphRefactorService.refactor(text, refactorMode, 'markdown', undefined)
|
||||
incrementUsageAsync(userId, 'reformulate')
|
||||
|
||||
return NextResponse.json({ improved: result.refactored, original: result.original })
|
||||
}
|
||||
38
memento-note/app/api/mobile/ai/title/route.ts
Normal file
38
memento-note/app/api/mobile/ai/title/route.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { getMobileUserId } from '@/lib/mobile-auth'
|
||||
import { runLaneWithBillingUser } from '@/lib/ai/provider-for-user'
|
||||
import { getSystemConfig } from '@/lib/config'
|
||||
import { checkEntitlementOrThrow, QuotaExceededError, incrementUsageAsync } from '@/lib/entitlements'
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
const userId = getMobileUserId(req)
|
||||
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
|
||||
|
||||
const { content } = await req.json().catch(() => ({}))
|
||||
if (!content?.trim()) return NextResponse.json({ error: 'Contenu requis' }, { status: 400 })
|
||||
|
||||
const wordCount = content.split(/\s+/).length
|
||||
if (wordCount < 5) return NextResponse.json({ error: 'Contenu trop court (min 5 mots)' }, { status: 400 })
|
||||
|
||||
try {
|
||||
await checkEntitlementOrThrow(userId, 'auto_title')
|
||||
} catch (err) {
|
||||
if (err instanceof QuotaExceededError) {
|
||||
return NextResponse.json({ error: 'quota_exceeded' }, { status: 402 })
|
||||
}
|
||||
throw err
|
||||
}
|
||||
|
||||
const config = await getSystemConfig()
|
||||
const prompt = `Génère 3 titres concis pour ce texte. Réponds UNIQUEMENT avec un tableau JSON: [{"title":"titre1"},{"title":"titre2"},{"title":"titre3"}]\n\nTexte: ${content.slice(0, 400)}`
|
||||
|
||||
const { result: titles, usedByok } = await runLaneWithBillingUser(
|
||||
'tags',
|
||||
config,
|
||||
userId,
|
||||
(provider) => provider.generateTitles(prompt),
|
||||
)
|
||||
if (!usedByok) incrementUsageAsync(userId, 'auto_title')
|
||||
|
||||
return NextResponse.json({ suggestions: (titles ?? []).map((t: any) => t.title ?? t) })
|
||||
}
|
||||
40
memento-note/app/api/mobile/ai/transcribe/route.ts
Normal file
40
memento-note/app/api/mobile/ai/transcribe/route.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { getMobileUserId } from '@/lib/mobile-auth'
|
||||
import { getSystemConfig } from '@/lib/config'
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
const userId = getMobileUserId(req)
|
||||
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
|
||||
|
||||
const formData = await req.formData().catch(() => null)
|
||||
if (!formData) return NextResponse.json({ error: 'Fichier audio requis' }, { status: 400 })
|
||||
|
||||
const file = formData.get('audio')
|
||||
if (!file || !(file instanceof Blob)) {
|
||||
return NextResponse.json({ error: 'Fichier audio manquant' }, { status: 400 })
|
||||
}
|
||||
|
||||
const config = await getSystemConfig()
|
||||
const apiKey = config.OPENAI_API_KEY
|
||||
if (!apiKey) return NextResponse.json({ error: 'Service non disponible' }, { status: 503 })
|
||||
|
||||
const whisperForm = new FormData()
|
||||
whisperForm.append('file', file, 'audio.m4a')
|
||||
whisperForm.append('model', 'whisper-1')
|
||||
whisperForm.append('response_format', 'json')
|
||||
|
||||
const whisperRes = await fetch('https://api.openai.com/v1/audio/transcriptions', {
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${apiKey}` },
|
||||
body: whisperForm,
|
||||
})
|
||||
|
||||
if (!whisperRes.ok) {
|
||||
const err = await whisperRes.text()
|
||||
console.error('[mobile/ai/transcribe] Whisper error:', err)
|
||||
return NextResponse.json({ error: 'Erreur transcription' }, { status: 500 })
|
||||
}
|
||||
|
||||
const { text } = await whisperRes.json()
|
||||
return NextResponse.json({ text: text ?? '' })
|
||||
}
|
||||
37
memento-note/app/api/mobile/flashcards/decks/route.ts
Normal file
37
memento-note/app/api/mobile/flashcards/decks/route.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { getMobileUserId } from '@/lib/mobile-auth'
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
const userId = getMobileUserId(req)
|
||||
if (!userId) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
|
||||
|
||||
const now = new Date()
|
||||
const decks = await prisma.flashcardDeck.findMany({
|
||||
where: { userId },
|
||||
include: {
|
||||
notebook: { select: { name: true } },
|
||||
flashcards: {
|
||||
select: {
|
||||
id: true,
|
||||
interval: true,
|
||||
nextReviewAt: true,
|
||||
front: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
orderBy: { updatedAt: 'desc' },
|
||||
})
|
||||
|
||||
const result = decks.map((deck) => ({
|
||||
id: deck.id,
|
||||
name: deck.name,
|
||||
notebookId: deck.notebookId,
|
||||
notebookName: deck.notebook?.name ?? null,
|
||||
totalCards: deck.flashcards.length,
|
||||
dueCount: deck.flashcards.filter((c) => c.nextReviewAt <= now).length,
|
||||
masteredCount: deck.flashcards.filter((c) => c.interval >= 7).length,
|
||||
}))
|
||||
|
||||
return NextResponse.json({ decks: result })
|
||||
}
|
||||
84
memento-note/app/api/mobile/flashcards/generate/route.ts
Normal file
84
memento-note/app/api/mobile/flashcards/generate/route.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { getMobileUserId } from '@/lib/mobile-auth'
|
||||
import { generateFlashcardsFromNote, type FlashcardStyle } from '@/lib/flashcards/generate-flashcards'
|
||||
import { stripHtmlToText } from '@/lib/flashcards/deck-utils'
|
||||
import { checkEntitlementOrThrow, QuotaExceededError, incrementUsageAsync } from '@/lib/entitlements'
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
const userId = getMobileUserId(req)
|
||||
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
|
||||
|
||||
const body = await req.json().catch(() => ({}))
|
||||
const noteId = typeof body.noteId === 'string' ? body.noteId : null
|
||||
const count = typeof body.count === 'number' ? Math.min(body.count, 20) : 10
|
||||
const styleRaw = typeof body.style === 'string' ? body.style : 'qa'
|
||||
const style: FlashcardStyle = ['qa', 'cloze', 'concept'].includes(styleRaw) ? (styleRaw as FlashcardStyle) : 'qa'
|
||||
|
||||
if (!noteId) return NextResponse.json({ error: 'noteId requis' }, { status: 400 })
|
||||
|
||||
const note = await prisma.note.findFirst({
|
||||
where: { id: noteId, userId, trashedAt: null },
|
||||
select: { id: true, title: true, content: true, notebookId: true, language: true },
|
||||
})
|
||||
if (!note) return NextResponse.json({ error: 'Note introuvable' }, { status: 404 })
|
||||
|
||||
const textContent = stripHtmlToText(note.content)
|
||||
if (textContent.length < 80) {
|
||||
return NextResponse.json({ error: 'Contenu insuffisant pour générer des flashcards (minimum 80 caractères)' }, { status: 400 })
|
||||
}
|
||||
|
||||
try {
|
||||
await checkEntitlementOrThrow(userId, 'ai_flashcard')
|
||||
} catch (err) {
|
||||
if (err instanceof QuotaExceededError) {
|
||||
return NextResponse.json({ error: err.currentQuota === 0 ? 'Fonctionnalité non disponible sur votre abonnement' : 'Quota IA atteint' }, { status: 402 })
|
||||
}
|
||||
throw err
|
||||
}
|
||||
|
||||
const cards = await generateFlashcardsFromNote({
|
||||
title: note.title || 'Sans titre',
|
||||
textContent,
|
||||
count,
|
||||
style,
|
||||
language: note.language || undefined,
|
||||
})
|
||||
|
||||
if (cards.length === 0) {
|
||||
return NextResponse.json({ error: 'Génération échouée — aucune carte produite' }, { status: 500 })
|
||||
}
|
||||
|
||||
// Chercher un deck existant pour cette note, ou en créer un
|
||||
const existing = await prisma.flashcard.findFirst({
|
||||
where: { noteId: note.id, deck: { userId } },
|
||||
select: { deckId: true },
|
||||
})
|
||||
|
||||
let deckId: string
|
||||
if (existing) {
|
||||
deckId = existing.deckId
|
||||
// Supprimer les anciennes cartes pour les remplacer
|
||||
await prisma.flashcard.deleteMany({ where: { noteId: note.id, deckId } })
|
||||
} else {
|
||||
const deck = await prisma.flashcardDeck.create({
|
||||
data: { userId, notebookId: note.notebookId, name: note.title || 'Sans titre' },
|
||||
})
|
||||
deckId = deck.id
|
||||
}
|
||||
|
||||
await prisma.flashcard.createMany({
|
||||
data: cards.map((c) => ({
|
||||
deckId,
|
||||
noteId: note.id,
|
||||
front: c.front,
|
||||
back: c.back,
|
||||
type: c.type,
|
||||
})),
|
||||
})
|
||||
|
||||
await prisma.flashcardDeck.update({ where: { id: deckId }, data: { updatedAt: new Date() } })
|
||||
incrementUsageAsync(userId, 'ai_flashcard')
|
||||
|
||||
return NextResponse.json({ deckId, count: cards.length, cards })
|
||||
}
|
||||
40
memento-note/app/api/mobile/flashcards/review/route.ts
Normal file
40
memento-note/app/api/mobile/flashcards/review/route.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { getMobileUserId } from '@/lib/mobile-auth'
|
||||
import { computeSm2Update } from '@/lib/flashcards/sm2'
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
const userId = getMobileUserId(req)
|
||||
if (!userId) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
|
||||
|
||||
const body = await req.json()
|
||||
const cardId = typeof body.cardId === 'string' ? body.cardId : null
|
||||
const grade = typeof body.grade === 'number' ? body.grade : null
|
||||
|
||||
if (!cardId || grade === null || grade < 1 || grade > 4) {
|
||||
return NextResponse.json({ error: 'cardId and grade (1–4) required' }, { status: 400 })
|
||||
}
|
||||
|
||||
const card = await prisma.flashcard.findFirst({
|
||||
where: { id: cardId, deck: { userId } },
|
||||
select: { id: true, interval: true, easinessFactor: true },
|
||||
})
|
||||
if (!card) return NextResponse.json({ error: 'Card not found' }, { status: 404 })
|
||||
|
||||
const { easinessFactor, interval, nextReviewAt } = computeSm2Update(grade, {
|
||||
easinessFactor: card.easinessFactor,
|
||||
interval: card.interval,
|
||||
})
|
||||
|
||||
await prisma.$transaction([
|
||||
prisma.flashcard.update({
|
||||
where: { id: cardId },
|
||||
data: { easinessFactor, interval, nextReviewAt },
|
||||
}),
|
||||
prisma.flashcardReview.create({
|
||||
data: { cardId, grade, reviewedAt: new Date() },
|
||||
}),
|
||||
])
|
||||
|
||||
return NextResponse.json({ ok: true, nextReviewAt, interval })
|
||||
}
|
||||
38
memento-note/app/api/mobile/flashcards/session/route.ts
Normal file
38
memento-note/app/api/mobile/flashcards/session/route.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { getMobileUserId } from '@/lib/mobile-auth'
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
const userId = getMobileUserId(req)
|
||||
if (!userId) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
|
||||
|
||||
const { searchParams } = new URL(req.url)
|
||||
const deckId = searchParams.get('deckId')
|
||||
const limit = Math.min(parseInt(searchParams.get('limit') ?? '20', 10), 50)
|
||||
|
||||
if (!deckId) return NextResponse.json({ error: 'deckId required' }, { status: 400 })
|
||||
|
||||
// Vérifier ownership
|
||||
const deck = await prisma.flashcardDeck.findFirst({
|
||||
where: { id: deckId, userId },
|
||||
select: { id: true, name: true },
|
||||
})
|
||||
if (!deck) return NextResponse.json({ error: 'Deck not found' }, { status: 404 })
|
||||
|
||||
const now = new Date()
|
||||
const cards = await prisma.flashcard.findMany({
|
||||
where: { deckId, nextReviewAt: { lte: now } },
|
||||
select: {
|
||||
id: true,
|
||||
front: true,
|
||||
back: true,
|
||||
interval: true,
|
||||
easinessFactor: true,
|
||||
type: true,
|
||||
},
|
||||
orderBy: { nextReviewAt: 'asc' },
|
||||
take: limit,
|
||||
})
|
||||
|
||||
return NextResponse.json({ deck: { id: deck.id, name: deck.name }, cards })
|
||||
}
|
||||
@@ -28,3 +28,60 @@ export async function GET(
|
||||
|
||||
return NextResponse.json({ note })
|
||||
}
|
||||
|
||||
export async function PUT(
|
||||
req: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
const userId = getMobileUserId(req)
|
||||
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
|
||||
|
||||
const { id } = await params
|
||||
const { title, content } = await req.json().catch(() => ({}))
|
||||
|
||||
const existing = await prisma.note.findFirst({ where: { id, userId, trashedAt: null } })
|
||||
if (!existing) return NextResponse.json({ error: 'Note introuvable' }, { status: 404 })
|
||||
|
||||
const htmlContent = content !== undefined ? buildHtmlContent(content) : existing.content
|
||||
|
||||
const note = await prisma.note.update({
|
||||
where: { id },
|
||||
data: {
|
||||
...(title?.trim() ? { title: title.trim() } : {}),
|
||||
content: htmlContent,
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
select: { id: true, title: true, updatedAt: true },
|
||||
})
|
||||
|
||||
return NextResponse.json({ note })
|
||||
}
|
||||
|
||||
export async function DELETE(
|
||||
req: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
const userId = getMobileUserId(req)
|
||||
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
|
||||
|
||||
const { id } = await params
|
||||
const note = await prisma.note.findFirst({ where: { id, userId, trashedAt: null } })
|
||||
if (!note) return NextResponse.json({ error: 'Note introuvable' }, { status: 404 })
|
||||
|
||||
await prisma.note.update({ where: { id }, data: { trashedAt: new Date() } })
|
||||
return NextResponse.json({ ok: true })
|
||||
}
|
||||
|
||||
function buildHtmlContent(text: string): string {
|
||||
if (!text.trim()) return '<p></p>'
|
||||
if (text.trimStart().startsWith('<')) return text
|
||||
return text
|
||||
.split('\n')
|
||||
.map((line) => `<p>${line.trim() ? escapeHtml(line) : ''}</p>`)
|
||||
.join('')
|
||||
}
|
||||
|
||||
function escapeHtml(s: string) {
|
||||
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
||||
}
|
||||
|
||||
|
||||
59
memento-note/app/api/mobile/notes/daily/route.ts
Normal file
59
memento-note/app/api/mobile/notes/daily/route.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { getMobileUserId } from '@/lib/mobile-auth'
|
||||
|
||||
function getTodayKey(): string {
|
||||
return new Date().toISOString().slice(0, 10) // YYYY-MM-DD — clé de recherche interne
|
||||
}
|
||||
|
||||
function getTodayTitle(): string {
|
||||
return new Date().toLocaleDateString('fr-FR', {
|
||||
weekday: 'long', year: 'numeric', month: 'long', day: 'numeric',
|
||||
})
|
||||
// ex : "vendredi 29 mai 2026"
|
||||
}
|
||||
|
||||
function getTodayContent(title: string): string {
|
||||
// HTML simple lisible par la WebView mobile
|
||||
return `<h1>📅 ${title}</h1><p></p>`
|
||||
}
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
const userId = getMobileUserId(req)
|
||||
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
|
||||
|
||||
const todayKey = getTodayKey()
|
||||
const todayTitle = getTodayTitle()
|
||||
|
||||
// Chercher par clé ISO (titre interne) ou par titre lisible (migration)
|
||||
let note = await prisma.note.findFirst({
|
||||
where: {
|
||||
userId,
|
||||
type: 'daily',
|
||||
trashedAt: null,
|
||||
title: { in: [todayKey, todayTitle] },
|
||||
},
|
||||
})
|
||||
|
||||
if (!note) {
|
||||
note = await prisma.note.create({
|
||||
data: {
|
||||
userId,
|
||||
title: todayTitle,
|
||||
content: getTodayContent(todayTitle),
|
||||
type: 'daily',
|
||||
color: '#FEF9C3',
|
||||
labels: JSON.stringify(['daily']),
|
||||
},
|
||||
})
|
||||
} else if (note.title === todayKey) {
|
||||
// Migrer l'ancien titre ISO → titre lisible
|
||||
const htmlContent = getTodayContent(todayTitle)
|
||||
note = await prisma.note.update({
|
||||
where: { id: note.id },
|
||||
data: { title: todayTitle, content: htmlContent },
|
||||
})
|
||||
}
|
||||
|
||||
return NextResponse.json({ id: note.id, note })
|
||||
}
|
||||
@@ -41,3 +41,43 @@ export async function GET(req: NextRequest) {
|
||||
...(notebookName ? { notebookName } : {}),
|
||||
})
|
||||
}
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
const userId = getMobileUserId(req)
|
||||
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
|
||||
|
||||
const { title, content, notebookId } = await req.json().catch(() => ({}))
|
||||
if (!title?.trim()) return NextResponse.json({ error: 'Titre requis' }, { status: 400 })
|
||||
|
||||
// Convertir le texte brut en HTML TipTap simple si nécessaire
|
||||
const htmlContent = buildHtmlContent(content ?? '')
|
||||
|
||||
const note = await prisma.note.create({
|
||||
data: {
|
||||
userId,
|
||||
title: title.trim(),
|
||||
content: htmlContent,
|
||||
type: 'richtext',
|
||||
...(notebookId ? { notebookId } : {}),
|
||||
},
|
||||
select: { id: true, title: true, updatedAt: true },
|
||||
})
|
||||
|
||||
return NextResponse.json({ note }, { status: 201 })
|
||||
}
|
||||
|
||||
/** Convertit du texte brut multiligne en paragraphes HTML TipTap */
|
||||
function buildHtmlContent(text: string): string {
|
||||
if (!text.trim()) return '<p></p>'
|
||||
// Si déjà du HTML, retourner tel quel
|
||||
if (text.trimStart().startsWith('<')) return text
|
||||
return text
|
||||
.split('\n')
|
||||
.map((line) => `<p>${line.trim() ? escapeHtml(line) : ''}</p>`)
|
||||
.join('')
|
||||
}
|
||||
|
||||
function escapeHtml(s: string) {
|
||||
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
||||
}
|
||||
|
||||
|
||||
@@ -1140,16 +1140,6 @@ html.font-system * {
|
||||
color: #60a5fa;
|
||||
}
|
||||
|
||||
.block-action-item:first-child:hover {
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
.dark .block-action-item:first-child:hover {
|
||||
background: rgba(239, 68, 68, 0.2);
|
||||
color: #f87171;
|
||||
}
|
||||
|
||||
.smart-paste-menu {
|
||||
min-width: 240px;
|
||||
padding: 8px 4px 4px;
|
||||
@@ -1188,6 +1178,21 @@ html.font-system * {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Danger item (Supprimer) */
|
||||
.block-action-item--danger:hover {
|
||||
background: rgba(239, 68, 68, 0.1) !important;
|
||||
color: #ef4444 !important;
|
||||
}
|
||||
.dark .block-action-item--danger:hover {
|
||||
background: rgba(239, 68, 68, 0.2) !important;
|
||||
color: #f87171 !important;
|
||||
}
|
||||
|
||||
/* Wrap du sous-menu pour maintenir le hover */
|
||||
.block-action-submenu-wrap {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.block-action-submenu {
|
||||
position: absolute;
|
||||
left: 100%;
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
Trash2, Copy, Repeat, Link, ChevronRight,
|
||||
Heading1, Heading2, Heading3, List, ListOrdered,
|
||||
CheckSquare, Quote, CodeXml, Database,
|
||||
ArrowUp, ArrowDown, AlignLeft, ClipboardCopy,
|
||||
} from 'lucide-react'
|
||||
import { replaceBlockWithStructuredView } from '@/components/tiptap-structured-view-block-extension'
|
||||
|
||||
@@ -28,6 +29,7 @@ interface BlockActionMenuProps {
|
||||
}
|
||||
|
||||
type TurnIntoType =
|
||||
| 'paragraph'
|
||||
| 'heading1' | 'heading2' | 'heading3'
|
||||
| 'bulletList' | 'orderedList' | 'taskList'
|
||||
| 'blockquote' | 'codeBlock' | 'database'
|
||||
@@ -39,24 +41,39 @@ interface TurnIntoOption {
|
||||
isDatabase?: boolean
|
||||
}
|
||||
|
||||
const TURN_INTO_OPTIONS: TurnIntoOption[] = [
|
||||
{ id: 'heading1', icon: Heading1, command: (e) => e.chain().focus().toggleHeading({ level: 1 }).run() },
|
||||
{ id: 'heading2', icon: Heading2, command: (e) => e.chain().focus().toggleHeading({ level: 2 }).run() },
|
||||
{ id: 'heading3', icon: Heading3, command: (e) => e.chain().focus().toggleHeading({ level: 3 }).run() },
|
||||
{ id: 'bulletList', icon: List, command: (e) => e.chain().focus().toggleBulletList().run() },
|
||||
{ id: 'orderedList', icon: ListOrdered, command: (e) => e.chain().focus().toggleOrderedList().run() },
|
||||
{ id: 'taskList', icon: CheckSquare, command: (e) => e.chain().focus().toggleTaskList().run() },
|
||||
{ id: 'blockquote', icon: Quote, command: (e) => e.chain().focus().toggleBlockquote().run() },
|
||||
{ id: 'codeBlock', icon: CodeXml, command: (e) => e.chain().focus().toggleCodeBlock().run() },
|
||||
{ id: 'database', icon: Database, isDatabase: true },
|
||||
]
|
||||
|
||||
/** Positionne le curseur dans le bloc avant d'appliquer une transformation */
|
||||
function focusBlock(editor: Editor, blockPos: number) {
|
||||
const docSize = editor.state.doc.content.size
|
||||
const cursorPos = Math.min(blockPos + 1, docSize)
|
||||
editor.chain().focus().setTextSelection(cursorPos).run()
|
||||
}
|
||||
|
||||
/**
|
||||
* Applique une transformation en passant d'abord par paragraphe.
|
||||
* Ceci corrige le cas heading → liste / blockquote / codeBlock qui échoue
|
||||
* avec un toggle direct.
|
||||
*/
|
||||
function makeTurnCommand(cmd: (e: Editor) => void): (e: Editor) => void {
|
||||
return (editor: Editor) => {
|
||||
// clearNodes remet en paragraphe sans perte de texte
|
||||
editor.chain().focus().clearNodes().run()
|
||||
cmd(editor)
|
||||
}
|
||||
}
|
||||
|
||||
const TURN_INTO_OPTIONS: TurnIntoOption[] = [
|
||||
{ id: 'paragraph', icon: AlignLeft, command: (e) => e.chain().focus().clearNodes().run() },
|
||||
{ id: 'heading1', icon: Heading1, command: (e) => e.chain().focus().clearNodes().toggleHeading({ level: 1 }).run() },
|
||||
{ id: 'heading2', icon: Heading2, command: (e) => e.chain().focus().clearNodes().toggleHeading({ level: 2 }).run() },
|
||||
{ id: 'heading3', icon: Heading3, command: (e) => e.chain().focus().clearNodes().toggleHeading({ level: 3 }).run() },
|
||||
{ id: 'bulletList', icon: List, command: makeTurnCommand((e) => e.chain().focus().toggleBulletList().run()) },
|
||||
{ id: 'orderedList', icon: ListOrdered, command: makeTurnCommand((e) => e.chain().focus().toggleOrderedList().run()) },
|
||||
{ id: 'taskList', icon: CheckSquare, command: makeTurnCommand((e) => e.chain().focus().toggleTaskList().run()) },
|
||||
{ id: 'blockquote', icon: Quote, command: makeTurnCommand((e) => e.chain().focus().toggleBlockquote().run()) },
|
||||
{ id: 'codeBlock', icon: CodeXml, command: makeTurnCommand((e) => e.chain().focus().toggleCodeBlock().run()) },
|
||||
{ id: 'database', icon: Database, isDatabase: true },
|
||||
]
|
||||
|
||||
function getBlockPlainContent(editor: Editor, blockPos: number, blockNode: PMNode | null): string {
|
||||
const node = blockNode ?? (blockPos >= 0 ? editor.state.doc.nodeAt(blockPos) : null)
|
||||
if (!node || blockPos < 0) return ''
|
||||
@@ -68,6 +85,47 @@ function getBlockPlainContent(editor: Editor, blockPos: number, blockNode: PMNod
|
||||
return node.textContent?.trim() ?? ''
|
||||
}
|
||||
|
||||
/** Déplace un bloc vers le haut (échange avec le frère précédent) */
|
||||
function moveBlockUp(editor: Editor, blockPos: number, blockNode: PMNode): boolean {
|
||||
const { doc } = editor.state
|
||||
let prevPos = -1
|
||||
let prevNode: PMNode | null = null
|
||||
doc.forEach((node, offset) => {
|
||||
if (offset + node.nodeSize === blockPos) {
|
||||
prevPos = offset
|
||||
prevNode = node
|
||||
}
|
||||
})
|
||||
if (prevPos < 0 || !prevNode) return false
|
||||
const safePrev = prevNode as PMNode
|
||||
const tr = editor.state.tr
|
||||
const from = prevPos
|
||||
const to = blockPos + blockNode.nodeSize
|
||||
tr.replaceWith(from, to, [blockNode.copy(blockNode.content), safePrev.copy(safePrev.content)])
|
||||
editor.view.dispatch(tr)
|
||||
// Repositionne le curseur dans le bloc déplacé (maintenant à prevPos)
|
||||
const docSize = editor.state.doc.content.size
|
||||
editor.chain().focus().setTextSelection(Math.min(prevPos + 1, docSize)).run()
|
||||
return true
|
||||
}
|
||||
|
||||
/** Déplace un bloc vers le bas (échange avec le frère suivant) */
|
||||
function moveBlockDown(editor: Editor, blockPos: number, blockNode: PMNode): boolean {
|
||||
const { doc } = editor.state
|
||||
const nextPos = blockPos + blockNode.nodeSize
|
||||
const nextNode = doc.nodeAt(nextPos)
|
||||
if (!nextNode) return false
|
||||
const tr = editor.state.tr
|
||||
const from = blockPos
|
||||
const to = nextPos + nextNode.nodeSize
|
||||
tr.replaceWith(from, to, [nextNode.copy(nextNode.content), blockNode.copy(blockNode.content)])
|
||||
editor.view.dispatch(tr)
|
||||
const newPos = blockPos + nextNode.nodeSize
|
||||
const docSize = editor.state.doc.content.size
|
||||
editor.chain().focus().setTextSelection(Math.min(newPos + 1, docSize)).run()
|
||||
return true
|
||||
}
|
||||
|
||||
export function BlockActionMenu({
|
||||
editor,
|
||||
onClose,
|
||||
@@ -81,6 +139,7 @@ export function BlockActionMenu({
|
||||
const { t } = useLanguage()
|
||||
const menuRef = useRef<HTMLDivElement>(null)
|
||||
const [showTurnInto, setShowTurnInto] = useState(false)
|
||||
const hoverTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
|
||||
const handleDelete = useCallback(() => {
|
||||
if (blockNode && blockPos >= 0) {
|
||||
@@ -92,32 +151,52 @@ export function BlockActionMenu({
|
||||
const handleDuplicate = useCallback(() => {
|
||||
if (blockNode && blockPos >= 0) {
|
||||
const insertPos = blockPos + blockNode.nodeSize
|
||||
editor.view.dispatch(
|
||||
editor.state.tr.insert(insertPos, blockNode.copy())
|
||||
)
|
||||
editor.view.dispatch(editor.state.tr.insert(insertPos, blockNode.copy()))
|
||||
editor.commands.focus()
|
||||
}
|
||||
onClose()
|
||||
}, [editor, blockNode, blockPos, onClose])
|
||||
|
||||
const handleMoveUp = useCallback(() => {
|
||||
if (blockNode && blockPos >= 0) {
|
||||
const ok = moveBlockUp(editor, blockPos, blockNode)
|
||||
if (!ok) toast(t('blockAction.moveUpFirst'))
|
||||
}
|
||||
onClose()
|
||||
}, [editor, blockNode, blockPos, onClose, t])
|
||||
|
||||
const handleMoveDown = useCallback(() => {
|
||||
if (blockNode && blockPos >= 0) {
|
||||
const ok = moveBlockDown(editor, blockPos, blockNode)
|
||||
if (!ok) toast(t('blockAction.moveDownLast'))
|
||||
}
|
||||
onClose()
|
||||
}, [editor, blockNode, blockPos, onClose, t])
|
||||
|
||||
const handleCopyContent = useCallback(async () => {
|
||||
const text = getBlockPlainContent(editor, blockPos, blockNode)
|
||||
if (!text) { toast(t('blockAction.emptyBlock')); onClose(); return }
|
||||
const ok = await copyTextToClipboard(text)
|
||||
if (ok) toast.success(t('blockAction.contentCopied'))
|
||||
else toast.error(t('blockAction.copyRefFailed'))
|
||||
onClose()
|
||||
}, [editor, blockPos, blockNode, onClose, t])
|
||||
|
||||
const handleCopyRef = useCallback(async () => {
|
||||
if (!noteId?.trim()) {
|
||||
toast.error(t('blockAction.copyRefNoNote'))
|
||||
onClose()
|
||||
return
|
||||
}
|
||||
|
||||
const blockId = ensureBlockReferenceId(editor, blockPos, blockNode)
|
||||
if (!blockId) {
|
||||
toast.error(t('blockAction.copyRefUnsupported'))
|
||||
onClose()
|
||||
return
|
||||
}
|
||||
|
||||
const html = editor.getHTML()
|
||||
const blockContent = getBlockPlainContent(editor, blockPos, blockNode)
|
||||
onBlockReferenceCopied?.(html)
|
||||
|
||||
const ref = `${window.location.origin}/home?openNote=${encodeURIComponent(noteId)}#block-${encodeURIComponent(blockId)}`
|
||||
const copied = await copyTextToClipboard(ref)
|
||||
if (copied) {
|
||||
@@ -143,6 +222,19 @@ export function BlockActionMenu({
|
||||
onClose()
|
||||
}, [editor, blockNode, blockPos, onClose])
|
||||
|
||||
const handleTurnIntoEnter = useCallback(() => {
|
||||
if (hoverTimerRef.current) clearTimeout(hoverTimerRef.current)
|
||||
setShowTurnInto(true)
|
||||
}, [])
|
||||
|
||||
const handleTurnIntoLeave = useCallback(() => {
|
||||
hoverTimerRef.current = setTimeout(() => setShowTurnInto(false), 200)
|
||||
}, [])
|
||||
|
||||
const handleSubmenuEnter = useCallback(() => {
|
||||
if (hoverTimerRef.current) clearTimeout(hoverTimerRef.current)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
function handleClickOutside(e: MouseEvent) {
|
||||
if (menuRef.current && !menuRef.current.contains(e.target as Node)) {
|
||||
@@ -157,68 +249,89 @@ export function BlockActionMenu({
|
||||
return () => {
|
||||
document.removeEventListener('mousedown', handleClickOutside)
|
||||
document.removeEventListener('keydown', handleKeyDown)
|
||||
if (hoverTimerRef.current) clearTimeout(hoverTimerRef.current)
|
||||
}
|
||||
}, [onClose])
|
||||
|
||||
const menuLeft = anchorRect.right + 6
|
||||
const menuTop = anchorRect.top - 4
|
||||
|
||||
const menuStyle: React.CSSProperties = {
|
||||
position: 'fixed',
|
||||
left: anchorRect.right + 6,
|
||||
top: anchorRect.top - 4,
|
||||
left: menuLeft > window.innerWidth - 230 ? anchorRect.left - 215 : menuLeft,
|
||||
top: menuTop + 320 > window.innerHeight ? window.innerHeight - 330 : menuTop,
|
||||
zIndex: 9999,
|
||||
}
|
||||
|
||||
if (Number(menuStyle.left) > window.innerWidth - 220) {
|
||||
menuStyle.left = anchorRect.left - 210
|
||||
}
|
||||
if (Number(menuStyle.top) + 300 > window.innerHeight) {
|
||||
menuStyle.top = window.innerHeight - 310
|
||||
}
|
||||
|
||||
return createPortal(
|
||||
<div ref={menuRef} style={menuStyle} className="block-action-menu">
|
||||
<button type="button" className="block-action-item" onClick={handleDelete}>
|
||||
<Trash2 size={16} />
|
||||
<span>{t('blockAction.delete')}</span>
|
||||
{/* Actions de déplacement */}
|
||||
<button type="button" className="block-action-item" onClick={handleMoveUp}>
|
||||
<ArrowUp size={16} />
|
||||
<span>{t('blockAction.moveUp')}</span>
|
||||
</button>
|
||||
<button type="button" className="block-action-item" onClick={handleMoveDown}>
|
||||
<ArrowDown size={16} />
|
||||
<span>{t('blockAction.moveDown')}</span>
|
||||
</button>
|
||||
|
||||
<div className="block-action-separator" />
|
||||
|
||||
{/* Transformer en */}
|
||||
<div
|
||||
className="block-action-submenu-wrap"
|
||||
onMouseLeave={handleTurnIntoLeave}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
className="block-action-item block-action-submenu-trigger"
|
||||
onClick={() => setShowTurnInto((v) => !v)}
|
||||
onMouseEnter={handleTurnIntoEnter}
|
||||
>
|
||||
<Repeat size={16} />
|
||||
<span>{t('blockAction.turnInto')}</span>
|
||||
<ChevronRight size={14} className="ml-auto" />
|
||||
</button>
|
||||
|
||||
{showTurnInto && (
|
||||
<div className="block-action-submenu" onMouseEnter={handleSubmenuEnter}>
|
||||
{TURN_INTO_OPTIONS.map((opt) => (
|
||||
<button
|
||||
key={opt.id}
|
||||
type="button"
|
||||
className="block-action-item"
|
||||
onClick={() => handleTurnInto(opt)}
|
||||
>
|
||||
<opt.icon size={16} />
|
||||
<span>{t(`blockAction.turnInto_${opt.id}`)}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="block-action-separator" />
|
||||
|
||||
{/* Copier */}
|
||||
<button type="button" className="block-action-item" onClick={() => { void handleCopyContent() }}>
|
||||
<ClipboardCopy size={16} />
|
||||
<span>{t('blockAction.copyContent')}</span>
|
||||
</button>
|
||||
<button type="button" className="block-action-item" onClick={() => { void handleCopyRef() }}>
|
||||
<Link size={16} />
|
||||
<span>{t('blockAction.copyRef')}</span>
|
||||
</button>
|
||||
|
||||
<div className="block-action-separator" />
|
||||
|
||||
{/* Actions destructives */}
|
||||
<button type="button" className="block-action-item" onClick={handleDuplicate}>
|
||||
<Copy size={16} />
|
||||
<span>{t('blockAction.duplicate')}</span>
|
||||
</button>
|
||||
|
||||
<div className="block-action-separator" />
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="block-action-item block-action-submenu-trigger"
|
||||
onClick={() => setShowTurnInto(!showTurnInto)}
|
||||
onMouseEnter={() => setShowTurnInto(true)}
|
||||
>
|
||||
<Repeat size={16} />
|
||||
<span>{t('blockAction.turnInto')}</span>
|
||||
<ChevronRight size={14} className="ml-auto" />
|
||||
</button>
|
||||
|
||||
{showTurnInto && (
|
||||
<div className="block-action-submenu">
|
||||
{TURN_INTO_OPTIONS.map((opt) => (
|
||||
<button
|
||||
key={opt.id}
|
||||
type="button"
|
||||
className="block-action-item"
|
||||
onClick={() => handleTurnInto(opt)}
|
||||
>
|
||||
<opt.icon size={16} />
|
||||
<span>{t(`blockAction.turnInto_${opt.id}`)}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="block-action-separator" />
|
||||
|
||||
<button type="button" className="block-action-item" onClick={() => { void handleCopyRef() }}>
|
||||
<Link size={16} />
|
||||
<span>{t('blockAction.copyRef')}</span>
|
||||
<button type="button" className="block-action-item block-action-item--danger" onClick={handleDelete}>
|
||||
<Trash2 size={16} />
|
||||
<span>{t('blockAction.delete')}</span>
|
||||
</button>
|
||||
</div>,
|
||||
document.body
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
Calendar,
|
||||
Plus,
|
||||
BarChart3,
|
||||
Loader2,
|
||||
BookOpen,
|
||||
@@ -78,8 +77,7 @@ function shuffleCards<T>(items: T[]): T[] {
|
||||
}
|
||||
|
||||
function buildSessionQueue(cards: FlashcardItem[], dueOnly: boolean): FlashcardItem[] {
|
||||
let toReview = dueOnly ? cards.filter((c) => c.due) : cards
|
||||
if (toReview.length === 0) toReview = cards
|
||||
const toReview = dueOnly ? cards.filter((c) => c.due) : cards
|
||||
return shuffleCards(toReview)
|
||||
}
|
||||
|
||||
@@ -316,8 +314,6 @@ export function RevisionView() {
|
||||
const [sessionDurationSeconds, setSessionDurationSeconds] = useState(0)
|
||||
const sessionTimerRef = useRef<ReturnType<typeof setInterval> | null>(null)
|
||||
|
||||
const [newDeckName, setNewDeckName] = useState('')
|
||||
const [creatingDeck, setCreatingDeck] = useState(false)
|
||||
|
||||
// Gap 8 — deck deletion state
|
||||
const [deletingDeckId, setDeletingDeckId] = useState<string | null>(null)
|
||||
@@ -402,6 +398,17 @@ export function RevisionView() {
|
||||
return
|
||||
}
|
||||
const shuffled = buildSessionQueue(cardsInput, mode === 'due')
|
||||
// Mode "due" mais aucune carte n'est due → afficher état "à jour" directement
|
||||
if (shuffled.length === 0) {
|
||||
setSessionCards([])
|
||||
setCurrentIndex(0)
|
||||
setIsFlipped(false)
|
||||
setSessionGrades({})
|
||||
setIsSessionActive(true)
|
||||
setIsSessionFinished(true)
|
||||
setActiveDeckId(deckId)
|
||||
return
|
||||
}
|
||||
setSessionCards(shuffled)
|
||||
setCurrentIndex(0)
|
||||
setIsFlipped(false)
|
||||
@@ -561,27 +568,6 @@ export function RevisionView() {
|
||||
}
|
||||
}
|
||||
|
||||
const createDeck = async () => {
|
||||
const name = newDeckName.trim()
|
||||
if (!name) return
|
||||
setCreatingDeck(true)
|
||||
try {
|
||||
const res = await fetch('/api/flashcards/decks', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name }),
|
||||
})
|
||||
const data = await res.json()
|
||||
if (res.ok) {
|
||||
setNewDeckName('')
|
||||
await loadDecks()
|
||||
toast.success(t('flashcards.deckCreated'))
|
||||
if (data.deck?.id) setActiveDeckId(data.deck.id)
|
||||
}
|
||||
} finally {
|
||||
setCreatingDeck(false)
|
||||
}
|
||||
}
|
||||
|
||||
// Gap 8 — delete a deck
|
||||
const handleDeleteDeck = async (deckId: string) => {
|
||||
@@ -910,24 +896,6 @@ export function RevisionView() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex flex-wrap gap-2 items-center">
|
||||
<input
|
||||
value={newDeckName}
|
||||
onChange={(e) => setNewDeckName(e.target.value)}
|
||||
onKeyDown={(e) => { if (e.key === 'Enter') void createDeck() }}
|
||||
placeholder={t('flashcards.newDeckPlaceholder')}
|
||||
className="flex-1 min-w-[180px] px-3 py-2 rounded-lg border border-border text-sm bg-transparent"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={createDeck}
|
||||
disabled={creatingDeck || !newDeckName.trim()}
|
||||
className="px-3 py-2 rounded-lg border border-border text-xs font-bold flex items-center gap-1 disabled:opacity-50"
|
||||
>
|
||||
{creatingDeck ? <Loader2 size={14} className="animate-spin" /> : <Plus size={14} />}
|
||||
{t('flashcards.createDeck')}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{loadingDecks ? (
|
||||
<div className="flex justify-center py-16"><Loader2 className="animate-spin text-concrete" /></div>
|
||||
|
||||
@@ -173,7 +173,6 @@ export function HomeClient({
|
||||
const detail = (e as CustomEvent<{ layout?: NotesLayoutMode }>).detail?.layout
|
||||
if (detail === 'grid' || detail === 'list' || detail === 'table' || detail === 'kanban') {
|
||||
setLayoutMode(detail)
|
||||
setViewType('notes')
|
||||
}
|
||||
}
|
||||
window.addEventListener('memento-notes-layout-change', onLayoutChange)
|
||||
@@ -411,7 +410,6 @@ export function HomeClient({
|
||||
const selectLayoutMode = useCallback((mode: NotesLayoutMode) => {
|
||||
if (mode === 'gallery') return
|
||||
setLayoutMode(mode)
|
||||
setViewType('notes')
|
||||
}, [])
|
||||
|
||||
const showStructuredIntro =
|
||||
|
||||
@@ -2867,5 +2867,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -2867,5 +2867,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -3378,7 +3378,15 @@
|
||||
"blockAction": {
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_paragraph": "Text",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
|
||||
@@ -2867,5 +2867,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -2906,5 +2906,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -3382,7 +3382,15 @@
|
||||
"blockAction": {
|
||||
"delete": "Supprimer",
|
||||
"duplicate": "Dupliquer",
|
||||
"moveUp": "Monter le bloc",
|
||||
"moveDown": "Descendre le bloc",
|
||||
"moveUpFirst": "C'est déjà le premier bloc",
|
||||
"moveDownLast": "C'est déjà le dernier bloc",
|
||||
"copyContent": "Copier le contenu",
|
||||
"contentCopied": "Contenu copié !",
|
||||
"emptyBlock": "Ce bloc est vide",
|
||||
"turnInto": "Transformer en",
|
||||
"turnInto_paragraph": "Texte",
|
||||
"turnInto_heading1": "Titre 1",
|
||||
"turnInto_heading2": "Titre 2",
|
||||
"turnInto_heading3": "Titre 3",
|
||||
|
||||
@@ -2867,5 +2867,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -2867,5 +2867,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -2867,5 +2867,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -2867,5 +2867,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -2867,5 +2867,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -2867,5 +2867,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -2867,5 +2867,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -2867,5 +2867,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -2867,5 +2867,32 @@
|
||||
"hint_insights_bridge_desc": "Bridge notes connect multiple clusters. They are highlighted because they hold your knowledge graph together.",
|
||||
"hint_insights_refresh_title": "Refresh clusters",
|
||||
"hint_insights_refresh_desc": "If you've added new notes, click the refresh button to recalculate the clusters with the latest content."
|
||||
},
|
||||
"blockAction": {
|
||||
"moveUp": "Move block up",
|
||||
"moveDown": "Move block down",
|
||||
"moveUpFirst": "This is already the first block",
|
||||
"moveDownLast": "This is already the last block",
|
||||
"copyContent": "Copy content",
|
||||
"contentCopied": "Content copied!",
|
||||
"emptyBlock": "This block is empty",
|
||||
"turnInto_paragraph": "Text",
|
||||
"delete": "Delete",
|
||||
"duplicate": "Duplicate",
|
||||
"turnInto": "Turn into",
|
||||
"turnInto_heading1": "Heading 1",
|
||||
"turnInto_heading2": "Heading 2",
|
||||
"turnInto_heading3": "Heading 3",
|
||||
"turnInto_bulletList": "Bullet List",
|
||||
"turnInto_orderedList": "Numbered List",
|
||||
"turnInto_taskList": "Task List",
|
||||
"turnInto_blockquote": "Quote",
|
||||
"turnInto_codeBlock": "Code Block",
|
||||
"turnInto_database": "Inline database",
|
||||
"copyRef": "Copy block reference",
|
||||
"copied": "Reference copied!",
|
||||
"copyRefFailed": "Could not copy block reference",
|
||||
"copyRefNoNote": "Save the note before copying a block reference",
|
||||
"copyRefUnsupported": "This block type cannot be referenced yet"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Drop unique constraint on notebookId to allow multiple decks per notebook (one per note)
|
||||
DROP INDEX IF EXISTS "FlashcardDeck_notebookId_key";
|
||||
@@ -114,7 +114,7 @@ model Notebook {
|
||||
children Notebook[] @relation("NotebookTree")
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
workflows Workflow[]
|
||||
flashcardDeck FlashcardDeck?
|
||||
flashcardDecks FlashcardDeck[]
|
||||
schema NotebookSchema?
|
||||
|
||||
@@index([userId, order])
|
||||
@@ -905,7 +905,7 @@ model NoteProperty {
|
||||
model FlashcardDeck {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
notebookId String? @unique
|
||||
notebookId String?
|
||||
name String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
Reference in New Issue
Block a user