Skip to content

Commit a0d983b

Browse files
feat(ui): add scheduled tasks first pass
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 021a6c7 commit a0d983b

12 files changed

Lines changed: 1340 additions & 29 deletions

agentex-ui/components/agentex-ui-root.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export function AgentexUIRoot() {
6767
(taskId: string | null) => {
6868
updateParams({
6969
[SearchParamKey.TASK_ID]: taskId,
70+
[SearchParamKey.VIEW]: null,
7071
});
7172
},
7273
[updateParams]

agentex-ui/components/primary-content/primary-content.tsx

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import { ArrowDown } from 'lucide-react';
66
import { ChatView } from '@/components/primary-content/chat-view';
77
import { HomeView } from '@/components/primary-content/home-view';
88
import { PromptInput } from '@/components/primary-content/prompt-input';
9+
import { ScheduledTasksPage } from '@/components/scheduled-tasks/scheduled-tasks-page';
910
import { IconButton } from '@/components/ui/icon-button';
10-
import { useSafeSearchParams } from '@/hooks/use-safe-search-params';
11+
import { AppView, useSafeSearchParams } from '@/hooks/use-safe-search-params';
1112

1213
type ContentAreaProps = {
1314
isTracesSidebarOpen: boolean;
@@ -18,7 +19,8 @@ export function PrimaryContent({
1819
isTracesSidebarOpen,
1920
toggleTracesSidebar,
2021
}: ContentAreaProps) {
21-
const { taskID } = useSafeSearchParams();
22+
const { taskID, view } = useSafeSearchParams();
23+
const isScheduledTasksView = view === AppView.SCHEDULED_TASKS;
2224

2325
const [prompt, setPrompt] = useState<string>('');
2426
const [showScrollButton, setShowScrollButton] = useState(false);
@@ -56,20 +58,24 @@ export function PrimaryContent({
5658
}, [scrollContainerRef]);
5759

5860
useEffect(() => {
59-
if (scrollContainerRef.current && taskID) {
61+
if (scrollContainerRef.current && taskID && !isScheduledTasksView) {
6062
setTimeout(() => {
6163
scrollToBottom();
6264
}, 150);
6365
}
64-
}, [scrollToBottom, taskID]);
66+
}, [scrollToBottom, taskID, isScheduledTasksView]);
6567

6668
return (
6769
<motion.div
6870
layout
69-
className={`relative flex h-full flex-1 flex-col ${!taskID ? 'justify-center' : 'justify-between'}`}
71+
className={`relative flex h-full flex-1 flex-col ${
72+
!taskID && !isScheduledTasksView ? 'justify-center' : 'justify-between'
73+
}`}
7074
transition={{ duration: 0.25, ease: 'easeInOut' }}
7175
>
72-
{taskID ? (
76+
{isScheduledTasksView ? (
77+
<ScheduledTasksPage />
78+
) : taskID ? (
7379
<ChatView
7480
taskID={taskID}
7581
isTracesSidebarOpen={isTracesSidebarOpen}
@@ -81,26 +87,28 @@ export function PrimaryContent({
8187
<HomeView />
8288
)}
8389

84-
<motion.div
85-
layout="position"
86-
className="relative flex w-full justify-center px-4 py-4 sm:px-6 md:px-8"
87-
transition={{
88-
layout: {
89-
type: 'spring',
90-
damping: 40,
91-
stiffness: 300,
92-
mass: 0.8,
93-
},
94-
}}
95-
>
96-
<AnimatePresence>
97-
{taskID && showScrollButton && (
98-
<ScrollToBottomButton scrollToBottom={scrollToBottom} />
99-
)}
100-
</AnimatePresence>
101-
102-
<PromptInput prompt={prompt} setPrompt={setPrompt} />
103-
</motion.div>
90+
{!isScheduledTasksView && (
91+
<motion.div
92+
layout="position"
93+
className="relative flex w-full justify-center px-4 py-4 sm:px-6 md:px-8"
94+
transition={{
95+
layout: {
96+
type: 'spring',
97+
damping: 40,
98+
stiffness: 300,
99+
mass: 0.8,
100+
},
101+
}}
102+
>
103+
<AnimatePresence>
104+
{taskID && showScrollButton && (
105+
<ScrollToBottomButton scrollToBottom={scrollToBottom} />
106+
)}
107+
</AnimatePresence>
108+
109+
<PromptInput prompt={prompt} setPrompt={setPrompt} />
110+
</motion.div>
111+
)}
104112
</motion.div>
105113
);
106114
}

agentex-ui/components/providers/agentex-provider.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import AgentexSDK from 'agentex';
66

77
interface AgentexContextValue {
88
agentexClient: AgentexSDK;
9+
agentexAPIBaseURL: string;
910
sgpAppURL: string;
1011
}
1112

@@ -34,7 +35,9 @@ export function AgentexProvider({
3435
);
3536

3637
return (
37-
<AgentexContext.Provider value={{ agentexClient, sgpAppURL }}>
38+
<AgentexContext.Provider
39+
value={{ agentexClient, agentexAPIBaseURL, sgpAppURL }}
40+
>
3841
{children}
3942
</AgentexContext.Provider>
4043
);

0 commit comments

Comments
 (0)