Remember for each user which Kanban cards have their task list open

The open cards are kept in the user's board preferences (expanded_cards,
at most 500), saved without redrawing the board and restored on return.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-30 11:25:58 +02:00
co-authored by Claude Opus 5.5
parent e274a8d2b1
commit 9eac4c4d4e
10 changed files with 172 additions and 21 deletions
@@ -4,7 +4,7 @@
due date, hours and the job's tasks, which open inside the card and can
be marked done. Compact cards have three rows.
--}}
@props(['card', 'compact' => false, 'canMove' => false, 'canColor' => false, 'canCheck' => false])
@props(['card', 'expanded' => false, 'compact' => false, 'canMove' => false, 'canColor' => false, 'canCheck' => false])
@use('App\Modules\Jobs\Presentation\Support\BoardFormat')
@@ -15,7 +15,7 @@
<article
aria-labelledby="card-{{ $card->key() }}-title"
x-data="{ expanded: false }"
x-data="{ expanded: {{ $expanded ? 'true' : 'false' }} }"
class="overflow-hidden rounded-xl border border-neutral-300 bg-white shadow-sm transition dark:border-[#36393f] dark:bg-[#282a2e]"
>
<x-jobs.board.card-header :card="$card" :can-move="$canMove" :can-color="$canColor" />
@@ -40,7 +40,8 @@
@if ($total > 0)
<button
type="button"
x-on:click="expanded = ! expanded"
x-on:click="expanded = ! expanded; $wire.setCardExpanded('{{ $card->key() }}', expanded)"
aria-expanded="{{ $expanded ? 'true' : 'false' }}"
x-bind:aria-expanded="expanded.toString()"
aria-controls="tasks-{{ $card->key() }}"
aria-label="{{ __('jobs.board.tasks_compact', ['done' => $done, 'total' => $total]) }}"
@@ -78,7 +79,8 @@
<div class="border-t border-neutral-200 pt-1 dark:border-[#36393f]">
<button
type="button"
x-on:click="expanded = ! expanded"
x-on:click="expanded = ! expanded; $wire.setCardExpanded('{{ $card->key() }}', expanded)"
aria-expanded="{{ $expanded ? 'true' : 'false' }}"
x-bind:aria-expanded="expanded.toString()"
aria-controls="tasks-{{ $card->key() }}"
class="flex min-h-6 w-full items-center justify-between rounded px-1.5 text-[11px] font-semibold text-neutral-800 transition hover:bg-neutral-100 focus-visible:outline-2 focus-visible:outline-primary-600 dark:text-neutral-100 dark:hover:bg-[#32353b] dark:focus-visible:outline-primary-300"
@@ -91,7 +93,7 @@
@endif
@if ($total > 0)
<div id="tasks-{{ $card->key() }}" x-show="expanded" x-cloak @class(['border-t border-neutral-200 pt-1 dark:border-[#36393f]' => $compact, 'mt-1.5' => ! $compact])>
<div id="tasks-{{ $card->key() }}" x-show="expanded" @unless ($expanded) x-cloak @endunless @class(['border-t border-neutral-200 pt-1 dark:border-[#36393f]' => $compact, 'mt-1.5' => ! $compact])>
<x-jobs.board.task-list :card="$card" :can-check="$canCheck" :compact="$compact" />
</div>
@endif
@@ -3,7 +3,7 @@
open task with a one-click "mark done", lifting tasks into the pipeline
(PIN), and all periods and tasks with a quick add.
--}}
@props(['card', 'compact' => false, 'canMove' => false, 'canColor' => false, 'canCheck' => false, 'canManage' => false])
@props(['card', 'expanded' => false, 'compact' => false, 'canMove' => false, 'canColor' => false, 'canCheck' => false, 'canManage' => false])
@php
$total = count($card->tasks);
@@ -13,7 +13,7 @@
<article
aria-labelledby="card-{{ $card->key() }}-title"
x-data="{ expanded: false }"
x-data="{ expanded: {{ $expanded ? 'true' : 'false' }} }"
class="overflow-hidden rounded-xl border border-neutral-300 bg-white shadow-sm dark:border-[#36393f] dark:bg-[#282a2e]"
>
<x-jobs.board.card-header :card="$card" :can-move="$canMove" :can-color="$canColor" />
@@ -37,8 +37,9 @@
@if ($compact)
<button
type="button"
x-on:click="expanded = ! expanded"
x-bind:aria-expanded="expanded.toString()"
x-on:click="expanded = ! expanded; $wire.setCardExpanded('{{ $card->key() }}', expanded)"
aria-expanded="{{ $expanded ? 'true' : 'false' }}"
x-bind:aria-expanded="expanded.toString()"
aria-controls="tasks-{{ $card->key() }}"
aria-label="{{ __('jobs.board.all_periods', ['done' => $done, 'total' => $total]) }}"
class="inline-flex min-h-6 shrink-0 items-center gap-0.5 rounded bg-neutral-100 px-1.5 text-[10px] font-bold text-neutral-800 transition hover:bg-neutral-200 focus-visible:outline-2 focus-visible:outline-primary-600 dark:bg-[#1e2023] dark:text-neutral-100 dark:hover:bg-[#32353b] dark:focus-visible:outline-primary-300"
@@ -87,8 +88,9 @@
<div class="border-t border-neutral-200 pt-1 dark:border-[#36393f]">
<button
type="button"
x-on:click="expanded = ! expanded"
x-bind:aria-expanded="expanded.toString()"
x-on:click="expanded = ! expanded; $wire.setCardExpanded('{{ $card->key() }}', expanded)"
aria-expanded="{{ $expanded ? 'true' : 'false' }}"
x-bind:aria-expanded="expanded.toString()"
aria-controls="tasks-{{ $card->key() }}"
class="flex min-h-6 w-full items-center justify-between rounded px-1.5 text-[11px] font-semibold text-neutral-800 transition hover:bg-neutral-100 focus-visible:outline-2 focus-visible:outline-primary-600 dark:text-neutral-100 dark:hover:bg-[#32353b] dark:focus-visible:outline-primary-300"
>
@@ -98,7 +100,7 @@
</div>
@endunless
<div id="tasks-{{ $card->key() }}" x-show="expanded" x-cloak class="space-y-1.5 border-t border-neutral-200 pt-1 dark:border-[#36393f]">
<div id="tasks-{{ $card->key() }}" x-show="expanded" @unless ($expanded) x-cloak @endunless class="space-y-1.5 border-t border-neutral-200 pt-1 dark:border-[#36393f]">
<x-jobs.board.task-list :card="$card" :can-check="$canCheck" :can-manage="$canManage" ongoing :compact="$compact" />
</div>
</div>