Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat: polish ui for chat
Brad Barbind389ce314b86
diff --git a/apps/erp/app/components/Chat/ChatInput.tsx b/apps/erp/app/components/Chat/ChatInput.tsxindex 60fadf6bc8..f1ab5c7ad2 100644--- a/apps/erp/app/components/Chat/ChatInput.tsx+++ b/apps/erp/app/components/Chat/ChatInput.tsx@@ -4,7 +4,6 @@ import { cn } from "@carbon/react";import { useRef } from "react";import { CommandMenu } from "./CommandMenu";import { FollowupQuestions } from "./FollowupQuestions";-import { useChatInterface } from "./hooks/useChatInterface";import { useChatStore } from "./lib/store";import {PromptInput,@@ -29,13 +28,13 @@ export interface ChatInputMessage extends PromptInputMessage {};}-export function ChatInput() {+export function ChatInput({ hasMessages }: { hasMessages: boolean }) {const textareaRef = useRef<HTMLTextAreaElement>(null);const status = useChatStatus();const { sendMessage } = useChatActions();const chatId = useChatId();- const { setChatId } = useChatInterface();+const { current } = useArtifacts({exclude: ["chat-title", "followup-questions"],});@@ -51,7 +50,6 @@ export function ChatInput() {selectedCommandIndex,filteredCommands,setInput,- setIsUploading,handleInputChange,handleKeyDown,resetCommandState,@@ -86,11 +84,12 @@ export function ChatInput() {<><divclassName={cn(- "fixed bottom-6 left-[70px] z-20 px-6 transition-all duration-300 ease-in-out",+ "transition-all duration-300 ease-in-out",+ hasMessages ? "absolute bottom-6 left-0 z-20" : "",isCanvasVisible ? "right-[603px]" : "right-0")}>- <div className="mx-auto w-full pt-2 max-w-[770px] relative">+ <div className="mx-auto w-full pt-2 relative"><FollowupQuestions />{/* Command Suggestions Menu */}@@ -115,8 +114,6 @@ export function ChatInput() {// Execute command through the storeif (!chatId) return;- setChatId(chatId);-sendMessage({role: "user",parts: [{ type: "text", text: selectedCommand.title }],@@ -138,11 +135,6 @@ export function ChatInput() {if (e.key === "Enter" && !showCommands) {e.preventDefault();if (input.trim()) {- // Set chat ID to ensure proper URL routing- if (chatId) {- setChatId(chatId);- }-sendMessage({text: input,files: [],@@ -161,7 +153,9 @@ export function ChatInput() {handleKeyDown(e);}}value={input}- placeholder={isWebSearch ? "Search the web" : "Ask anything"}+ placeholder={+ isWebSearch ? "Search the web" : "You can just do things"+ }/></PromptInputBody><PromptInputToolbar>diff --git a/apps/erp/app/components/Chat/ChatInterface.tsx b/apps/erp/app/components/Chat/ChatInterface.tsxindex 3fe75b16de..775c50fdda 100644--- a/apps/erp/app/components/Chat/ChatInterface.tsx+++ b/apps/erp/app/components/Chat/ChatInterface.tsx@@ -4,22 +4,23 @@ import { SUPABASE_URL, useCarbon } from "@carbon/auth";import { cn } from "@carbon/react";import { DefaultChatTransport, generateId } from "ai";import { useMemo } from "react";+import { Greeting } from "~/components/Greeting";import { useUser } from "~/hooks";-import { useChatInterface } from "./hooks/useChatInterface";-import { useChatStatus } from "./hooks/useChatStatus";-import type { UIChatMessage } from "./lib/types";-import { Canvas } from "./Canvas";import { ChatHeader } from "./ChatHeader";import type { ChatInputMessage } from "./ChatInput";import { ChatInput } from "./ChatInput";import { ChatMessages } from "./ChatMessages";import { ChatStatusIndicators } from "./ChatStatusIndicators";+import { ChatWidgets } from "./ChatWidgets";import {Conversation,ConversationContent,ConversationScrollButton,} from "./Conversation";+import { useChatInterface } from "./hooks/useChatInterface";+import { useChatStatus } from "./hooks/useChatStatus";+import type { UIChatMessage } from "./lib/types";type Props = {geo?: {@@ -29,7 +30,8 @@ type Props = {};export function ChatInterface({ geo }: Props) {- const { chatId: routeChatId, isHome } = useChatInterface();+ const { chatId: routeChatId } = useChatInterface();+const chatId = useMemo(() => routeChatId ?? generateId(), [routeChatId]);const { accessToken } = useCarbon();const {@@ -53,7 +55,8 @@ export function ChatInterface({ geo }: Props) {});}),- []+ // eslint-disable-next-line react-hooks/exhaustive-deps+ [accessToken]);const { messages, status } = useChat<UIChatMessage>({@@ -92,13 +95,7 @@ export function ChatInterface({ geo }: Props) {const hasSuggestions = suggestions?.prompts && suggestions.prompts.length > 0;return (- <div- className={cn(- "relative flex size-full overflow-hidden",- isHome && "h-[calc(100vh-764px)]",- !isHome && "h-[calc(100vh-88px)]"- )}- >+ <div className="relative flex size-full overflow-hidden bg-background h-[calc(100dvh-49px)]">{/* Canvas slides in from right when artifacts are present */}<divclassName={cn(@@ -130,12 +127,12 @@ export function ChatInterface({ geo }: Props) {hasArtifacts ? "right-[600px]" : "right-0")}>- <div className="bg-background/80 dark:bg-background/50 backdrop-blur-sm p-2 pt-6">+ <div className="bg-background/80 dark:bg-background/50 backdrop-blur-sm p-2 border-b"><ChatHeader /></div></div><Conversation>- <ConversationContent className="pb-48 pt-14">+ <ConversationContent className="py-4"><div className="max-w-2xl mx-auto w-full"><ChatMessagesmessages={messages}@@ -161,14 +158,19 @@ export function ChatInterface({ geo }: Props) {{/* Fixed input at bottom - respects parent container boundaries */}<divclassName={cn(- "fixed bottom-0 left-0",- hasMessages && "transition-all duration-300 ease-in-out",+ "transition-all duration-300 ease-in-out max-w-2xl mx-auto px-6",+ hasMessages+ ? "absolute bottom-0 left-0"+ : "w-full -mt-[20dvh] flex flex-col gap-8 items-center justify-center",hasArtifacts ? "right-[600px]" : "right-0")}>- <div className="w-full pb-4 max-w-2xl mx-auto">- <ChatInput />+ {!hasMessages && <Greeting size="h1" className="font-medium" />}+ <div className="w-full pb-2">+ <ChatInput hasMessages={hasMessages} /></div>++ {!hasMessages && <ChatWidgets />}</div></div></div>diff --git a/apps/erp/app/components/Chat/ChatNavigation.tsx b/apps/erp/app/components/Chat/ChatNavigation.tsxindex d34c263797..288e321187 100644--- a/apps/erp/app/components/Chat/ChatNavigation.tsx+++ b/apps/erp/app/components/Chat/ChatNavigation.tsx@@ -1,32 +1,32 @@"use client";import { useChatActions } from "@ai-sdk-tools/store";+import { IconButton } from "@carbon/react";import { useNavigate } from "@remix-run/react";import { LuArrowLeft } from "react-icons/lu";+import { path } from "~/utils/path";import { useChatInterface } from "./hooks/useChatInterface";export function ChatNavigation() {const navigate = useNavigate();const { reset } = useChatActions();- const { isHome } = useChatInterface();+ const { isChatPage } = useChatInterface();const handleBack = () => {reset();- navigate(-1);+ navigate(path.to.authenticatedRoot);};- if (isHome) return null;+ if (!isChatPage) return null;return (- <div className="absolute left-4">- <button- type="button"- onClick={handleBack}- className="p-2 hover:bg-accent transition-colors"+ <div className="absolute left-0">+ <IconButtonaria-label="Back to home"- >- <LuArrowLeft className="w-4 h-4" />- </button>+ variant="ghost"+ onClick={handleBack}+ icon={<LuArrowLeft />}+ /></div>);}diff --git a/apps/erp/app/components/Chat/ChatWidgets.tsx b/apps/erp/app/components/Chat/ChatWidgets.tsxnew file mode 100644index 0000000000..1937b977aa--- /dev/null+++ b/apps/erp/app/components/Chat/ChatWidgets.tsx@@ -0,0 +1,41 @@+import { Button } from "@carbon/react";+import {+ LuAudioLines,+ LuChevronDown,+ LuSearch,+ LuSquarePen,+} from "react-icons/lu";+import CreateMenu from "../Layout/Topbar/CreateMenu";++export function ChatWidgets() {+ return (+ <div className="w-full flex gap-3 justify-center items-center">+ <Button+ variant="secondary"+ className="rounded-full"+ leftIcon={<LuSearch />}+ >+ Search+ </Button>+ <CreateMenu+ trigger={+ <Button+ variant="secondary"+ className="rounded-full"+ leftIcon={<LuSquarePen />}+ rightIcon={<LuChevronDown />}+ >+ Create+ </Button>+ }+ />+ <Button+ variant="secondary"+ className="rounded-full"+ leftIcon={<LuAudioLines />}+ >+ Voice+ </Button>+ </div>+ );+}diff --git a/apps/erp/app/components/Chat/CommandMenu.tsx b/apps/erp/app/components/Chat/CommandMenu.tsxindex 8c3d2b85de..9d2523eadf 100644--- a/apps/erp/app/components/Chat/CommandMenu.tsx+++ b/apps/erp/app/components/Chat/CommandMenu.tsx@@ -4,7 +4,6 @@ import { type RefObject, useEffect, useRef } from "react";import { LuArrowRight } from "react-icons/lu";import { useOnClickOutside } from "~/hooks/useOnClickOutside";import { AnimatedSizeContainer } from "./AnimatedSizeContainer";-import { useChatInterface } from "./hooks/useChatInterface";import { useChatStore } from "./lib/store";export function CommandMenu() {@@ -13,7 +12,7 @@ export function CommandMenu() {filteredCommands,selectedCommandIndex,showCommands,- handleCommandSelect,+ // handleCommandSelect,resetCommandState,setInput,setShowCommands,@@ -21,7 +20,6 @@ export function CommandMenu() {const { sendMessage } = useChatActions();const chatId = useChatId();- const { setChatId } = useChatInterface();// Close command menu when clicking outside (but not on the toggle button)useOnClickOutside(commandListRef as RefObject<HTMLElement>, (event) => {@@ -40,8 +38,6 @@ export function CommandMenu() {const handleCommandExecution = (command: any) => {if (!chatId) return;- setChatId(chatId);-sendMessage({role: "user",parts: [{ type: "text", text: command.title }],@@ -61,7 +57,7 @@ export function CommandMenu() {useEffect(() => {if (commandListRef.current && showCommands) {const selectedElement = commandListRef.current.querySelector(- `[data-index="${selectedCommandIndex}"]`,+ `[data-index="${selectedCommandIndex}"]`);if (selectedElement) {selectedElement.scrollIntoView({ block: "nearest" });@@ -99,7 +95,7 @@ export function CommandMenu() {"px-2 py-2 text-sm cursor-pointer transition-colors flex items-center justify-between group",isActive? "bg-black/5 dark:bg-white/5"- : "hover:bg-black/5 dark:hover:bg-white/5",+ : "hover:bg-black/5 dark:hover:bg-white/5")}onClick={() => handleCommandExecution(command)}data-index={index}diff --git a/apps/erp/app/components/Chat/PromptInput.tsx b/apps/erp/app/components/Chat/PromptInput.tsxindex 286148b84f..ffc60b11be 100644--- a/apps/erp/app/components/Chat/PromptInput.tsx+++ b/apps/erp/app/components/Chat/PromptInput.tsx@@ -420,7 +420,7 @@ export const PromptInput = ({/><formclassName={cn(- "w-full overflow-hidden bg-card rounded-lg shadow-button-base",+ "w-full overflow-hidden bg-card rounded-xl border border-foreground/10 ring-[6px] dark:ring-[#1E1E21] ring-[#DADADA]",className)}onSubmit={handleSubmit}@@ -444,7 +444,7 @@ export type PromptInputTextareaProps = ComponentProps<typeof Textarea>;export const PromptInputTextarea = ({onChange,className,- placeholder = "Ask anything",+ placeholder = "You can just do things",...props}: PromptInputTextareaProps) => {const handleKeyDown: KeyboardEventHandler<HTMLTextAreaElement> = (e) => {@@ -471,8 +471,8 @@ export const PromptInputTextarea = ({return (<TextareaclassName={cn(- "w-full resize-none rounded-none border-none p-3 pt-4 shadow-none outline-none ring-0 text-sm",- "field-sizing-content bg-transparent dark:bg-transparent placeholder:text-[rgba(102,102,102,0.5)]",+ "w-full resize-none rounded-none border-none p-3 pt-4 shadow-none outline-none ring-0 text-base",+ "field-sizing-content bg-transparent placeholder:text-muted-foreground","max-h-[55px] min-h-[55px]","focus-visible:ring-0",className@@ -620,6 +620,7 @@ export const PromptInputSubmit = ({<IconButtonaria-label="Submit"icon={Icon}+ isRoundtype="submit"variant={variant}{...props}diff --git a/apps/erp/app/components/Chat/RecordButton.tsx b/apps/erp/app/components/Chat/RecordButton.tsxindex 130c476a39..d134561a76 100644--- a/apps/erp/app/components/Chat/RecordButton.tsx+++ b/apps/erp/app/components/Chat/RecordButton.tsx@@ -201,6 +201,7 @@ export function RecordButton({<IconButtonaria-label="Record"variant="ghost"+ isRoundicon={isProcessing ? <Spinner /> : <RecordIcon isRecording={isRecording} />}diff --git a/apps/erp/app/components/Chat/SuggestedActions.tsx b/apps/erp/app/components/Chat/SuggestedActions.tsxindex 368b7bd781..ab2859e072 100644--- a/apps/erp/app/components/Chat/SuggestedActions.tsx+++ b/apps/erp/app/components/Chat/SuggestedActions.tsx@@ -1,10 +1,8 @@import { useChatActions, useChatId } from "@ai-sdk-tools/store";import { cn, IconButton } from "@carbon/react";import { LuZap } from "react-icons/lu";-import { useChatInterface } from "./hooks/useChatInterface";import { useChatStore } from "./lib/store";-type SuggestedAction = {id: string;toolName: string;@@ -14,11 +12,8 @@ type SuggestedAction = {export function SuggestedActions() {const { sendMessage } = useChatActions();- const { setChatId } = useChatInterface();const chatId = useChatId();--const handleToolCall = (params: {toolName: string;toolParams: Record<string, any>;@@ -26,8 +21,6 @@ export function SuggestedActions() {}) => {if (!chatId) return;- setChatId(chatId);-sendMessage({role: "user",parts: [{ type: "text", text: params.text }],@@ -48,13 +41,10 @@ export function SuggestedActions() {title: string;description: string;}- > = {-- };+ > = {};const suggestedActions: SuggestedAction[] = [];-return (<div className="w-full px-6 mt-10 mb-8 flex items-center justify-center"><div className="flex gap-3 overflow-x-auto scrollbar-hide">@@ -72,7 +62,7 @@ export function SuggestedActions() {className={cn("border border-border hover:bg-accent hover:border-border-hover","px-3 py-2 flex items-center gap-2 cursor-pointer",- "transition-all duration-300 min-w-fit whitespace-nowrap",+ "transition-all duration-300 min-w-fit whitespace-nowrap")}onClick={() => {handleToolCall({@@ -82,9 +72,7 @@ export function SuggestedActions() {});}}>- {Icon && (- <Icon className="w-4 h-4 text-muted-foreground" />- )}+ {Icon && <Icon className="w-4 h-4 text-muted-foreground" />}<span className="text-foreground text-[12px] font-medium">{title}</span>@@ -96,8 +84,6 @@ export function SuggestedActions() {);}--export function SuggestedActionsButton() {const { showCommands, setShowCommands } = useChatStore();@@ -124,10 +110,9 @@ export function SuggestedActionsButton() {type="button"onClick={handleClick}className={cn(-showCommands? "text-foreground"- : "text-muted-foreground hover:text-foreground",+ : "text-muted-foreground hover:text-foreground")}// Add data attribute to help identify this button for exclusion from outside clicksdata-suggested-actions-togglediff --git a/apps/erp/app/components/Chat/WebSearch.tsx b/apps/erp/app/components/Chat/WebSearch.tsxindex 092eefb7a8..c330199366 100644--- a/apps/erp/app/components/Chat/WebSearch.tsx+++ b/apps/erp/app/components/Chat/WebSearch.tsx@@ -5,7 +5,7 @@ import {Tooltip,TooltipContent,TooltipProvider,- TooltipTrigger+ TooltipTrigger,} from "@carbon/react";import { LuGlobe } from "react-icons/lu";import { useChatStore } from "./lib/store";@@ -14,8 +14,6 @@ import { AnimatePresence, motion } from "framer-motion";import type { ComponentProps } from "react";import { useEffect, useState } from "react";--interface WebSearchSource {title?: string;url?: string;@@ -153,8 +151,11 @@ const WebSearchSourceAvatar = ({window.open(source.url, "_blank", "noopener,noreferrer")}>- <Avatar className="h-5 w-5 cursor-pointer border-2 border-background shadow-sm" src={`https://img.logo.dev/${domain}?token=pk_X-1ZO13GSgeOoUrIuJ6GMQ&size=64&retina=true`} name={domain.split(".")[0]}- />+ <Avatar+ className="h-5 w-5 cursor-pointer border-2 border-background shadow-sm"+ src={`https://img.logo.dev/${domain}?token=pk_X-1ZO13GSgeOoUrIuJ6GMQ&size=64&retina=true`}+ name={domain.split(".")[0]}+ /></motion.div></TooltipTrigger><TooltipContent side="top" className="max-w-xs">@@ -167,21 +168,16 @@ const WebSearchSourceAvatar = ({);};--export function WebSearchButton() {const { isWebSearch, setIsWebSearch } = useChatStore();return (<IconButton- type="button"+ type="button"variant={isWebSearch ? "primary" : "ghost"}icon={<LuGlobe />}onClick={() => setIsWebSearch(!isWebSearch)}aria-label="Web Search"-/>--);}diff --git a/apps/erp/app/components/Chat/hooks/useChatInterface.tsx b/apps/erp/app/components/Chat/hooks/useChatInterface.tsxindex 024dfc8151..bc39aa4378 100644--- a/apps/erp/app/components/Chat/hooks/useChatInterface.tsx+++ b/apps/erp/app/components/Chat/hooks/useChatInterface.tsx@@ -1,34 +1,32 @@+import { useMount } from "@carbon/react";import { useUrlParams } from "@carbon/remix";-import { useEffect, useState } from "react";+import { useLocation } from "@remix-run/react";+import { generateId } from "ai";+import { useCallback } from "react";+import { path } from "~/utils/path";export function useChatInterface() {const [params, setParams] = useUrlParams();+ const location = useLocation();+ const chatId = params.get("chatId") || null;- // Initialize state immediately from pathname to avoid blink on refresh- const getInitialChatId = () => {- return params.get("chatId") || null;- };-- const [chatId, setChatIdState] = useState<string | null>(getInitialChatId);-- // Extract chatId from pathname- useEffect(() => {- setChatIdState(params.get("chatId") || null);- }, [params]);+ const isChatPage = !!chatId;+ const isHome = location.pathname === path.to.authenticatedRoot;-+ useMount(() => {+ if (isHome && !chatId) {+ setParams({ chatId: generateId() });+ }+ });- const isHome = !chatId;- const isChatPage = Boolean(chatId);-- const setChatId = (id: string) => {- // Preserve the locale in the URL- setParams({ chatId: id });- setChatIdState(id);- };+ const setChatId = useCallback(+ (id: string) => {+ setParams({ chatId: id });+ },+ [setParams]+ );return {- isHome,isChatPage,chatId,setChatId,diff --git a/apps/erp/app/components/Greeting.tsx b/apps/erp/app/components/Greeting.tsxnew file mode 100644index 0000000000..2814f917d1--- /dev/null+++ b/apps/erp/app/components/Greeting.tsx@@ -0,0 +1,30 @@+import { Heading, useInterval } from "@carbon/react";+import { getLocalTimeZone, now } from "@internationalized/date";+import type { ComponentProps } from "react";+import { useMemo, useState } from "react";+import { useUser } from "~/hooks";++export function Greeting(props: ComponentProps<typeof Heading>) {+ const user = useUser();+ const [currentTime, setCurrentTime] = useState(() => now(getLocalTimeZone()));++ useInterval(() => {+ setCurrentTime(now(getLocalTimeZone()));+ }, 60 * 60 * 1000);++ const greeting = useMemo(() => {+ if (currentTime.hour >= 3 && currentTime.hour < 11) {+ return "Good morning";+ } else if (currentTime.hour >= 11 && currentTime.hour < 16) {+ return "Good afternoon";+ } else {+ return "Good evening";+ }+ }, [currentTime.hour]);++ return (+ <Heading size="h3" {...props}>+ {greeting}, {user.firstName}+ </Heading>+ );+}diff --git a/apps/erp/app/components/Layout/Topbar/CreateMenu.tsx b/apps/erp/app/components/Layout/Topbar/CreateMenu.tsxindex f0f8e86b0c..52e77e8489 100644--- a/apps/erp/app/components/Layout/Topbar/CreateMenu.tsx+++ b/apps/erp/app/components/Layout/Topbar/CreateMenu.tsx@@ -4,7 +4,6 @@ import {DropdownMenuIcon,DropdownMenuItem,DropdownMenuTrigger,- IconButton,} from "@carbon/react";import { Link } from "@remix-run/react";@@ -13,7 +12,6 @@ import {LuHardHat,LuShieldX,LuShoppingCart,- LuSquarePen,LuSquareStack,LuSquareUser,LuUsers,@@ -112,20 +110,14 @@ function useCreate(): Route[] {return result.sort((a, b) => a.name.localeCompare(b.name));}-const CreateMenu = () => {+const CreateMenu = ({ trigger }: { trigger: React.ReactNode }) => {const createLinks = useCreate();if (!createLinks.length) return null;return (<DropdownMenu>- <DropdownMenuTrigger asChild>- <IconButton- aria-label="Create"- icon={<LuSquarePen />}- variant="ghost"- />- </DropdownMenuTrigger>+ <DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger><DropdownMenuContent align="center" className="w-48">{createLinks.map((link) => (<DropdownMenuItem key={link.to} asChild>diff --git a/apps/erp/app/components/Layout/Topbar/Topbar.tsx b/apps/erp/app/components/Layout/Topbar/Topbar.tsxindex 0c354a851d..b25b766dea 100644--- a/apps/erp/app/components/Layout/Topbar/Topbar.tsx+++ b/apps/erp/app/components/Layout/Topbar/Topbar.tsx@@ -1,4 +1,5 @@-import { HStack } from "@carbon/react";+import { HStack, IconButton } from "@carbon/react";+import { LuSquarePen } from "react-icons/lu";import { Agent } from "~/components/Agent/Agent.ee";import { usePermissions, useUser } from "~/hooks";import { useFlags } from "~/hooks/useFlags";@@ -27,7 +28,15 @@ const Topbar = () => {</div><HStack spacing={1} className="flex-1 justify-end py-2"><Feedback />- <CreateMenu />+ <CreateMenu+ trigger={+ <IconButton+ aria-label="Create"+ icon={<LuSquarePen />}+ variant="ghost"+ />+ }+ />{canAccessAgent && <Agent />}<Notifications key={notificationsKey} /><AvatarMenu />diff --git a/apps/erp/app/routes/x+/_index.tsx b/apps/erp/app/routes/x+/_index.tsxindex ab40452874..33c29898fe 100644--- a/apps/erp/app/routes/x+/_index.tsx+++ b/apps/erp/app/routes/x+/_index.tsx@@ -1,17 +1,18 @@import { Provider as ChatProvider } from "@ai-sdk-tools/store";-import { Heading, cn } from "@carbon/react";-import { getLocalTimeZone, now } from "@internationalized/date";+import { cn } from "@carbon/react";+import { getLocalTimeZone } from "@internationalized/date";import { useLocale } from "@react-aria/i18n";import { Link } from "@remix-run/react";import { useMemo, type ComponentProps } from "react";import { ChatInterface } from "~/components/Chat";import { useChatInterface } from "~/components/Chat/hooks/useChatInterface";-import { useModules, useUser } from "~/hooks";+import { Greeting } from "~/components/Greeting";+import { useModules } from "~/hooks";import type { Authenticated, NavItem } from "~/types";export default function AppIndexRoute() {const { chatId: currentChatId } = useChatInterface();- const user = useUser();+const isCloud = true;// const permissions = usePermissions();const modules = useModules();@@ -27,27 +28,13 @@ export default function AppIndexRoute() {[locale]);- const greeting = useMemo(() => {- const time = now(getLocalTimeZone());-- if (time.hour >= 3 && time.hour < 11) {- return "Good Morning";- } else if (time.hour >= 11 && time.hour < 16) {- return "Good Afternoon";- } else {- return "Good Evening";- }- }, []);-return isCloud ? (<ChatProvider initialMessages={[]} key={currentChatId || "home"}><ChatInterface /></ChatProvider>) : (<div className="p-8 w-full h-full bg-muted">- <Heading size="h3">- {greeting}, {user.firstName}- </Heading>+ <Greeting /><Subheading>{formatter.format(date)}</Subheading><Hr /><div className="grid grid-cols-[repeat(auto-fill,minmax(min(100%,300px),1fr))] gap-6 mb-8">diff --git a/packages/remix/src/hooks/useKeyboardWedge.ts b/packages/remix/src/hooks/useKeyboardWedge.tsindex 145c02617a..d099a572e1 100644--- a/packages/remix/src/hooks/useKeyboardWedge.ts+++ b/packages/remix/src/hooks/useKeyboardWedge.ts@@ -31,6 +31,16 @@ export function useKeyboardWedge(options?: UseKeyboardWedgeOptions) {if (!active) return;const handleKeyDown = (event: KeyboardEvent) => {+ // Check if the active element is an input or textarea+ const activeElement = document.activeElement;+ if (+ activeElement &&+ (activeElement.tagName === "INPUT" ||+ activeElement.tagName === "TEXTAREA")+ ) {+ return;+ }+if (/^[a-zA-Z0-9\-./:?=&_]$/.test(event.key)) {setInputBuffer((prev) => prev + event.key);} else if (event.key === "Enter") {