Gantt

A plan over the app: a top bar to leave by, people and their tasks beside a timeline of months, and a task open in a side panel.

Open full screen

Flat · Takeover. <AppShell direction="flat">: one white surface; lines split the navigation, the page header and the content.

npx wideset add block-gantt

Import the default export from @/blocks/wideset/gantt. The files below are relative to your project's source directory.

Installed with this block
  • app-shell
  • avatar
  • block-styles
  • breadcrumbs
  • button
  • checkbox
  • icon-button
  • navigation-bar
  • progress-bar
  • segmented-control
  • sidepanel
  • status-badge
  • switch
  • tabs
  • tag
  • utils
blocks/wideset/gantt/index.tsx
'use client';

import '@/styles/wideset-blocks.css';

import { AppShell } from '@/components/ui/wideset/app-shell/AppShell';
import { Avatar } from '@/components/ui/wideset/avatar/Avatar';
import { Button } from '@/components/ui/wideset/button/Button';
import { useState } from 'react';

import { GanttChart } from './chart';
import { campaign, viewers } from './data';
import { type TaskDetail, TaskSidepanel } from './task-sidepanel';
import { TopBar } from './top-bar';

/**
 * Gantt, a takeover in the Flat direction: a window over the app with a top bar to leave by,
 * people's work on a timeline, and the task side panel open beside it.
 */
export default function Gantt() {
  const [open, setOpen] = useState(true);
  const [task, setTask] = useState<TaskDetail>(campaign);

  const openTask = (title: string) => {
    setTask({ ...campaign, title });
    setOpen(true);
  };

  return (
    <AppShell className="ws-block-utility" direction="flat">
      <AppShell.Main className="flex flex-col">
        <TopBar />
        <div className="px-ws-11 pt-ws-13 pb-ws-11 flex shrink-0 items-center justify-between">
          <h1 className="typography-title-sm text-ws-static-strong">Marketing</h1>
          <div className="gap-ws-12 flex items-center">
            <Avatar.Group size="md" className="w-auto">
              {viewers.map((viewer) => (
                <Avatar key={viewer.name} initials={viewer.initials} color={viewer.color} />
              ))}
              <Avatar />
            </Avatar.Group>
            <div className="gap-ws-5 flex items-center">
              <Button variant="secondary" preset="border" size="sm">
                Today
              </Button>
              <Button variant="secondary" size="sm">
                Publish
              </Button>
            </div>
          </div>
        </div>
        <GanttChart onOpenTask={openTask} />
      </AppShell.Main>
      <TaskSidepanel task={task} open={open} onOpenChange={setOpen} />
    </AppShell>
  );
}