Skip to content

Commit

Permalink
fix: revert chat box to follow responsive design
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhopperlowe committed Sep 12, 2024
1 parent c1c09be commit ade590a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
8 changes: 7 additions & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ function RunFile() {
<Threads onOpenExplore={onOpen} />

<div className="flex-auto overflow-hidden">
<Chat showAssistantName />
<Chat
showAssistantName
classNames={{
chatBar: 'w-full mx-auto lg:w-3/4 2xl:w-1/2',
messages: 'w-full mx-auto lg:w-3/4 2xl:w-1/2',
}}
/>
</div>
</div>
<ExploreModal isOpen={isOpen} onOpen={onOpen} onClose={onClose} />
Expand Down
17 changes: 14 additions & 3 deletions components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ import KnowledgeDropdown from '@/components/scripts/knowledge-dropdown';
import SaveScriptDropdown from '@/components/scripts/script-save';
import { Tool } from '@gptscript-ai/gptscript';
import { rootTool } from '@/actions/gptscript';
import clsx from 'clsx';

interface ScriptProps {
className?: string;
classNames?: {
chatBar?: string;
messages?: string;
};
messagesHeight?: string;
showAssistantName?: boolean;
inputPlaceholder?: string;
Expand All @@ -41,6 +46,7 @@ const Chat: React.FC<ScriptProps> = ({
disableInput = false,
disableCommands = false,
noChat = false,
classNames = {},
}) => {
const inputRef = useRef<HTMLInputElement>(null);
const [inputValue, _setInputValue] = useState<string>('');
Expand Down Expand Up @@ -153,7 +159,7 @@ const Chat: React.FC<ScriptProps> = ({
) : (
<>
{showAssistantName && scriptDisplayName && (
<div className="sticky top-0 p-4 z-50 bg-background">
<div className="sticky top-0 p-4 z-50 bg-background">
<h1 className="text-3xl font-medium truncate">
{scriptDisplayName ?? ''}
</h1>
Expand All @@ -165,7 +171,7 @@ const Chat: React.FC<ScriptProps> = ({
</div>
)}

<div className="flex-auto">
<div className={clsx('flex-auto', classNames.messages)}>
<Messages
restart={restartScript}
messages={messages}
Expand All @@ -175,7 +181,12 @@ const Chat: React.FC<ScriptProps> = ({
</>
)}

<div className="w-full sticky bottom-0 bg-background pb-4">
<div
className={clsx(
'w-full sticky bottom-0 bg-background pb-4',
classNames.chatBar
)}
>
{showForm && hasParams ? (
<Button
className="mt-4 w-full"
Expand Down

0 comments on commit ade590a

Please sign in to comment.