diff --git a/memento-note/components/brainstorm/brainstorm-page.tsx b/memento-note/components/brainstorm/brainstorm-page.tsx index 1b7e095..40560c3 100644 --- a/memento-note/components/brainstorm/brainstorm-page.tsx +++ b/memento-note/components/brainstorm/brainstorm-page.tsx @@ -1,5 +1,6 @@ 'use client' import { toast } from 'sonner' +import { useNotebooks } from '@/context/notebooks-context' import React, { useState, useMemo, useEffect, useRef, useCallback } from 'react' import { useRouter, useSearchParams } from 'next/navigation' @@ -80,12 +81,14 @@ const WAVE_COLORS: Record export function BrainstormPage() { const router = useRouter() const peek = useNotePeek() + const { notebooks } = useNotebooks() const searchParams = useSearchParams() const { t, language } = useLanguage() const { data: authSession } = useSession() const urlSessionId = searchParams.get('session') const urlSeed = searchParams.get('seed') const urlSourceNoteId = searchParams.get('sourceNoteId') + const urlNotebookId = searchParams.get('notebookId') const urlInviteToken = searchParams.get('invite') const [seedInput, setSeedInput] = useState('') @@ -242,17 +245,25 @@ export function BrainstormPage() { } catch {} } - const handleConvert = async (idea: BrainstormIdea) => { + const handleConvert = async (idea: BrainstormIdea, targetNotebookId: string | null = urlNotebookId) => { try { - const result = await convertIdea.mutateAsync({ ideaId: idea.id, notebookId: null }) + const result = await convertIdea.mutateAsync({ ideaId: idea.id, notebookId: targetNotebookId }) if (result?.id) { + let nbName = 'carnet' + if (result.notebookId) { + const nb = notebooks.find(n => n.id === result.notebookId) + nbName = nb?.name || 'carnet' + } toast.success(t('brainstorm.noteCreatedIn') || 'Note created', { - description: result.title || idea.title, + description: `${result.title || idea.title} → 📁 ${nbName}`, action: { - label: t('notePeek.openFully') || 'Open', - onClick: () => router.push(`/home?openNote=${result.id}`), + label: t('brainstorm.openNotebook') || 'Open notebook', + onClick: () => { + if (result.notebookId) router.push(`/home?notebook=${result.notebookId}`) + else router.push('/home') + }, }, - duration: 10000, + duration: 15000, }) peek.open(result.id) } diff --git a/memento-note/components/note-peek/note-peek-panel.tsx b/memento-note/components/note-peek/note-peek-panel.tsx index edcee0f..55686f9 100644 --- a/memento-note/components/note-peek/note-peek-panel.tsx +++ b/memento-note/components/note-peek/note-peek-panel.tsx @@ -2,7 +2,7 @@ import { type ReactNode } from 'react' import { motion, AnimatePresence, useReducedMotion } from 'motion/react' -import { X, Maximize2, Loader2 } from 'lucide-react' +import { X, Maximize2, Loader2, FolderOpen } from 'lucide-react' import { useLanguage } from '@/lib/i18n' import type { Note } from '@/lib/types' import { NotePeekContent } from './note-peek-content' @@ -77,6 +77,15 @@ export function NotePeekPanel({ renderContent(note, blockId) ) : ( <> + {note.notebookId && ( + + + {t('brainstorm.openNotebook') || 'Open notebook'} + + )}

{note.title || t('notePeek.untitled') || 'Untitled'}

diff --git a/memento-note/locales/en.json b/memento-note/locales/en.json index b4ecd00..95e2cd2 100644 --- a/memento-note/locales/en.json +++ b/memento-note/locales/en.json @@ -3076,7 +3076,8 @@ "noNotebook": "No notebook", "launching": "Launching…", "launch": "Brainstorm", - "noteCreatedIn": "Note created in" + "noteCreatedIn": "Note created in", + "openNotebook": "Open notebook" }, "byokSettings": { "title": "Your API keys (BYOK)", diff --git a/memento-note/locales/fr.json b/memento-note/locales/fr.json index cde8ce0..0e97217 100644 --- a/memento-note/locales/fr.json +++ b/memento-note/locales/fr.json @@ -3080,7 +3080,8 @@ "noNotebook": "Aucun carnet", "launching": "Lancement…", "launch": "Brainstormer", - "noteCreatedIn": "Note créée dans" + "noteCreatedIn": "Note créée dans", + "openNotebook": "Ouvrir le carnet" }, "byokSettings": { "title": "Vos clés API (BYOK)",