diff --git a/src/interface/web/app/agents/agents.module.css b/src/interface/web/app/agents/agents.module.css index 8433a88fd..8cc0cda52 100644 --- a/src/interface/web/app/agents/agents.module.css +++ b/src/interface/web/app/agents/agents.module.css @@ -16,16 +16,17 @@ div.agentPersonality { overflow: hidden; } +div.pageLayout { + max-width: 60vw; + margin: auto; + margin-bottom: 2rem; +} + div.sidePanel { position: fixed; height: 100%; } -div.pageLayout { - gap: 1rem; -} - - button.infoButton { border: none; background-color: transparent !important; @@ -46,7 +47,7 @@ div.agentList { } -@media only screen and (max-width: 700px) { +@media only screen and (max-width: 768px) { div.agentList { width: 100%; padding: 0; @@ -54,4 +55,13 @@ div.agentList { margin-left: auto; grid-template-columns: 1fr; } + + div.pageLayout { + max-width: 90vw; + } + + div.sidePanel { + position: relative; + height: 100%; + } } diff --git a/src/interface/web/app/agents/page.tsx b/src/interface/web/app/agents/page.tsx index 5e68a0b96..f9c3a36bc 100644 --- a/src/interface/web/app/agents/page.tsx +++ b/src/interface/web/app/agents/page.tsx @@ -254,9 +254,6 @@ export default function Agents() { if (!data) { return (
-
- Agents -
booting up your agents
@@ -265,17 +262,8 @@ export default function Agents() { } return ( -
-
- -
- { - showLoginPrompt && - - } -
+
+
-
-
-

Agents

+
+
+

Agents

@@ -302,6 +290,12 @@ export default function Agents() {
+ { + showLoginPrompt && + + } diff --git a/src/interface/web/app/automations/automations.module.css b/src/interface/web/app/automations/automations.module.css index 99f094c33..f0c352441 100644 --- a/src/interface/web/app/automations/automations.module.css +++ b/src/interface/web/app/automations/automations.module.css @@ -28,4 +28,9 @@ div.sidePanel { div.pageLayout { max-width: 90vw; } + + div.sidePanel { + position: relative; + height: 100%; + } } diff --git a/src/interface/web/app/automations/page.tsx b/src/interface/web/app/automations/page.tsx index 9416cee7c..fe4e28588 100644 --- a/src/interface/web/app/automations/page.tsx +++ b/src/interface/web/app/automations/page.tsx @@ -1,10 +1,9 @@ 'use client' import useSWR from 'swr'; -import Loading, { InlineLoading } from '../components/loading/loading'; +import { InlineLoading } from '../components/loading/loading'; import { Card, - CardDescription, CardContent, CardFooter, CardHeader, @@ -54,7 +53,7 @@ import { useToast } from '@/components/ui/use-toast'; import { ToastAction } from '@/components/ui/toast'; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" import SidePanel from '../components/sidePanel/chatHistorySidePanel'; -import NavMenu from '../components/navMenu/navMenu'; +import { Drawer, DrawerContent, DrawerTitle, DrawerTrigger } from '@/components/ui/drawer'; const automationsFetcher = () => window.fetch('/api/automations').then(res => res.json()).catch(err => console.log(err)); @@ -219,6 +218,7 @@ function sendAPreview(automationId: string, setToastMessage: (toastMessage: stri interface AutomationsCardProps { automation: AutomationsData; + isMobileWidth: boolean; locationData?: LocationData | null; suggestedCard?: boolean; setNewAutomationData?: (data: AutomationsData) => void; @@ -260,7 +260,7 @@ function AutomationsCard(props: AutomationsCardProps) { const dayOfMonth = getDayOfMonthFromCron(automationData.crontime); setIntervalString(`Monthly on the ${dayOfMonth}`); } - }, [updatedAutomationData, props.automation]); + }, [updatedAutomationData, automation]); useEffect(() => { @@ -275,7 +275,7 @@ function AutomationsCard(props: AutomationsCardProps) { }) setToastMessage(''); } - }, [toastMessage]); + }, [toastMessage, updatedAutomationData, automation, toast]); if (isDeleted) { return null; @@ -291,44 +291,32 @@ function AutomationsCard(props: AutomationsCardProps) { - { - !props.suggestedCard && ( - { - setIsEditing(open); - }} - > - - - - - Edit Automation - - - + (!props.suggestedCard && props.locationData) && ( + ) } + { + navigator.clipboard.writeText(createShareLink(automation)); + }} + /> { !props.suggestedCard && ( - + {updatedAutomationData?.query_to_run || automation.query_to_run} @@ -375,31 +363,17 @@ function AutomationsCard(props: AutomationsCardProps) {
{ props.suggestedCard && props.setNewAutomationData && ( - { - setIsEditing(open); - }} - > - - - - - Add Automation - - - + ) } @@ -413,6 +387,7 @@ interface SharedAutomationCardProps { isLoggedIn: boolean; setShowLoginPrompt: (showLoginPrompt: boolean) => void; authenticatedData: UserProfile | null; + isMobileWidth: boolean; } function SharedAutomationCard(props: SharedAutomationCardProps) { @@ -438,30 +413,19 @@ function SharedAutomationCard(props: SharedAutomationCardProps) { } return ( - { - setIsCreating(open); - }} - > - - - - - - Create Automation - - - - + isCreating ? + + : null ) } @@ -596,8 +560,6 @@ function AutomationModificationForm(props: AutomationModificationFormProps) { const [isSaving, setIsSaving] = useState(false); const { errors } = props.form.formState; - console.log(errors); - function recommendationPill(recommendationText: string, onChange: (value: any, event: React.MouseEvent) => void) { return ( + + + Automation + + + + ) : + ( + { + props.setIsCreating(open); + }} + > + + + + + Automation + + + + ) + ); + +} + export default function Automations() { const authenticatedData = useAuthenticatedData(); @@ -918,7 +956,7 @@ export default function Automations() { setAllNewAutomations([...allNewAutomations, newAutomationData]); setNewAutomationData(null); } - }, [newAutomationData]); + }, [newAutomationData, allNewAutomations]); useEffect(() => { @@ -932,14 +970,11 @@ export default function Automations() { } }, [personalAutomations, allNewAutomations]); - if (error) return
Failed to load
; + if (error) return ; return ( -
-
- -
-
+
+
-
-

Automations

-
+
+

Automations

+
{ authenticatedData ? ( - {authenticatedData.email} - ) - : null + {authenticatedData.email} + ) : null } { ipLocationData && ( @@ -965,7 +999,6 @@ export default function Automations() { { ipLocationData && ( {ipLocationData ? `${ipLocationData.timezone}` : 'Unknown'} - ) }
@@ -973,50 +1006,34 @@ export default function Automations() { { showLoginPrompt && ( + loginRedirectMessage={"Create an account to make your own automation"} + onOpenChange={setShowLoginPrompt} /> ) } - + How it works Automations help you structure your time by automating tasks you do regularly. Build your own, or try out our presets. Get results straight to your inbox. -
+

Your Creations

{ - authenticatedData ? ( - { - setIsCreating(open); - }} - > - - - - - Create Automation - - - - ) + authenticatedData ? + : ( - - - Create Automation - - - - ) + authenticatedData ? + : (
-
+
(null); const [isLoading, setLoading] = useState(true); - const [title, setTitle] = useState('Khoj AI - Chat'); + const [title, setTitle] = useState(defaultTitle); const [conversationId, setConversationID] = useState(null); const [messages, setMessages] = useState([]); const [queryToProcess, setQueryToProcess] = useState(''); @@ -196,7 +199,7 @@ export default function Chat() { } // Track context used for chat response. References are rendered at the end of the chat - ({context, onlineContext} = processMessageChunk(event, currentMessage, context, onlineContext)); + ({ context, onlineContext } = processMessageChunk(event, currentMessage, context, onlineContext)); setMessages([...messages]); } @@ -227,9 +230,9 @@ export default function Chat() { if (isLoading) return ; return ( -
+
- {title} + {`${defaultTitle}${(!!title && title !== defaultTitle)? `: ${title}` : ''}`}
-
+ { + !isMobileWidth && +
+ {title &&

{title}

} +
+ } }> void, diff --git a/src/interface/web/app/common/colorUtils.ts b/src/interface/web/app/common/colorUtils.ts index a739cb398..7e8b3072a 100644 --- a/src/interface/web/app/common/colorUtils.ts +++ b/src/interface/web/app/common/colorUtils.ts @@ -33,7 +33,7 @@ export function convertToBGGradientClass(color: string) { export function convertToBGClass(color: string) { if (tailwindColors.includes(color)) { - return `bg-${color}-500 dark:bg-${color}-900`; + return `bg-${color}-500 dark:bg-${color}-900 hover:bg-${color}-400 dark:hover:bg-${color}-800`; } return `bg-background`; } diff --git a/src/interface/web/app/components/chatHistory/chatHistory.tsx b/src/interface/web/app/components/chatHistory/chatHistory.tsx index 2505dbf7f..53dcb701a 100644 --- a/src/interface/web/app/components/chatHistory/chatHistory.tsx +++ b/src/interface/web/app/components/chatHistory/chatHistory.tsx @@ -92,7 +92,7 @@ export default function ChatHistory(props: ChatHistoryProps) { scrollToBottomAfterDataLoad(); } - }, [chatHistoryRef.current, data]); + }, [data, currentPage]); useEffect(() => { if (!hasMoreMessages || fetchingData) return; @@ -111,7 +111,7 @@ export default function ChatHistory(props: ChatHistoryProps) { } return () => observer.disconnect(); - }, [sentinelRef.current, hasMoreMessages, currentPage, fetchingData]); + }, [hasMoreMessages, currentPage, fetchingData]); useEffect(() => { setHasMoreMessages(true); @@ -160,7 +160,7 @@ export default function ChatHistory(props: ChatHistoryProps) { return () => observer.disconnect(); }, []); - const fetchMoreMessages = (currentPage: number) => { + function fetchMoreMessages(currentPage: number) { if (!hasMoreMessages || fetchingData) return; const nextPage = currentPage + 1; diff --git a/src/interface/web/app/components/chatInputArea/chatInputArea.tsx b/src/interface/web/app/components/chatInputArea/chatInputArea.tsx index 0f8f498b3..6866f8b7d 100644 --- a/src/interface/web/app/components/chatInputArea/chatInputArea.tsx +++ b/src/interface/web/app/components/chatInputArea/chatInputArea.tsx @@ -7,8 +7,8 @@ import { Progress } from "@/components/ui/progress" import 'katex/dist/katex.min.css'; import { - ArrowCircleUp, ArrowRight, + ArrowUp, Browser, ChatsTeardrop, GlobeSimple, @@ -252,7 +252,7 @@ export default function ChatInputArea(props: ChatInputProps) { startRecordingAndTranscribe(); } - }, [recording]); + }, [recording, mediaRecorder]); const chatInputRef = useRef(null); useEffect(() => { @@ -359,7 +359,7 @@ export default function ChatInputArea(props: ChatInputProps) {
} -
+