feat(insights): fix DBSCAN, Persian embeddings crash, D3 physics layouts, and D3 node not found runtime error
This commit is contained in:
@@ -7,12 +7,17 @@ import { useLanguage } from '@/lib/i18n'
|
||||
import { useAiConsent } from '@/components/legal/ai-consent-provider'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { toast } from 'sonner'
|
||||
import { resolveTitleDirection, resolveTitleLang } from '@/lib/clip/rtl-content'
|
||||
|
||||
export function NoteTitleBlock() {
|
||||
const { state, actions, readOnly, fullPage } = useNoteEditorContext()
|
||||
const { note, state, actions, readOnly, fullPage } = useNoteEditorContext()
|
||||
const { t } = useLanguage()
|
||||
const { requestAiConsent } = useAiConsent()
|
||||
|
||||
const titleDir = resolveTitleDirection(state.title || '', note.sourceUrl)
|
||||
const titleLang = resolveTitleLang(state.title || '', note.sourceUrl)
|
||||
const titleIsRtl = titleDir === 'rtl'
|
||||
|
||||
if (fullPage) {
|
||||
// Adaptive font size: short = big editorial, long = smaller but still premium
|
||||
const titleLen = (state.title || '').length
|
||||
@@ -28,7 +33,8 @@ export function NoteTitleBlock() {
|
||||
{/* Title — auto-resizing textarea, adaptive size */}
|
||||
<div className="group relative">
|
||||
<textarea
|
||||
dir="auto"
|
||||
dir={titleDir}
|
||||
lang={titleLang}
|
||||
rows={1}
|
||||
placeholder={t('notes.titlePlaceholder') || 'Untitled…'}
|
||||
value={state.title}
|
||||
@@ -40,11 +46,14 @@ export function NoteTitleBlock() {
|
||||
}}
|
||||
disabled={readOnly}
|
||||
className={cn(
|
||||
'w-full font-memento-serif font-bold border-0 outline-none px-0 bg-transparent text-foreground',
|
||||
'w-full font-bold border-0 outline-none px-0 bg-transparent text-foreground',
|
||||
titleIsRtl
|
||||
? 'font-[family-name:var(--font-sans)] text-right'
|
||||
: 'font-memento-serif text-left',
|
||||
'leading-[1.15] tracking-tight',
|
||||
'placeholder:text-foreground/20 resize-none overflow-hidden',
|
||||
titleSizeClass,
|
||||
!readOnly && 'pr-12'
|
||||
!readOnly && (titleIsRtl ? 'ps-12' : 'pe-12')
|
||||
)}
|
||||
style={{ height: 'auto' }}
|
||||
ref={(el) => {
|
||||
@@ -92,7 +101,10 @@ export function NoteTitleBlock() {
|
||||
} finally { actions.setIsProcessingAI(false) }
|
||||
}}
|
||||
disabled={state.isProcessingAI}
|
||||
className="absolute right-0 top-2 opacity-0 group-hover:opacity-60 hover:!opacity-100 transition-opacity rounded-lg p-2 text-foreground/50 hover:bg-black/5"
|
||||
className={cn(
|
||||
'absolute top-2 opacity-0 group-hover:opacity-60 hover:!opacity-100 transition-opacity rounded-lg p-2 text-foreground/50 hover:bg-black/5',
|
||||
titleIsRtl ? 'left-0' : 'right-0',
|
||||
)}
|
||||
title={t('ai.generateTitlesTooltip')}
|
||||
>
|
||||
{state.isProcessingAI ? <Loader2 className="h-5 w-5 animate-spin" /> : <Sparkles className="h-5 w-5" />}
|
||||
@@ -117,14 +129,16 @@ export function NoteTitleBlock() {
|
||||
return (
|
||||
<div className="relative">
|
||||
<input
|
||||
dir="auto"
|
||||
dir={titleDir}
|
||||
lang={titleLang}
|
||||
placeholder={t('notes.titlePlaceholder')}
|
||||
value={state.title}
|
||||
onChange={(e) => actions.setTitle(e.target.value)}
|
||||
disabled={readOnly}
|
||||
className={cn(
|
||||
"w-full text-lg font-semibold border-0 focus-visible:ring-0 px-0 bg-transparent pr-10",
|
||||
readOnly && "cursor-default"
|
||||
'w-full text-lg font-semibold border-0 focus-visible:ring-0 px-0 bg-transparent',
|
||||
titleIsRtl ? 'text-right font-[family-name:var(--font-sans)] ps-10' : 'text-left pe-10',
|
||||
readOnly && 'cursor-default',
|
||||
)}
|
||||
/>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user