feat: project groups, a month on Kommende, and dragging things where they go

The three the handoff named as next. They are one commit because they are
one mechanism: all three end in something being dragged, and a drop target
cannot tell what is coming without the module they now share.

Groups are foldable headings over the projects in the sidebar. A table
rather than a `group_name` column on the project, because a group has to
be renamable in one write, has to survive being emptied, and has to
remember whether it is folded — none of which a string repeated on every
project row can do.

Folded state lives on the row, not in localStorage. The sidebar's *width*
is a property of the screen you are sitting at, which is why that one is
per browser; a folded group is a statement about the group — "this is the
part of my work I am not in right now" — and it is true on the laptop and
on the desktop. There is nobody else's answer to disagree with either: a
group belongs to exactly one person.

A shared project cannot be filed. `group_id` is a column on the project
row, so a member grouping somebody else's project would move it in the
owner's sidebar too — the same reason `sort_order` is owner-scoped. The
listing reports the column only to the owner, so a viewer is never told
where somebody else keeps it.

Deleting a group takes the heading and leaves the projects, and the
sidebar decides where a project renders by whether its group still
exists rather than by the id alone. A group deleted in another tab
arrives as one event and not one per project, so for a moment the
projects still name a heading that is no longer drawn — filing by the raw
id would drop them out of the sidebar entirely.

Kommende gains the month grid the project pages already had, behind a
Liste/Kalender toggle. The two views ask for different things — seven days
from today against six whole weeks around an arbitrary month — so each
loads its own, and the grid reports which dates it is showing rather than
having the page guess. Which view is remembered in localStorage: a month
of seven columns needs room, and the answer on a phone is not the answer
on a wide monitor.

And a task can now be dropped on a project in the sidebar, on a day in
Kommende, or on a cell in any month grid. Onto a project it is a *move*,
not a field: `sort_order` belongs to the project, so it has to find a
place among that project's tasks and leave its old section behind.

Each drag now carries its own MIME type. `getData` is deliberately
unreadable while a drag is in the air — the browser hands the payload over
on drop and not before, so a page cannot read what is being dragged across
it — and `dataTransfer.types` is all a target has to decide with. Deciding
is the point: calling preventDefault on a drag you cannot accept is what
turns "no" into a silent, wrong drop. The sidebar takes a project and a
task on the same row and has to tell them apart.

Two things fell out of building it. The month grid has always had one cell
narrower than the other six: `.today` styled the "I dag" button in the
header, and the day cell for today wears the same class, so `margin-left:
auto` was shrinking a grid item to its content. It is scoped to the header
now. And a project page listed whatever was in the store rather than what
belonged to that project, which did not matter until a task could leave a
project while you were looking at it.

Covered by eight new API tests and two new smoke tests, and the smoke tests
drive the drags for real — the type check they exercise exists only while
a drag is in flight, so nothing else can reach it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kristian Wind
2026-08-17 19:25:10 +02:00
co-authored by Claude Opus 5
parent 2300f1dc3b
commit c14559ed0c
20 changed files with 1903 additions and 102 deletions
+115
View File
@@ -818,6 +818,89 @@ paths:
"204": { description: Deleted. }
"404": { $ref: "#/components/responses/NotFound" }
/api/v1/project-groups:
get:
tags: [projects]
summary: Your foldable sidebar groups.
description: |
A group is a heading over some of your projects. It is yours rather than
the project's: it has no members and no roles, and a project shared with
you can be filed under one of your groups without the owner seeing it.
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
groups:
type: array
items: { $ref: "#/components/schemas/ProjectGroup" }
post:
tags: [projects]
summary: Make a group.
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ProjectGroupInput" }
responses:
"201": { $ref: "#/components/responses/ProjectGroup" }
"422": { $ref: "#/components/responses/Validation" }
/api/v1/project-groups/reorder:
post:
tags: [projects]
summary: Set the order groups appear in.
description: The whole list at once, for the same reasons as `/projects/reorder`.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [ids]
properties:
ids:
type: array
maxItems: 500
items: { type: string }
description: Group ids, top to bottom.
responses:
"204": { description: Reordered. }
"422": { $ref: "#/components/responses/Validation" }
/api/v1/project-groups/{groupID}:
parameters:
- { name: groupID, in: path, required: true, schema: { type: string } }
patch:
tags: [projects]
summary: Rename a group, or fold it.
description: |
`collapsed` is stored on the account rather than in the browser. The
sidebar's width is a property of the screen you are at; a folded group is
a statement about the group, and is true wherever you sign in.
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ProjectGroupInput" }
responses:
"200": { $ref: "#/components/responses/ProjectGroup" }
"404": { $ref: "#/components/responses/NotFound" }
"422": { $ref: "#/components/responses/Validation" }
delete:
tags: [projects]
summary: Delete a group.
description: |
The heading goes; the projects under it come back out as ungrouped. A
group holds no work of its own, so this is not soft-deleted — there is
nothing in it to recover.
responses:
"204": { description: Deleted. }
"404": { $ref: "#/components/responses/NotFound" }
/api/v1/trash/projects:
get:
tags: [projects]
@@ -2007,6 +2090,11 @@ components:
content:
application/json:
schema: { $ref: "#/components/schemas/Project" }
ProjectGroup:
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/ProjectGroup" }
FeedURL:
description: OK
content:
@@ -2202,6 +2290,12 @@ components:
role: { type: string, enum: [owner, editor, viewer] }
member_count: { type: integer }
shared: { type: boolean }
group_id:
type: string
description: |
The sidebar group *you* have filed it under, absent for none. Always
absent on a project shared with you: grouping is a column on the
project row, so it is the owner's filing rather than yours.
ProjectInput:
type: object
@@ -2212,6 +2306,27 @@ components:
view_mode: { type: string, enum: [list, board, calendar] }
archived: { type: boolean }
sort_order: { type: number }
group_id:
type: string
description: |
Files the project under one of your groups. The empty string takes it
out of one — `null` cannot mean that, because absent and null are the
same thing once decoded, and telling "put it nowhere" apart from "I
did not mention it" is what makes this a PATCH.
ProjectGroup:
type: object
properties:
id: { type: string }
name: { type: string }
collapsed: { type: boolean }
sort_order: { type: number }
ProjectGroupInput:
type: object
properties:
name: { type: string }
collapsed: { type: boolean }
Section:
type: object