feat: add shift-enter hint below chat composer

This commit is contained in:
lc6464 2026-06-11 15:44:45 +08:00 committed by Guoguo
parent 42ece2aceb
commit 890f4d6bcb
6 changed files with 129 additions and 109 deletions

View file

@ -70,6 +70,7 @@ export function ChatComposer({
const { t } = useTranslation() const { t } = useTranslation()
const canInput = inputDisabledReason === null const canInput = inputDisabledReason === null
const composingRef = useRef(false) const composingRef = useRef(false)
const hasInput = input.trim().length > 0
const disabledMessage = const disabledMessage =
inputDisabledReason === null inputDisabledReason === null
? null ? null
@ -96,9 +97,10 @@ export function ChatComposer({
return ( return (
<div className="before:bg-background pointer-events-none relative z-10 -mt-[24px] shrink-0 [scrollbar-gutter:stable] overflow-y-auto px-4 pb-[calc(1rem+env(safe-area-inset-bottom))] before:pointer-events-none before:absolute before:inset-x-0 before:top-[24px] before:bottom-0 before:content-[''] md:px-8 md:pb-8 lg:px-24 xl:px-48"> <div className="before:bg-background pointer-events-none relative z-10 -mt-[24px] shrink-0 [scrollbar-gutter:stable] overflow-y-auto px-4 pb-[calc(1rem+env(safe-area-inset-bottom))] before:pointer-events-none before:absolute before:inset-x-0 before:top-[24px] before:bottom-0 before:content-[''] md:px-8 md:pb-8 lg:px-24 xl:px-48">
<div className="pointer-events-auto mx-auto flex max-w-[1000px] flex-col items-end">
<div <div
className={cn( className={cn(
"bg-card border-border/60 pointer-events-auto relative mx-auto flex max-w-[1000px] flex-col rounded-2xl border p-3 shadow-sm transition-colors", "bg-card border-border/60 relative flex w-full flex-col rounded-2xl border p-3 shadow-sm transition-colors",
isDragActive && "border-violet-400/70 bg-violet-500/5", isDragActive && "border-violet-400/70 bg-violet-500/5",
)} )}
onDragEnter={onDragEnter} onDragEnter={onDragEnter}
@ -212,6 +214,19 @@ export function ChatComposer({
</div> </div>
</div> </div>
</div> </div>
<div
aria-hidden={!hasInput}
className={cn(
"border-border/70 bg-muted text-foreground mt-2 inline-flex items-center rounded-md border px-3 py-1.5 text-xs shadow-lg shadow-black/10 transition-all duration-200 dark:shadow-black/30",
hasInput
? "translate-y-0 opacity-100"
: "pointer-events-none -translate-y-1 opacity-0",
)}
>
{t("chat.composeHint")}
</div>
</div>
</div> </div>
) )
} }

View file

@ -94,6 +94,7 @@
}, },
"sendMessage": "বার্তা পাঠান", "sendMessage": "বার্তা পাঠান",
"sendHint": "পাঠাতে Enter চাপুন\nনতুন লাইনের জন্য Shift + Enter", "sendHint": "পাঠাতে Enter চাপুন\nনতুন লাইনের জন্য Shift + Enter",
"composeHint": "পাঠাতে Enter চাপুন, নতুন লাইনের জন্য Shift + Enter",
"contextTitle": "প্রসঙ্গ", "contextTitle": "প্রসঙ্গ",
"contextDetail": "বিস্তারিত দেখুন", "contextDetail": "বিস্তারিত দেখুন",
"contextCompressAt": "Compress at", "contextCompressAt": "Compress at",

View file

@ -92,6 +92,7 @@
}, },
"sendMessage": "Odeslat zprávu", "sendMessage": "Odeslat zprávu",
"sendHint": "Enter pro odeslání\nShift + Enter pro nový řádek", "sendHint": "Enter pro odeslání\nShift + Enter pro nový řádek",
"composeHint": "Enter pro odeslání, Shift + Enter pro nový řádek",
"contextTitle": "Kontext", "contextTitle": "Kontext",
"contextDetail": "Zobrazit detail", "contextDetail": "Zobrazit detail",
"contextCompressAt": "Komprimovat při", "contextCompressAt": "Komprimovat při",

View file

@ -94,6 +94,7 @@
}, },
"sendMessage": "Send message", "sendMessage": "Send message",
"sendHint": "Press Enter to send\nShift + Enter for a new line", "sendHint": "Press Enter to send\nShift + Enter for a new line",
"composeHint": "Press Enter to send, Shift + Enter for a new line",
"contextTitle": "Context", "contextTitle": "Context",
"contextDetail": "View Details", "contextDetail": "View Details",
"contextCompressAt": "Compress at", "contextCompressAt": "Compress at",

View file

@ -94,6 +94,7 @@
}, },
"sendMessage": "Enviar mensagem", "sendMessage": "Enviar mensagem",
"sendHint": "Pressione Enter para enviar\nShift + Enter para nova linha", "sendHint": "Pressione Enter para enviar\nShift + Enter para nova linha",
"composeHint": "Pressione Enter para enviar, Shift + Enter para nova linha",
"contextTitle": "Contexto", "contextTitle": "Contexto",
"contextDetail": "Ver Detalhes", "contextDetail": "Ver Detalhes",
"contextCompressAt": "Comprimir em", "contextCompressAt": "Comprimir em",

View file

@ -94,6 +94,7 @@
}, },
"sendMessage": "发送消息", "sendMessage": "发送消息",
"sendHint": "按 Enter 发送\nShift + Enter 换行", "sendHint": "按 Enter 发送\nShift + Enter 换行",
"composeHint": "按 Enter 发送Shift + Enter 换行",
"contextTitle": "上下文", "contextTitle": "上下文",
"contextDetail": "查看详情", "contextDetail": "查看详情",
"contextCompressAt": "压缩阈值", "contextCompressAt": "压缩阈值",