Skip to content

Commit 77ad7d7

Browse files
committed
Improve message editor in session view, added mock model picker, slight adjustments to chat width, buttons, style consistency, etc
1 parent 93c01b3 commit 77ad7d7

File tree

1 file changed

+82
-36
lines changed

1 file changed

+82
-36
lines changed

apps/array/src/renderer/features/sessions/components/MessageEditor.tsx

Lines changed: 82 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import "@features/task-detail/components/TaskInput.css";
2-
import { ArrowUp, Paperclip, Stop } from "@phosphor-icons/react";
3-
import { Box, Flex, IconButton, Tooltip } from "@radix-ui/themes";
2+
import { ArrowUp, CaretDown, Paperclip, Stop } from "@phosphor-icons/react";
3+
import {
4+
Box,
5+
Button,
6+
DropdownMenu,
7+
Flex,
8+
IconButton,
9+
Text,
10+
Tooltip,
11+
} from "@radix-ui/themes";
412
import { logger } from "@renderer/lib/logger";
513
import type { MentionItem } from "@shared/types";
614
import { Extension, type JSONContent } from "@tiptap/core";
@@ -231,6 +239,9 @@ export const MessageEditor = forwardRef<
231239
}
232240
};
233241
const [mentionItems, setMentionItems] = useState<MentionItem[]>([]);
242+
const [_selectedModel, setSelectedModel] = useState(
243+
"claude-sonnet-4-5-20250514",
244+
);
234245
const mentionItemsRef = useRef(mentionItems);
235246
const repoPathRef = useRef(repoPath);
236247
const onSubmitRef = useRef(onSubmit);
@@ -430,7 +441,7 @@ export const MessageEditor = forwardRef<
430441
onClick={handleContainerClick}
431442
style={{ cursor: "text" }}
432443
>
433-
<Box className="max-h-[200px] flex-1 overflow-y-auto font-mono text-sm">
444+
<Box className="max-h-[200px] min-h-[40px] flex-1 overflow-y-auto font-mono text-sm">
434445
<EditorContent editor={editor} />
435446
</Box>
436447
<Flex justify="between" align="center">
@@ -441,39 +452,74 @@ export const MessageEditor = forwardRef<
441452
onChange={handleFileSelect}
442453
style={{ display: "none" }}
443454
/>
444-
<Tooltip content="Attach file">
445-
<IconButton
446-
size="1"
447-
variant="ghost"
448-
color="gray"
449-
onClick={() => fileInputRef.current?.click()}
450-
disabled={disabled}
451-
>
452-
<Paperclip size={14} />
453-
</IconButton>
454-
</Tooltip>
455-
{isLoading && onCancel ? (
456-
<IconButton
457-
size="1"
458-
variant="soft"
459-
color="red"
460-
onClick={onCancel}
461-
title="Stop"
462-
>
463-
<Stop size={14} weight="fill" />
464-
</IconButton>
465-
) : (
466-
<IconButton
467-
size="1"
468-
variant="solid"
469-
color="orange"
470-
onClick={handleSubmit}
471-
disabled={disabled || isEmpty}
472-
title="Send (Enter)"
473-
>
474-
<ArrowUp size={14} weight="bold" />
475-
</IconButton>
476-
)}
455+
<DropdownMenu.Root>
456+
<DropdownMenu.Trigger>
457+
<Button
458+
variant="ghost"
459+
color="gray"
460+
size="1"
461+
style={{ marginLeft: "0" }}
462+
>
463+
<Text size="1">Sonnet 4.5</Text>
464+
<CaretDown size={12} />
465+
</Button>
466+
</DropdownMenu.Trigger>
467+
<DropdownMenu.Content size="1">
468+
<DropdownMenu.Item
469+
onSelect={() => setSelectedModel("claude-sonnet-4-5-20250514")}
470+
>
471+
<Text size="1">Sonnet 4.5</Text>
472+
</DropdownMenu.Item>
473+
</DropdownMenu.Content>
474+
</DropdownMenu.Root>
475+
<Flex gap="4" align="center">
476+
<Tooltip content="Attach file">
477+
<IconButton
478+
size="1"
479+
variant="soft"
480+
color="gray"
481+
onClick={() => fileInputRef.current?.click()}
482+
disabled={disabled}
483+
title="Attach file"
484+
>
485+
<Paperclip size={14} weight="bold" />
486+
</IconButton>
487+
</Tooltip>
488+
{isLoading && onCancel ? (
489+
<Tooltip content="Stop">
490+
<IconButton
491+
size="1"
492+
variant="soft"
493+
color="red"
494+
onClick={onCancel}
495+
title="Stop"
496+
>
497+
<Stop size={14} weight="fill" />
498+
</IconButton>
499+
</Tooltip>
500+
) : (
501+
<Tooltip
502+
content={
503+
disabled || isEmpty ? "Enter a message" : "Send message"
504+
}
505+
>
506+
<IconButton
507+
size="1"
508+
variant="solid"
509+
onClick={handleSubmit}
510+
disabled={disabled || isEmpty}
511+
loading={isLoading}
512+
style={{
513+
backgroundColor:
514+
disabled || isEmpty ? "var(--accent-a4)" : undefined,
515+
color: disabled || isEmpty ? "var(--accent-8)" : undefined,
516+
}}
517+
>
518+
<ArrowUp size={14} weight="bold" />
519+
</IconButton>
520+
</Tooltip>
521+
)}
522+
</Flex>
477523
</Flex>
478524
</Flex>
479525
);

0 commit comments

Comments
 (0)