Files
cobble/src/pages/admin/bots/[bot_id]/(partials)/composer-attach-button.tsx
T
tbenandClaude Opus 5.5 727cbf53c8 Let the composer grow with long prompts and focus from anywhere on its row
The input row had a fixed 88px height, so a growing textarea overflowed
into the thread and tools strip. It now has a minimum height, grows to
eight lines then scrolls, keeps the buttons at the bottom, and falls back
to a JS auto-grow where field-sizing isn't supported. A click anywhere on
the row focuses the input.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 20:42:13 +01:00

33 lines
1008 B
TypeScript

import Button from "@moduletrace/twui/layout/Button";
import { Plus } from "lucide-react";
import { AppData } from "@/src/data/app-data";
import pickFiles from "../(utils)/pick-files";
type Props = {
disabled?: boolean;
onFiles: (params: { files: File[] }) => void;
};
/**
* Opens the file picker for the next message's attachments.
*/
export default function ComposerAttachButton({ disabled, onFiles }: Props) {
return (
<Button
title={
disabled
? `Up to ${AppData.BotAttachmentMaxFiles} files per message`
: "Attach files"
}
type="button"
variant="ghost"
color="text"
disabled={disabled}
onClick={() => pickFiles({ onFiles })}
className="shrink-0 p-1! -mx-1 my-1 text-ink dark:text-ink rounded-default-xs focus-visible:ring-2 focus-visible:ring-ink"
>
<Plus size={16} aria-hidden />
</Button>
);
}