import { useState, useMemo } from 'react';
import { Gantt, Editor } from '@svar-ui/react-gantt';
import '@svar-ui/react-gantt/all.css';
const tasks = [
{
id: 1, text: 'Kickoff', type: 'task',
start: new Date(2026, 3, 2), end: new Date(2026, 3, 4), duration: 2, progress: 100,
base_start: new Date(2026, 3, 2), base_end: new Date(2026, 3, 4), base_duration: 2,
},
{
id: 2, text: 'Design', type: 'task',
start: new Date(2026, 3, 7), end: new Date(2026, 3, 14), duration: 5, progress: 50,
base_start: new Date(2026, 3, 5), base_end: new Date(2026, 3, 12), base_duration: 5,
},
{
id: 3, text: 'Development',type: 'task',
start: new Date(2026, 3, 15), end: new Date(2026, 3, 25), duration: 7, progress: 0,
base_start: new Date(2026, 3, 13), base_end: new Date(2026, 3, 22), base_duration: 7,
},
];
const links = [
{ id: 1, source: 1, target: 2, type: 'e2s' },
{ id: 2, source: 2, target: 3, type: 'e2s' },
];
const markers = [
{ start: new Date(2026, 3, 2), text: 'Start', css: 'start-marker' },
{ start: new Date(2026, 3, 8), text: 'Sprint 1 end' },
{ start: new Date(2026, 4, 3), text: 'Delivery', css: 'delivery-marker' },
];
export default function App() {
const [api, setApi] = useState();
return (
<>
<Gantt
ref={setApi}
tasks={tasks}
links={links}
baselines={true}
cellHeight={45}
markers={markers}
/>
{api && <Editor api={api} />}
</>
);
}