Mayank2027 commited on
Commit
4d3a867
·
verified ·
1 Parent(s): fb24fd4

Create frontend/src/components/BackgroundTasks.tsx

Browse files
frontend/src/components/BackgroundTasks.tsx ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { useState, useEffect } from 'react';
2
+ import axios from 'axios';
3
+
4
+ const BackgroundTasks: React.FC = () => {
5
+ const [tasks, setTasks] = useState<string[]>([]);
6
+
7
+ const pollTasks = async () => {
8
+ try {
9
+ const res = await axios.get('/api/agent/tasks');
10
+ setTasks(res.data.tasks || []);
11
+ } catch (e) {}
12
+ };
13
+
14
+ useEffect(() => {
15
+ pollTasks();
16
+ const interval = setInterval(pollTasks, 3000);
17
+ return () => clearInterval(interval);
18
+ }, []);
19
+
20
+ return (
21
+ <div style={{ padding: 12 }}>
22
+ <div style={{ fontWeight: 600, marginBottom: 8 }}>Background Agents</div>
23
+ {tasks.length === 0 && <div style={{ color: 'var(--text-secondary)', fontSize: 12 }}>No running tasks</div>}
24
+ {tasks.map(task => (
25
+ <div key={task} style={{ background: 'var(--bg-tertiary)', padding: '4px 8px', borderRadius: 4, marginBottom: 4, fontSize: 12 }}>
26
+ {task} – running
27
+ </div>
28
+ ))}
29
+ </div>
30
+ );
31
+ };
32
+
33
+ export default BackgroundTasks;