mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-03 19:01:19 +08:00
feat(chat): move Attach into the answer card header
The action now sits on the same line as the Answer label, removing the footer row and keeping the card compact. The button stays after the textarea in DOM order, so keyboard focus remains textarea then Attach.
This commit is contained in:
@@ -84,9 +84,9 @@ export function AnswerCard({
|
||||
<div
|
||||
id={anchor}
|
||||
data-answer-question={questionId}
|
||||
className="my-3 w-full scroll-mt-24 overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--card)] shadow-[0_10px_30px_-18px_rgba(0,0,0,0.35)]"
|
||||
className="relative my-3 w-full scroll-mt-24 overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--card)] shadow-[0_10px_30px_-18px_rgba(0,0,0,0.35)]"
|
||||
>
|
||||
<div className="flex items-center gap-1.5 px-3 pt-2.5 text-[11px] font-medium tracking-wide text-[var(--muted-foreground)]">
|
||||
<div className="flex items-center gap-1.5 px-3 pt-2.5 pr-24 text-[11px] font-medium tracking-wide text-[var(--muted-foreground)]">
|
||||
<MessageSquare size={12} strokeWidth={1.8} />
|
||||
{t('Answer')}
|
||||
</div>
|
||||
@@ -98,27 +98,25 @@ export function AnswerCard({
|
||||
aria-label={t('Your answer')}
|
||||
rows={4}
|
||||
disabled={disabled}
|
||||
className="max-h-[240px] min-h-[96px] w-full resize-none overflow-y-auto bg-transparent px-3 py-2 text-[13.5px] leading-relaxed text-[var(--foreground)] outline-none placeholder:text-[var(--muted-foreground)]/80 disabled:opacity-60"
|
||||
className="max-h-[240px] min-h-[96px] w-full resize-none overflow-y-auto bg-transparent px-3 pb-3 pt-2 text-[13.5px] leading-relaxed text-[var(--foreground)] outline-none placeholder:text-[var(--muted-foreground)]/80 disabled:opacity-60"
|
||||
/>
|
||||
<div className="flex justify-end border-t border-[var(--border)]/60 px-2.5 py-1.5">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
const answer = text.trim()
|
||||
if (!answer || disabled) return
|
||||
inline.attach({
|
||||
question_id: questionId,
|
||||
question: question.trim(),
|
||||
answer,
|
||||
source_message_id: messageId,
|
||||
})
|
||||
}}
|
||||
disabled={disabled || !text.trim()}
|
||||
className="rounded-md bg-[var(--primary)] px-2.5 py-1 text-[12px] font-medium text-[var(--primary-foreground)] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
>
|
||||
{t('Attach')}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
const answer = text.trim()
|
||||
if (!answer || disabled) return
|
||||
inline.attach({
|
||||
question_id: questionId,
|
||||
question: question.trim(),
|
||||
answer,
|
||||
source_message_id: messageId,
|
||||
})
|
||||
}}
|
||||
disabled={disabled || !text.trim()}
|
||||
className="absolute right-2.5 top-2 rounded-md bg-[var(--primary)] px-2.5 py-1 text-[12px] font-medium text-[var(--primary-foreground)] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
>
|
||||
{t('Attach')}
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user