The planning editor
A planning view in Meadowstack, a rota, a machine plan or a booking grid, is an editor: people drag to move, hold Alt to copy, add in an empty cell and watch the totals change as they go, and the keyboard does the same. The kit's component handles the dragging, the keyboard and the announcements, while the page decides what a move means and refuses a bad one before the drop, in words, with the same rule the api uses.
By Bohuslav PoláčekChecked
const planning: RotaPlanning | undefined =
canPlan && view
? {
refuseDrop: (drop) => refusal(view, drop, nameOf),
restFor: (personId, date, kind) => restReason(plannedOf(view), { personId, date, kind }),
onDrop: (drop) => {
if (drop.type === "source") {
const role = shiftRolesOf(drop.to.row)[0];
if (!role || !isKind(drop.source.id)) return;
const input = { personId: drop.to.row, branchId, date: drop.to.column, kind: drop.source.id, role };
void add(input, tx("Směna přidána", "Shift added"));
return;
}
const input = { ...inputOf(drop.item), personId: drop.to.row, date: drop.to.column };
if (drop.copy) void add(input, tx("Směna zkopírována", "Shift copied"));
else void change(drop.item, input, tx("Směna přesunuta", "Shift moved"));
},
onRefuse: (reason) => toast.error(reason),
onOpen: (shift) => setDialog({ mode: "edit", shift }),
onQuickAdd: (input) => void add({ ...input, branchId }, tx("Směna přidána", "Shift added")),
onMore: (personId, date) =>
setDialog({ mode: "add", values: { personId, date, role: shiftRolesOf(personId)[0] } }),
}
: undefined;The flow, step by step
A branch manager plans next week in the demo's restaurant rota:
- Open the week. The rota shows the branch's week by person and day. Above it sits what the week still lacks, such as a missing cook for an afternoon, and below it who changed what.
- Drag a shift to another day or person. While it is in the hand, a cell that cannot take it turns grey and says why under the pointer: time off, another shift that day, a role the person does not work, or a break of the rest rules (11 hours between shifts, 35 in the week). Letting go there sends the shift home with a short shake, and a toast repeats the reason.
- Copy and add. Alt (Option) drags a copy. A template from the strip drops in as a new shift, and the plus in an empty cell adds one in a click. "Add shift" opens the dialog, which greys out the same people for the same reasons.
- Watch the totals. The gaps, the coverage and the hours against the 48-hour week follow every move in the same frame, because they are derived from the week on screen. Whoever may see money also gets each day's labour cost against the expected takings, quiet while the share stays inside 25 to 35 %.
- Undo. Every change shows at once, writes a history entry and offers Undo. "Copy last week" fills the week from the one before, leaving out whoever is away, and is undone as a whole.
- From the keyboard. Space picks a shift up, the arrows choose a cell, Space drops it, Alt with Space drops a copy and Escape cancels. Every step is announced in a live region, a refusal with its reason. The plus in an empty cell is a pointer shortcut kept out of the tab order; from the keyboard a template or "Add shift" does the same.
- Publish. The week stays a draft until "Publish rota". The staff read the last published week, the same grid with no handlers, and publishing tells the people whose shifts changed.
- On a phone the week becomes a list by day, edited through the dialog.
The rules and where each one is enforced
| Rule | Where it is enforced |
|---|---|
| The component handles the interaction, the page decides what it means | handlers on the kit's ScheduleGrid, ResourceTimeline, TimeGrid, GanttChart and SortableBoard; apps never import @dnd-kit or motion (ESLint stops it) |
| A view without handlers is read-only | planning is undefined for anyone who may not plan, in the excerpt above |
| Refuse before the drop, in words | refuseDrop or refuseMove while the thing is in the hand, onRefuse for the toast |
| One rule answers "may this go here?" | busyReason in domain/availability.ts and the rest rules in domain/rest.ts, imported by the grid, the dialog and the api, so all three give the same reason in the same words |
| Totals follow every move | derived from the data on screen, never computed on save; the hours limit is WEEKLY_HOURS_LIMIT in domain/week.ts |
| The keyboard does everything the pointer does | part of the kit's planning components, announcements included; no single-character shortcuts (root AGENTS.md, WCAG 2.1.4) |
| Every change is optimistic, writes history and offers Undo | the module's api writes the event; a rule for every daily screen in the root AGENTS.md |
| A planning view is a work surface | <Screen archetype="workspace">, scrolling inside itself, never the page |
| Now and today come from props | the view never reads the clock, so tests and the visual suite can fix it |
| On a phone, a list | the rota's list by day with its dialog |
docs/recipes/planning-view.md picks the component by the question the view answers, from "who works which day?" (ScheduleGrid) to "what waits for what?" (GanttChart).
What AI coding tools build instead
- A drag library wired into the page. It works with a mouse and nothing else: no keyboard, no announcements, no refusal while dragging. The kit's components carry the keyboard, the announcements and the motion, so no app rebuilds them.
- Telling the person after the drop. The shift lands, the save fails, and a toast says the cook was on leave. Here the cell refuses while the shift is still in the hand.
- The rule in the page and again in the api. They drift, and the dialog offers someone the api then refuses. One function in
domain/, imported by both. - Totals computed on save. The manager plans blind and learns about the overtime afterwards. Here the hours follow every move.
- A move with no history and no Undo. Planning changes are the ones people regret.
- A grid squeezed onto a phone. Drag and fine placement are not for a thumb; the editor becomes a list.
- A conflict hidden by quietly moving the other block. Show the conflict and let the person decide.
Where to see it
- Staff rota: the restaurant's week, the code on this page.
- Capacity planning: people's weeks in a grid, the same component as the rota.
- Court bookings and dispatch plan: resources along a timeline.
- Construction schedule: a Gantt chart of what waits for what.
- Timesheet and task board: a week of time blocks and a board of cards.
- The kit's ScheduleGrid, ResourceTimeline, TimeGrid, GanttChart and SortableBoard.
Example apps with a resource timeline
| Example app | Modules that render it |
|---|---|
| An app for a packaging and print company | Jobs |
| An app for a haulage company | Freight |
| An app for a sports club | Front desk |
| An app for a construction company | Machines |
Questions
How do I make a drag and drop schedule work from the keyboard?
Use a component that has it built in. On the rota, Space picks a shift up, the arrows choose a cell, Space drops it, Alt with Space drops a copy and Escape cancels, and every step is announced in a live region. Rebuilding that for every app is why apps on the framework never import a drag library.
Should a scheduling conflict show before or after the drop?
Before. While the shift is in the hand, a cell that cannot take it turns grey and says why under the pointer. Letting go there sends the shift home with a short shake and the same reason in a toast.
How do the totals stay right while people drag?
They are derived from the week held on screen instead of computed on save, so the gaps, the coverage and the hours follow every move in the same frame.
Can people who only read the plan use the same screen?
Yes. They get the same grid without handlers: nothing moves, and the frame still scrolls from the keyboard. On the demo's rota the staff read the last published week while the manager edits a draft.
What happens to a planning view on a phone?
It becomes a list, by day on the rota, edited through a dialog. Drag and fine placement are not for a thumb.
Related
- A dispatch plan that checks driving hours on every dragScreens
- GanttChart: a project schedule with its links and key datesComponents
- SortableBoard: a kanban board that works from the keyboardComponents
- A restaurant rota planned against the takingsScreens
- A roast plan worked out from the ordersScreens
- Court bookings on a timeline you dragScreens
Two ways
Build it yourself, or have it built
Build it yourself
Build your app on the framework
Get the codebase these apps stand on and build yours with Claude Code, Cursor or Codex.
One payment, lifetime updates
Get the frameworkHave it built
Have us build your app
Tell us how your team works. We plan the app with you and build it on the same framework at a fixed price.
After launch, Care keeps it improving, from €99 a month.
from €1,990
Describe your app