Saltar al contenido

Planificación de recursos en una agencia creativa

Una diseñadora tiene doble reserva. Pasa dos tareas a un compañero con un solo arrastre, revisa qué desbloquean y deshazlo.

  • Agencia creativa
  • Studio North
  • Filas de resumen
  • Minimapa
  • Barras de progreso
  • Slots de renderizado React
  • Dependencias
  • Multiselección
  • Control de zoom
  • Columnas de fila
  • Temas
  • Demo con datos sintéticos

Misión

0 de 3 pasos hechos

Viernes, 14:00 en el estudio: Mira está al 120 % en este sprint, dos tareas de Kestrel se solapan con su packaging de Fernhill.

  1. Selecciona «Ajuste del logotipo» y «Visuales clave» en la fila de Mira. — Pendiente

    Haz clic en la primera y Ctrl/⌘+clic en la segunda. El panel resume la selección y aparecen las dependencias de la campaña.

  2. Arrastra cualquiera de las dos hasta Jonas: se mueven juntas. — Pendiente

    Las fechas no cambian y los vínculos las siguen. La carga de Mira baja al 70 %. Soltarlas sobre un redactor se rechaza; el botón de traspaso de una tarjeta pasa una tarea al diseñador menos cargado.

  3. Deshaz la reasignación. — Pendiente

    Un solo paso devuelve las dos tareas: la flecha de la barra de herramientas o Ctrl/⌘+Z con el foco en el tablero.

Unos 30 segundos. Los pasos se marcan a medida que los completas.

Teclado: enfoca la rejilla y usa las flechas, Intro y Alt+flechas para mover.

Studio North
EstrategiaInes Varga70%DiseñoMira Okafor120%Jonas Brandt20%Leo Marchetti30%RedacciónSaskia Moreau60%Theo Lindqvist40%ProducciónAda Kowalczyk0%ClienteRevisiones del clienteAuditoría de marcaKestrel Cycles · HechaInsights de compraFernhill Tea · 80% hechoTaller con comisariosLarkspur Museum · 2 días laborablesAjuste del logotipoKestrel Cycles · 50% hechoVisuales claveKestrel Cycles · 3 días laborablesDiseño de packagingFernhill Tea · 25% hechoClaimsKestrel Cycles · 30% hechoTextos de salaLarkspur Museum · 4 días laborablesRevisión del clienteKestrel Cycles · 1 día laborableKit de lanzamientoKestrel Cycles · 3 días laborablesGuiones del spotFernhill Tea · 5 días laborablesSpot de lanzamientoFernhill Tea · 5 días laborablesAnimación teaserLarkspur Museum · 3 días laborablesSerie de cartelesLarkspur Museum · 4 días laborablesRenovar el portfolioStudio North · Hecha29%29%14%57%57%57%86%57%57%43%43%29%43%Capacidad del equipo19 oct26 oct2 novlun 19mar 20mié 21jue 22vie 23lun 26mar 27mié 28jue 29vie 30lun 2mar 3mié 4

Vista previa del primer fotogramaEn vivo: el motor Pro real, funcionando en tu navegadorUnos 30 segundos. Los pasos se marcan a medida que los completas. Teclado: enfoca la rejilla y usa las flechas, Intro y Alt+flechas para mover.

La situación.

Studio North es una agencia ficticia en la que estrategas, diseñadores, redactores y una productora trabajan a la vez en tres campañas de clientes. Cada campaña es una cadena de tareas: no hay visuales clave antes de cerrar el logotipo, ni kit de lanzamiento antes de que el cliente apruebe la revisión.

En una hoja de cálculo los problemas aparecen tarde: una diseñadora asignada a dos campañas al mismo tiempo, una revisión que no se puede mover, una tarea en manos de quien no puede hacerla. El tablero tiene que mostrar la carga de cada persona, mantener visibles las dependencias cuando el trabajo cambia de manos y permitir deshacer un reparto con facilidad.

Cada cliente tiene su color en todo el tablero, y el plan se lee el viernes por la tarde: lo que está hecho, lo que está en curso y quién carga con más de una semana completa. Un día en rojo en la fila de alguien significa dos tareas el mismo día.

Qué vas a hacer

Seleccionarás dos tareas, se las pasarás a otro diseñador con un solo arrastre, verás cómo se reequilibra la columna de carga mientras los vínculos las siguen y desharás todo el movimiento en un paso.

Dónde termina la librería y empieza tu aplicación.

SuperScheduler aporta

  • Escala por días con los fines de semana ocultos (showNonBusiness: false, eventMoveSkipNonBusiness), zoom con pellizco, Ctrl+rueda o Ctrl +/− (zoomGesture, keyboardOptions.zoomKeys) y con el deslizador de zoom-ui (createZoomSlider), con umbrales lod; el selector de semana desplaza el tablero (scrollTo) y sigue el tema viewport de super-scheduler/hooks (subscribeScheduler).
  • Un árbol de equipos con dos columnas de cabecera (rowHeaderColumns, rowHeaderColumnsMergeParents) escritas en onBeforeRowHeaderRender: avatares, roles y píldoras de carga que cambian con cada movimiento.
  • Una fila resumen fija (frozen: 'top') con la capacidad del equipo por día y un mapa de calor de carga en los días de cada persona, ambos desde onBeforeCellRender y recalculados tras cada cambio.
  • Tarjetas con doble reserva apiladas con eventStackingLineHeight (allowEventOverlap), barras de avance con durationBarMode: 'PercentComplete' y complete, y un área de acción al pasar el ratón (visibility: 'Hover', action: 'None') que traspasa una tarea.
  • Selección con clic y Ctrl/⌘+clic, la API multiselect y un movimiento entre filas registrado como un solo paso de deshacer (createHistory, eventos controlados con onEventsChange), con vínculos curvos de fin a inicio que siguen a las tareas.
  • Tarjetas React (renderEvent) y tarjetas flotantes (eventHover) de super-scheduler/react-render, un separador para el reloj del estudio, cabeceras de tiempo propias (onBeforeTimeHeaderRender), la tarjeta de arrastre y un menú contextual.
  • El minimapa de super-scheduler/minimap bajo el tablero, alimentado con la carga del equipo por día en las cuatro semanas (una serie sobre un rango fijo), un tono por día y etiquetas traducidas; su selector desplaza y amplía el tablero, que se abre en el sprint (cellWidth medido antes del montaje).

El código de este ejemplo decide

  • Qué rol puede asumir cada disciplina y el mensaje de rechazo cuando no puede.
  • La carga del sprint por persona, la capacidad del equipo usada en el sprint y cada día, quién está sobrecargado y el color de cada cliente.
  • Las dependencias entre tareas, cuándo se rompe una, qué vínculos se dibujan (las campañas seleccionadas o todas) y qué enumera la tarjeta flotante.
  • El reloj del estudio (viernes 23 de octubre, 14:00, fijo en la demo), el avance anotado en cada tarea, las revisiones fijadas con el cliente y el compañero menos cargado para un traspaso.
  • La barra del producto, la leyenda de clientes, el resumen de la selección, la misión y todos los textos de esta página.
  • La carga del equipo día a día para la franja, los días en que alguien tiene doble reserva, el día pico y el sprint en el que se abre el tablero.

El código de esta demo.

Son los archivos que ejecuta esta página, no una copia simplificada. Compilan contra los exports públicos de SuperScheduler Pro.

tsx.zip

La integración: escala por días y límites del zoom, columnas de cabecera con avatares y píldoras de carga, la fila de capacidad y el calor diario desde el hook de celdas, tarjetas apiladas con avance y acción al pasar el ratón, vínculos, selección múltiple y los callbacks donde las reglas aceptan o rechazan un movimiento.

/**
 * Studio North resource plan: the team over a four-week window, one colour per client.
 *
 * Library: a day scale with weekends hidden and a free zoom (zoomGesture, driven by the zoom-ui
 * slider), a team tree with two row-header columns written by onBeforeRowHeaderRender, a frozen
 * summary row and per-day load heat from onBeforeCellRender, overlapping cards cascaded with
 * eventStackingLineHeight, PercentComplete duration bars, a hover action area, multiselection and
 * a multi-row move, curved dependency links, a separator for the studio's clock, undo history,
 * keyboard, React cards and hover cards through `super-scheduler/react-render`, the drag card and
 * a context menu.
 * Application: who can take which task, moving a selection together, sprint and daily load, when a
 * dependency is broken, and every figure on the board. Those rules live in ./rules and run inside
 * the callbacks below.
 */
import { useCallback, useEffect, useMemo, type RefObject } from 'react'
import { SuperScheduler } from 'super-scheduler'
import type {
  SchedulerBeforeTimeHeaderRenderArgs,
  SchedulerEventsChangeArgs,
  SchedulerProps,
} from 'super-scheduler'
import type { SchedulerHistory } from 'super-scheduler/history'
import { SuperSchedulerComponent } from 'super-scheduler/react-render'
import { format } from '~/i18n/format'
import { DAY, parseCivil } from '../../scheduler/civil'
import { headerLabel } from '../../scheduler/header-format'
import { unitOfSpan } from '../../scheduler/live-headers'
import { createEventMenu } from '../kit/context-menu'
import { useEventHover } from '../kit/hover-card'
import { KEYS } from '../kit/keys'
import { useDropRefusal } from '../kit/use-drop-refusal'
import { createDragCard } from '../kit/verdict'
import { skinClass, skinMenuTheme } from '../registry'
import type { DemoCommon } from '../types'
import {
  GEOMETRY,
  LOD,
  SUMMARY_ROW,
  ZOOM,
  civilOf,
  clientOf,
  initialsOf,
  isSpecialistId,
  isTaskId,
  readTaskFields,
  rowHeaderWidth,
  specialistName,
  toResources,
  type TaskEvent,
} from './adapter'
import {
  SPECIALISTS,
  SPRINT,
  STUDIO_NOW,
  TEAM_IDS,
  WINDOW,
  type CampaignId,
  type Discipline,
  type SpecialistId,
  type Task,
  type TaskId,
} from './model'
import {
  TEAM,
  capacityUsed,
  dayAllocation,
  handOverCandidate,
  isoWeek,
  moveProblem,
  planGroupMove,
  teamDayLoad,
  workingDays,
  type DependencyIssue,
  type GroupMovePlan,
  type MoveProblem,
  type PlannedMove,
} from './rules'
import { cardParts, type CardParts, type CardSize } from './card-parts'
import { TaskCard, cardHtml, taskCard } from './task-card'
import type { StudioNorthText } from './text'
import './tokens.css'
import './studio.css'

/** What the board asks the demo to do (context menu, hover action). */
export type TaskAction = 'details' | 'hand-over' | 'select-campaign'

const SLUG = 'agency-campaigns'
const NOW = parseCivil(STUDIO_NOW)
const TODAY = NOW - (NOW % DAY)

export interface StudioNorthSchedulerProps {
  readonly events: TaskEvent[]
  readonly tasks: readonly Task[]
  readonly issues: readonly DependencyIssue[]
  /** Sprint load per specialist (1 = 100 %), computed by the rules. */
  readonly loads: ReadonlyMap<SpecialistId, number>
  readonly text: StudioNorthText
  readonly common: DemoCommon
  /** BCP 47 tag for labels, and the scheduler locale id. */
  readonly tag: string
  readonly schedulerLocale: string
  /** Phones: narrower row-header columns (chosen once by the demo). */
  readonly compact: boolean
  /** The narrowest day width: the whole window fills the board. */
  readonly minZoom: number
  /** The day width on mount: the sprint's ten working days fill the board. */
  readonly initialZoom: number
  /** Every dependency, or only those of the campaigns in `focus` (the selection). */
  readonly showAllLinks: boolean
  readonly focus: ReadonlySet<CampaignId>
  readonly history: SchedulerHistory
  readonly controlRef: RefObject<SuperScheduler.Scheduler | null>
  readonly onEventsChange: (args: SchedulerEventsChangeArgs) => void
  readonly onSelectionChange: (ids: TaskId[]) => void
  readonly onMoved: (id: TaskId) => void
  /** A selection dropped together: the application applies and records it as one change. */
  readonly onGroupMove: (moves: readonly PlannedMove[]) => void
  readonly onResized: (id: TaskId) => void
  readonly onRefused: (id: string, message: string) => void
  readonly onAction: (action: TaskAction, id: TaskId) => void
}

/** A selected task gets a ring (red when it starts too early); `sn-selected` is the e2e contract. */
const SELECTED_CLASS = 'sn-selected'

function cardSize(width: number): CardSize {
  return width < 84 ? 'tiny' : width < 140 ? 'compact' : 'full'
}

/** Why one task cannot go to `resource` (a team row, the wrong role, a fixed review), or null. */
function singleProblem(
  data: object,
  resource: SuperScheduler.ResourceId,
): { problem: MoveProblem; discipline: Discipline } | null {
  const fields = readTaskFields(data)
  if (fields === null) return null
  if (!isSpecialistId(resource)) return { problem: 'wrong-role', discipline: fields.discipline }
  const problem = moveProblem(fields, resource)
  return problem === null ? null : { problem, discipline: fields.discipline }
}

/**
 * Time headers: weeks with their ISO number, days with the studio's today in ink. Labels are the
 * preview's (`headerLabel`), so the swap does not jump; cached per cell, the hook runs per cell.
 */
function createHeaderHook(
  tag: string,
  weekLabel: string,
): (args: SchedulerBeforeTimeHeaderRenderArgs) => void {
  const cache = new Map<string, { html: string; css: string; areas: SuperScheduler.AreaData[] }>()
  return (args) => {
    const start = args.header.start.getTime()
    const end = args.header.end.getTime()
    const width = args.control.cellWidth ?? GEOMETRY.day
    const level = args.header.level === 0 ? 'group' : 'cell'
    const unit = unitOfSpan(end - start, level)
    const key = `${level}:${unit}:${start}:${width < 52 ? 'n' : 'w'}`
    let entry = cache.get(key)
    if (entry === undefined) {
      const escape = SuperScheduler.Util.escapeHtml
      const label = escape(headerLabel(start, unit, tag, level, width))
      if (level === 'group') {
        const week =
          unit === 'week'
            ? `<span class="sn-th-week">${escape(format(weekLabel, { week: isoWeek(start) }))}</span>`
            : ''
        entry = { html: `<span class="sn-th-group">${label}${week}</span>`, css: '', areas: [] }
      } else {
        const today = unit === 'day' && start === TODAY
        entry = {
          html: `<span class="sn-th-day">${label}</span>`,
          css: today ? 'sn-th--today' : '',
          // The studio's clock inside its day, as a share of the cell: it follows every zoom.
          areas:
            start <= NOW && NOW < end
              ? [
                  {
                    left: `${((NOW - start) / (end - start)) * 100}%`,
                    bottom: 0,
                    height: 6,
                    width: 2,
                    cssClass: 'sn-th-now',
                  },
                ]
              : [],
        }
      }
      cache.set(key, entry)
    }
    args.header.html = entry.html
    args.header.cssClass = entry.css
    args.header.areas = entry.areas
  }
}

/** Load pill of a person: calm under 80 %, full at 100 %, red above. */
function loadLevel(value: number): 'low' | 'ok' | 'full' | 'over' {
  return value > 1 ? 'over' : value >= 0.95 ? 'full' : value >= 0.5 ? 'ok' : 'low'
}

export function StudioNorthScheduler(props: StudioNorthSchedulerProps) {
  const {
    events,
    tasks,
    issues,
    loads,
    text,
    common,
    tag,
    schedulerLocale,
    compact,
    minZoom,
    initialZoom,
    showAllLinks,
    focus,
    history,
    controlRef,
  } = props
  const {
    onEventsChange,
    onSelectionChange,
    onMoved,
    onGroupMove,
    onResized,
    onRefused,
    onAction,
  } = props

  const resources = useMemo(() => toResources(text), [text])
  // A refused drop (role, fixed review) is said once the pointer is released.
  const refusal = useDropRefusal(onRefused)
  const headerHook = useMemo(() => createHeaderHook(tag, text.week.short), [tag, text])
  const late = useMemo(() => new Set<string>(issues.map((issue) => issue.task)), [issues])

  // Columns are part of the configuration: titles from the page text, widths chosen once.
  const rowHeaderColumns = useMemo<SuperScheduler.RowHeaderColumnData[]>(() => {
    const [person, load] = compact ? GEOMETRY.compactColumns : GEOMETRY.columns
    return [
      { title: text.columns.specialist, width: person, nonresizable: true },
      { title: text.columns.load, width: load, nonresizable: true },
    ]
  }, [text, compact])

  // Finish-to-start links come from the business model, not from the scheduler. By default only
  // the selected campaigns show theirs, so a busy board stays readable.
  const links = useMemo<SuperScheduler.LinkData[]>(() => {
    return tasks.flatMap((task) =>
      !showAllLinks && !focus.has(task.campaign)
        ? []
        : task.after.map((before) => ({
            id: `${before}->${task.id}`,
            from: before,
            to: task.id,
            type: 'FinishToStart' as const,
            ...(issues.some((issue) => issue.task === task.id && issue.waitsFor === before)
              ? { cssClass: 'ss-link--late' }
              : {}),
          })),
    )
  }, [tasks, issues, showAllLinks, focus])

  const config = useMemo<SchedulerProps>(() => {
    const reason = (found: { problem: MoveProblem; discipline: Discipline }) =>
      found.problem === 'fixed' ? text.rules.fixed : text.rules.wrongRole[found.discipline]
    const parts = new Map<string, CardParts>()
    const escape = SuperScheduler.Util.escapeHtml
    const percent = new Intl.NumberFormat(tag, { style: 'percent' })
    const sprintUse = capacityUsed(tasks, SPRINT)

    // The selected tasks move together when the dragged one is part of a multiple selection.
    const groupPlan = (
      dragged: SuperScheduler.EventId,
      start: SuperScheduler.Date,
      resource: SuperScheduler.ResourceId,
    ): GroupMovePlan | null => {
      const ids = new Set(controlRef.current?.multiselect.events().map((event) => event.id()))
      if (ids.size < 2 || !ids.has(dragged) || !isTaskId(dragged)) return null
      const selection = tasks.filter((task) => ids.has(task.id))
      return planGroupMove(selection, dragged, civilOf(start), String(resource))
    }

    return {
      locale: schedulerLocale,
      cssClass: `${skinClass(SLUG)} sn-board`,
      startDate: WINDOW.start,
      days: 28,
      weekStarts: 1,
      scale: 'Day',
      // The sprint fills the board on mount (56 px per day at least); the slider, the week switch
      // and the minimap's brush zoom out to the whole window.
      cellWidth: initialZoom,
      timeHeaders: [{ groupBy: 'Week' }, { groupBy: 'Day' }],
      headerHeight: GEOMETRY.header,
      // Pinch and Ctrl+wheel zoom between the whole window and wide days; cards adapt far out.
      zoomGesture: { min: minZoom, max: ZOOM.max, wheel: 'ctrl' },
      lod: LOD,
      // Weekends stay hidden: the plan counts working days only.
      showNonBusiness: false,
      useEventBoxes: 'Never',
      // Moves keep a task's working days: dropping a Thursday–Friday task on Friday ends it Monday.
      eventMoveSkipNonBusiness: true,
      height: '100%',
      treeEnabled: true,
      treePreventParentUsage: true,
      treeIndent: compact ? 8 : 12,
      rowHeaderColumns,
      rowHeaderColumnsMergeParents: true,
      rowHeaderWidth: rowHeaderWidth(compact),
      rowHeaderWidthAutoFit: false,
      eventHeight: GEOMETRY.event,
      rowMarginTop: GEOMETRY.inset,
      rowMarginBottom: GEOMETRY.inset,
      // A double-booked person's cards pile up instead of stacking in separate lanes.
      eventStackingLineHeight: GEOMETRY.stacking,
      eventBorderRadius: 9,
      // People can be double-booked; the load column and the heat make it visible instead.
      allowEventOverlap: true,
      // Click selects, Ctrl/Cmd+click adds to the selection.
      eventClickHandling: 'Select',
      allowMultiSelect: true,
      timeRangeSelectedHandling: 'Disabled',
      conflictHighlight: true,
      // Progress reported by the owner, as a bar along the card's foot.
      durationBarVisible: true,
      durationBarMode: 'PercentComplete',
      durationBarHeight: 3,
      // The studio's clock: Friday 23 October, 2 PM.
      separators: [{ location: STUDIO_NOW, cssClass: 'sn-now', layer: 'BelowEvents', width: 2 }],
      showToolTip: false,
      keyboardEnabled: true,
      keyboardTarget: 'component',
      keyboardMode: 'Full',
      keyboardOptions: { zoomKeys: true },
      history,
      controlRef,
      onEventsChange,

      onBeforeTimeHeaderRender: headerHook,

      // Row headers: avatar, name and role; the load pill; team rows and the summary's average.
      onBeforeRowHeaderRender: (args) => {
        const id = args.row.id
        const [first, second] = args.row.columns
        if (id === SUMMARY_ROW) {
          args.row.cssClass = 'sn-row--summary'
          if (first !== undefined)
            first.html = `<span class="sn-rh"><span class="sn-rh__text"><span class="sn-rh__name">${escape(text.summary.label)}</span><span class="sn-rh__role">${escape(format(text.summary.meta, { people: TEAM.length }))}</span></span></span>`
          if (second !== undefined) {
            second.html = `<span class="sn-load" data-level="${loadLevel(sprintUse)}">${escape(percent.format(sprintUse))}</span>`
            second.horizontalAlignment = 'right'
          }
          return
        }
        const team = TEAM_IDS.find((candidate) => candidate === id)
        if (team !== undefined) {
          args.row.cssClass = 'sn-row--team'
          const count = SPECIALISTS.filter((person) => person.team === team).length
          if (first !== undefined)
            first.html = `<span class="sn-team">${escape(text.teams[team])}<span class="sn-team__count">${count}</span></span>`
          return
        }
        if (!isSpecialistId(id)) return
        args.row.cssClass = ''
        const person = SPECIALISTS.find((candidate) => candidate.id === id)
        if (person === undefined || first === undefined) return
        const name = specialistName(id, text)
        const avatar =
          person.role === 'client'
            ? '<span class="sn-avatar sn-avatar--client" aria-hidden="true"><svg viewBox="0 0 20 20"><path d="M10 1.8c.5 4.6 3.6 7.7 8.2 8.2-4.6.5-7.7 3.6-8.2 8.2-.5-4.6-3.6-7.7-8.2-8.2 4.6-.5 7.7-3.6 8.2-8.2z" fill="currentColor"/></svg></span>'
            : `<span class="sn-avatar" data-team="${person.team}" aria-hidden="true">${escape(initialsOf(name))}</span>`
        first.html = `<span class="sn-rh">${avatar}<span class="sn-rh__text"><span class="sn-rh__name">${escape(name)}</span><span class="sn-rh__role">${escape(text.roles[person.role])}</span></span></span>`
        const value = loads.get(id)
        if (second === undefined || value === undefined) return
        const label = escape(format(text.loadTitle, { value: Math.round(value * 100) }))
        second.html = `<span class="sn-load" data-level="${loadLevel(value)}" title="${label}">${escape(percent.format(value))}</span>`
        second.horizontalAlignment = 'right'
      },

      // Per-day load: the summary row counts the team's booked capacity, each person's day is
      // tinted by how many tasks it holds (two or more: overbooked).
      onBeforeCellRender: (args) => {
        const { cell } = args
        const day = cell.start.getTime()
        if (cell.resource === SUMMARY_ROW) {
          const value = teamDayLoad(tasks, day)
          const over = value > 1
          cell.properties.cssClass = over ? 'sn-cap sn-cap--over' : 'sn-cap'
          cell.properties.html = `<span class="sn-cap__value">${escape(percent.format(value))}</span><progress class="sn-cap__meter" max="100" value="${Math.min(100, Math.round(value * 100))}"></progress>`
          return
        }
        const owner = cell.resource
        if (cell.isParent || !isSpecialistId(owner) || owner === 'client-desk') return
        const count = dayAllocation(owner, tasks, day)
        const classes = [count >= 2 ? 'sn-heat-over' : count === 1 ? 'sn-heat-1' : '']
        if (day === TODAY) classes.push('sn-today')
        cell.properties.cssClass = classes.join(' ')
      },

      onBeforeEventRender: (args) => {
        const fields = readTaskFields(args.data)
        const id = args.data.id
        if (fields === null || !isTaskId(id)) return
        const start = civilOf(args.data.start)
        const end = civilOf(args.data.end)
        const isLate = late.has(id)
        const key = `${id}|${start}|${end}|${isLate}`
        let content = parts.get(key)
        if (content === undefined) {
          content = cardParts({ id, ...fields, start, end }, isLate, text, tag)
          parts.set(key, content)
        }
        const width = workingDays(start, end) * (args.control.cellWidth ?? GEOMETRY.day)
        // HTML fallback painted until the React card (renderEvent) mounts: the same markup.
        args.data.html = cardHtml(content, cardSize(width))
        const classes = ['sn-ev', `sn-c-${fields.campaign}`]
        if (fields.fixed === true) classes.push('sn-ev--fixed')
        else if (content.done) classes.push('sn-ev--done')
        if (isLate) classes.push('sn-ev--late')
        // Selected tasks get a ring; the control re-runs this hook on selection changes.
        if (args.control.multiselect.events().some((event) => event.id() === id))
          classes.push(SELECTED_CLASS)
        args.data.cssClass = classes.join(' ')
        args.data.ariaLabel = `${clientOf(fields.campaign)}, ${content.title}, ${content.meta}`
        // Progress between start and done fills the bar at the card's foot.
        if (fields.fixed !== true && fields.progress > 0 && fields.progress < 100)
          args.data.complete = fields.progress
        else args.data.barHidden = true
        // A hover button hands the task to the least loaded colleague who can take it.
        const owner = args.data.resource
        const task = tasks.find((candidate) => candidate.id === id)
        const target =
          task === undefined || !isSpecialistId(owner)
            ? null
            : handOverCandidate({ ...task, owner }, tasks, SPRINT)
        args.data.areas =
          target === null || width < 100
            ? []
            : [
                {
                  right: 5,
                  top: (GEOMETRY.event - 26) / 2,
                  width: 26,
                  height: 26,
                  visibility: 'Hover',
                  action: 'None',
                  cssClass: 'sn-act',
                  html: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 20v-1.5A3.5 3.5 0 0 0 11.5 15h-5A3.5 3.5 0 0 0 3 18.5V20"/><circle cx="9" cy="8" r="3.5"/><path d="M17 8h5M19.5 5.5 22 8l-2.5 2.5"/></svg>',
                  toolTip: format(text.actions.handOver, { owner: specialistName(target, text) }),
                  onClick: () => onAction('hand-over', id),
                },
              ]
      },

      // Role compatibility while dragging, for the dragged task and the selection that follows it.
      onEventMoving: (args) => {
        const plan = groupPlan(args.e.id(), args.start, args.resource)
        const found =
          plan === null ? singleProblem(args.e.data, args.resource) : plan.ok ? null : plan
        refusal.track(String(args.e.id()), found === null ? null : reason(found))
        if (found !== null) {
          args.allowed = false
          args.message = reason(found)
        }
      },

      // Final check before the commit (also covers keyboard moves). A selection is moved by the
      // application: the library commit is cancelled and the whole plan becomes one change.
      onEventMove: (args) => {
        const id = String(args.e.id())
        const plan = groupPlan(args.e.id(), args.newStart, args.newResource)
        if (plan !== null) {
          args.preventDefault()
          refusal.clear()
          if (plan.ok) onGroupMove(plan.moves)
          else onRefused(id, reason(plan))
          return
        }
        const found = singleProblem(args.e.data, args.newResource)
        if (found !== null) {
          args.preventDefault()
          refusal.clear()
          onRefused(id, reason(found))
        }
      },

      onEventMoved: (args) => {
        refusal.clear()
        const id = args.e.id()
        if (isTaskId(id)) onMoved(id)
      },

      onEventResized: (args) => {
        refusal.clear()
        const id = args.e.id()
        if (isTaskId(id)) onResized(id)
      },

      // The control owns the selection; React keeps a copy of the ids for the detail panel.
      onEventSelected: () => {
        const selected = controlRef.current?.multiselect.events() ?? []
        onSelectionChange(selected.map((event) => event.id()).filter(isTaskId))
      },
    }
  }, [
    history,
    controlRef,
    late,
    loads,
    tasks,
    compact,
    minZoom,
    initialZoom,
    rowHeaderColumns,
    onEventsChange,
    onMoved,
    onGroupMove,
    onRefused,
    onResized,
    onSelectionChange,
    onAction,
    refusal,
    schedulerLocale,
    headerHook,
    tag,
    text,
  ])

  // React cards: the same parts as the HTML fallback.
  const renderEvent = useMemo<NonNullable<SchedulerProps['renderEvent']>>(
    () =>
      ({ e, data, width }) => {
        const id = e.id()
        const fields = readTaskFields(data)
        if (!isTaskId(id) || fields === null) return e.text()
        const parts = cardParts(
          { id, ...fields, start: civilOf(data.start), end: civilOf(data.end) },
          late.has(id),
          text,
          tag,
        )
        return <TaskCard parts={parts} size={cardSize(width)} />
      },
    [late, text, tag],
  )

  // Hover card: owner, effort, progress, overlaps and dependencies, from the model (./task-card).
  const card = useCallback(
    (event: SuperScheduler.Event) => {
      const task = tasks.find((candidate) => candidate.id === event.id())
      if (task === undefined) return null
      return taskCard({
        task,
        tasks,
        issues,
        load: loads.get(task.owner),
        text,
        common,
        tag,
      })
    },
    [tasks, issues, loads, text, common, tag],
  )
  const { eventHover, suppressHover } = useEventHover(card)

  // Drag verdict on a day board: roles refuse, double-booking and dependencies warn.
  const dragCard = useMemo(
    () =>
      createDragCard({
        tag,
        common,
        days: true,
        overlapAllowed: true,
        rowName: (id) => (isSpecialistId(id) ? specialistName(id, text) : null),
        warn: (info) => {
          const task = tasks.find((candidate) => candidate.id === info.eventId)
          if (task === undefined) return null
          const before = tasks.find(
            (candidate) =>
              task.after.includes(candidate.id) && info.start.getTime() < parseCivil(candidate.end),
          )
          if (before !== undefined) return format(text.card.early, { other: text.tasks[before.id] })
          const next = tasks.find(
            (candidate) =>
              candidate.after.includes(task.id) && parseCivil(candidate.start) < info.end.getTime(),
          )
          return next === undefined
            ? null
            : format(text.card.cascade, { other: text.tasks[next.id] })
        },
      }),
    [tag, common, text, tasks],
  )

  // Context menu: rebuilt when the plan changes, so its labels name the real hand-over.
  const contextMenu = useMemo(
    () =>
      createEventMenu({
        theme: skinMenuTheme(SLUG),
        title: (event) => format(common.kit.menuTitle, { name: event.text() }),
        onOpenChange: (open) => suppressHover(open),
        entries: (event) => {
          const id = event.id()
          const task = tasks.find((candidate) => candidate.id === id)
          if (task === undefined || !isTaskId(id)) return []
          const target = handOverCandidate(task, tasks, SPRINT)
          return [
            {
              label: common.kit.openDetails,
              icon: 'details',
              keys: KEYS.details,
              run: () => onAction('details', id),
            },
            {
              label:
                target === null
                  ? text.actions.noOne
                  : format(text.actions.handOver, { owner: specialistName(target, text) }),
              icon: 'handover',
              primary: true,
              disabled: target === null,
              run: () => onAction('hand-over', id),
            },
            'separator',
            {
              label: format(text.actions.selectCampaign, { campaign: clientOf(task.campaign) }),
              icon: 'layers',
              run: () => onAction('select-campaign', id),
            },
          ]
        },
      }),
    [tasks, common, text, onAction, suppressHover],
  )

  // Imperative and once: a scroll prop would be re-applied on every update.
  useEffect(() => {
    controlRef.current?.scrollTo(WINDOW.start, false, 'left')
  }, [controlRef])

  return (
    <SuperSchedulerComponent
      {...config}
      resources={resources}
      events={events}
      links={links}
      renderEvent={renderEvent}
      eventHover={eventHover}
      dragCard={dragCard}
      contextMenu={contextMenu}
    />
  )
}

El archivo contiene los ficheros de este ejemplo y un README. No incluye SuperScheduler Pro ni ninguna clave de descarga.