feat(danisman): hazır sorular konu haplarıyla, yazma kutusunun üstünde (prompt-kit kalıbı) (→ 2.1.1)
Some checks failed
Deploy / deploy (push) Has been cancelled
Some checks failed
Deploy / deploy (push) Has been cancelled
Boş durumdaki küçük cümle hapları kalktı. Konuya basınca soruları satır satır açılır, ortak söz koyu yazılır; soru göndermez, kutuya yazılır. Vurgu Türkçe küçük harfle aranır, uzun satır sarılır. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,63 +53,38 @@ function PromptSuggestion({
|
||||
)
|
||||
}
|
||||
|
||||
// Türkçe yerel küçültme: "İ" → "i" tek harf kalır, vurgu dizini kaymaz.
|
||||
const trimmedHighlight = highlight.trim()
|
||||
const contentLower = content.toLowerCase()
|
||||
const highlightLower = trimmedHighlight.toLowerCase()
|
||||
const shouldHighlight = contentLower.includes(highlightLower)
|
||||
const contentLower = content.toLocaleLowerCase("tr")
|
||||
const highlightLower = trimmedHighlight.toLocaleLowerCase("tr")
|
||||
const index = contentLower.indexOf(highlightLower)
|
||||
const bitis = index + highlightLower.length
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant={variant || "ghost"}
|
||||
size={size || "sm"}
|
||||
className={cn(
|
||||
"w-full cursor-pointer justify-start gap-0 py-2",
|
||||
"hover:bg-accent",
|
||||
"h-auto min-h-11 w-full cursor-pointer justify-start rounded-xl px-3 py-2 text-sm sm:min-h-9",
|
||||
"hover:bg-slate-100",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{shouldHighlight ? (
|
||||
(() => {
|
||||
const index = contentLower.indexOf(highlightLower)
|
||||
if (index === -1)
|
||||
return (
|
||||
<span className="text-muted-foreground whitespace-pre-wrap">
|
||||
{content}
|
||||
</span>
|
||||
)
|
||||
|
||||
const actualHighlightedText = content.substring(
|
||||
index,
|
||||
index + highlightLower.length
|
||||
)
|
||||
|
||||
const before = content.substring(0, index)
|
||||
const after = content.substring(index + actualHighlightedText.length)
|
||||
|
||||
return (
|
||||
<>
|
||||
{before && (
|
||||
<span className="text-muted-foreground whitespace-pre-wrap">
|
||||
{before}
|
||||
</span>
|
||||
)}
|
||||
<span className="text-primary font-medium whitespace-pre-wrap">
|
||||
{actualHighlightedText}
|
||||
</span>
|
||||
{after && (
|
||||
<span className="text-muted-foreground whitespace-pre-wrap">
|
||||
{after}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
})()
|
||||
) : (
|
||||
<span className="text-muted-foreground whitespace-pre-wrap">
|
||||
{content}
|
||||
</span>
|
||||
)}
|
||||
{/* Tek metin kutusu: uzun cümle dar ekranda sarılır, vurgu satır içinde kalır. */}
|
||||
<span className="min-w-0 text-left font-normal whitespace-normal text-slate-500">
|
||||
{index === -1 ? (
|
||||
content
|
||||
) : (
|
||||
<>
|
||||
{content.substring(0, index)}
|
||||
<span className="font-semibold text-slate-900">
|
||||
{content.substring(index, bitis)}
|
||||
</span>
|
||||
{content.substring(bitis)}
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user