Skip to content

Commit 134388b

Browse files
committed
add new details components and using coral layout
1 parent 35743b0 commit 134388b

7 files changed

Lines changed: 215 additions & 69 deletions

File tree

src/frontend_react/src/components/AppProvider.tsx

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,14 @@ interface AppProviderProps {
99
}
1010

1111
// Create a custom theme with brand colors for your application
12-
const myTheme: ITheme = createTheme({
13-
palette: {
14-
themePrimary: '#643A61',
15-
themeLighterAlt: '#F2B8FF',
16-
themeLighter: '#CE85DA',
17-
themeLight: '#B26BB1',
18-
themeTertiary: '#9F5E9D',
19-
themeSecondary: '#8B5189',
20-
themeDarkAlt: '#774575',
21-
themeDark: '#643A61',
22-
themeDarker: '#512F4E',
23-
neutralLighterAlt: '#faf9f8',
24-
neutralLighter: '#f3f2f1',
25-
neutralLight: '#edebe9',
26-
neutralQuaternaryAlt: '#e1dfdd',
27-
neutralQuaternary: '#d0d0d0',
28-
neutralTertiaryAlt: '#c8c6c4',
29-
neutralTertiary: '#a19f9d',
30-
neutralSecondary: '#605e5c',
31-
neutralPrimaryAlt: '#3b3a39',
32-
neutralPrimary: '#323130',
33-
neutralDark: '#201f1e',
34-
black: '#000000',
35-
white: '#ffffff',
36-
}
37-
});
12+
3813

3914
/**
4015
* Provider component to initialize the Fluent UI theme provider
4116
*/
4217
const AppProvider: React.FC<AppProviderProps> = ({ children }) => {
4318
return (
44-
<ThemeProvider theme={myTheme}>
19+
<ThemeProvider>
4520
{children}
4621
</ThemeProvider>
4722
);
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import {
2+
Body1,
3+
Button,
4+
Card,
5+
Checkbox,
6+
Divider,
7+
Persona,
8+
Text,
9+
Subtitle1,
10+
} from "@fluentui/react-components";
11+
import { Add20Regular } from "@fluentui/react-icons";
12+
import React from "react";
13+
import { TaskDetailsProps } from "../../models";
14+
import "../../styles/TaskDetails.css";
15+
16+
const TaskDetails: React.FC<TaskDetailsProps> = ({
17+
taskName,
18+
subTasks,
19+
agents,
20+
humans,
21+
22+
}) => {
23+
const completedCount = subTasks.filter(t => t.status === 'completed').length;
24+
25+
return (
26+
<div className="task-details-container">
27+
<div className="task-details-section">
28+
<div className="task-details-progress-header">
29+
<Subtitle1>{taskName}</Subtitle1>
30+
<Text size={200}>
31+
{completedCount} of {subTasks.length} completed
32+
</Text>
33+
</div>
34+
<div className="task-details-subtask-list">
35+
{subTasks.map((subtask) => (
36+
<Checkbox
37+
key={subtask.id}
38+
checked={subtask.status === 'completed'}
39+
disabled
40+
label={subtask.name}
41+
/>
42+
))}
43+
</div>
44+
</div>
45+
46+
<Divider />
47+
48+
<div className="task-details-section">
49+
<Subtitle1>Agents</Subtitle1>
50+
{agents.map((agent) => (
51+
<Card key={agent.id} className="task-details-agent-card">
52+
<Persona
53+
name={agent.name}
54+
secondaryText={agent.description}
55+
avatar={{ image: { src: agent.avatarUrl } }}
56+
presence={{ status: "available" }}
57+
/>
58+
</Card>
59+
))}
60+
61+
</div>
62+
63+
<Divider />
64+
65+
<div className="task-details-section">
66+
<Subtitle1>Humans</Subtitle1>
67+
{humans.map((human) => (
68+
<Card key={human.id} className="task-details-agent-card">
69+
<Persona
70+
name={human.name}
71+
secondaryText={human.email}
72+
avatar={{ image: { src: human.avatarUrl } }}
73+
presence={{ status: "available" }}
74+
/>
75+
</Card>
76+
))}
77+
</div>
78+
</div>
79+
);
80+
};
81+
82+
export default TaskDetails;

src/frontend_react/src/models/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ export * from './plan';
1010
export * from './messages';
1111
export * from './inputTask';
1212
export * from './agentMessage';
13+
export * from './taskDetails';
1314

1415
// Add other model exports as needed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export interface SubTask {
2+
id: string;
3+
name: string;
4+
status: 'completed' | 'working' | 'removed';
5+
}
6+
7+
export interface Agent {
8+
id: string;
9+
name: string;
10+
description: string;
11+
avatarUrl?: string;
12+
}
13+
14+
export interface Human {
15+
id: string;
16+
name: string;
17+
email: string;
18+
avatarUrl?: string;
19+
}
20+
21+
export interface TaskDetailsProps {
22+
taskName: string;
23+
subTasks: SubTask[];
24+
agents: Agent[];
25+
humans: Human[];
26+
onAddAgent: () => void;
27+
onAddHuman: () => void;
28+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React from 'react';
2+
import { useParams, useNavigate } from 'react-router-dom';
3+
import {
4+
Button,
5+
Text,
6+
Card,
7+
CardHeader
8+
} from '@fluentui/react-components';
9+
import {
10+
ArrowLeft24Regular,
11+
ErrorCircle24Regular
12+
} from '@fluentui/react-icons';
13+
import PlanView from '../components/PlanView';
14+
import '../styles/PlanPage.css';
15+
import CoralShellColumn from '../coral/components/Layout/CoralShellColumn';
16+
import CoralShellRow from '../coral/components/Layout/CoralShellRow';
17+
import Content from '../coral/components/Content/Content';
18+
19+
/**
20+
* Page component for displaying a specific plan
21+
* Accessible via the route /plan/{plan_id}
22+
*/
23+
const HomePage: React.FC = () => {
24+
const { planId } = useParams<{ planId: string }>();
25+
const navigate = useNavigate();
26+
27+
// Handle back navigation
28+
const handleBackClick = () => {
29+
navigate(-1);
30+
};
31+
32+
// Show error if no planId is provided
33+
34+
35+
return (
36+
<CoralShellColumn>
37+
<CoralShellRow>
38+
<Content>
39+
40+
</Content>
41+
42+
</CoralShellRow>
43+
</CoralShellColumn>
44+
);
45+
};
46+
47+
export default HomePage;

src/frontend_react/src/pages/PlanPage.tsx

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import {
1212
} from '@fluentui/react-icons';
1313
import PlanView from '../components/PlanView';
1414
import '../styles/PlanPage.css';
15+
import CoralShellColumn from '../coral/components/Layout/CoralShellColumn';
16+
import CoralShellRow from '../coral/components/Layout/CoralShellRow';
17+
import Content from '../coral/components/Content/Content';
1518

1619
/**
1720
* Page component for displaying a specific plan
@@ -27,51 +30,17 @@ const PlanPage: React.FC = () => {
2730
};
2831

2932
// Show error if no planId is provided
30-
if (!planId) {
31-
return (
32-
<div className="plan-page-container">
33-
<div className="plan-page-error">
34-
<Card>
35-
<CardHeader
36-
header={
37-
<div className="error-header">
38-
<ErrorCircle24Regular />
39-
<Text weight="semibold">Invalid Plan ID</Text>
40-
</div>
41-
}
42-
/>
43-
<div className="card-content">
44-
<Text>No plan ID was provided in the URL. Please check the URL and try again.</Text>
45-
</div>
46-
</Card>
47-
</div>
48-
</div>
49-
);
50-
}
33+
5134

5235
return (
53-
<div className="plan-page-container">
54-
<div className="plan-page-header">
55-
<Button
56-
className="back-button"
57-
appearance="subtle"
58-
icon={<ArrowLeft24Regular />}
59-
onClick={handleBackClick}
60-
>
61-
Back
62-
</Button>
63-
<Text className="page-title" size={800} weight="bold">
64-
Plan Details
65-
</Text>
66-
</div>
36+
<CoralShellColumn>
37+
<CoralShellRow>
38+
<Content>
39+
40+
</Content>
6741

68-
<div className="plan-page-content">
69-
<PlanView
70-
sessionId="default" // TODO: Get from context/state management
71-
planId={planId}
72-
/>
73-
</div>
74-
</div>
42+
</CoralShellRow>
43+
</CoralShellColumn>
7544
);
7645
};
7746

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/* TaskDetails.css */
2+
.task-details-container {
3+
display: flex;
4+
flex-direction: column;
5+
height: 100%;
6+
background-color: #fafafa; /* tokens.colorNeutralBackground1 equivalent */
7+
overflow: auto;
8+
}
9+
10+
.task-details-section {
11+
display: flex;
12+
flex-direction: column;
13+
gap: 12px;
14+
padding: 16px;
15+
}
16+
17+
.task-details-progress-header {
18+
display: flex;
19+
align-items: center;
20+
justify-content: space-between;
21+
}
22+
23+
.task-details-subtask-list {
24+
display: flex;
25+
flex-direction: column;
26+
gap: 8px;
27+
}
28+
29+
.task-details-agent-card {
30+
cursor: default;
31+
padding: 12px;
32+
}
33+
34+
.task-details-add-button {
35+
align-self: flex-start;
36+
}
37+
38+
.task-details-section-title {
39+
font-weight: 600; /* tokens.fontWeightSemibold equivalent */
40+
}
41+
42+
.task-details-task-title {
43+
font-weight: 600; /* tokens.fontWeightSemibold equivalent */
44+
}

0 commit comments

Comments
 (0)