Skip to content

Commit b605e96

Browse files
committed
Refactor Board component to simplify configuration handling and improve data access
1 parent 969820a commit b605e96

File tree

7 files changed

+13
-265
lines changed

7 files changed

+13
-265
lines changed

resources/views/index.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ class="w-full h-full flex flex-col relative"
88
x-data="flowforge({
99
state: {
1010
columns: @js($columns),
11-
titleField: '{{ $config->getTitleField() }}',
12-
columnField: '{{ $config->getColumnField() }}',
13-
cardLabel: '{{ $config->getSingularCardLabel() }}',
14-
pluralCardLabel: '{{ $config->getPluralCardLabel() }}'
11+
titleField: '{{ $config['recordTitleAttribute'] }}',
12+
columnField: '{{ $config['columnIdentifierAttribute'] }}',
13+
cardLabel: '{{ $config['cardLabel'] }}',
14+
pluralCardLabel: '{{ $config['pluralCardLabel'] }}',
1515
}
1616
})"
1717
>

resources/views/livewire/card.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@props(['config', 'columnId', 'record'])
1+
@props(['columnId', 'record'])
22

33
@php
44
$processedRecordActions = $this->getCardActionsForRecord($record);

resources/views/livewire/column.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ class="text-xs text-primary-600 dark:text-primary-400">
8484
<div wire:loading.remove wire:target="loadMoreItems('{{ $columnId }}')"
8585
class="text-xs text-gray-400">
8686
{{ count($column['items']) }}
87-
/ {{ $column['total'] }} {{ $config->getPluralCardLabel() }}
87+
/ {{ $column['total'] }} {{ $config['pluralCardLabel'] }}
8888
</div>
8989
</div>
9090
@endif
9191
@else
9292
<x-flowforge::empty-column
9393
:columnId="$columnId"
94-
:pluralCardLabel="$config->getPluralCardLabel()"
94+
:pluralCardLabel="$config['pluralCardLabel']"
9595
/>
9696
@endif
9797
</div>

src/Board.php

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -61,35 +61,6 @@ protected function setUp(): void
6161
*/
6262
public function getViewData(): array
6363
{
64-
// Direct delegation to Livewire component (no adapter)
65-
$livewire = $this->getLivewire();
66-
67-
// Create simple config object
68-
$config = new class($this)
69-
{
70-
public function __construct(private Board $board) {}
71-
72-
public function getTitleField(): string
73-
{
74-
return $this->board->getRecordTitleAttribute();
75-
}
76-
77-
public function getColumnField(): string
78-
{
79-
return $this->board->getColumnIdentifierAttribute() ?? 'status';
80-
}
81-
82-
public function getSingularCardLabel(): string
83-
{
84-
return 'Card';
85-
}
86-
87-
public function getPluralCardLabel(): string
88-
{
89-
return 'Cards';
90-
}
91-
};
92-
9364
// Build columns data using new concerns
9465
$columns = [];
9566
foreach ($this->getColumns() as $column) {
@@ -110,7 +81,12 @@ public function getPluralCardLabel(): string
11081

11182
return [
11283
'columns' => $columns,
113-
'config' => $config,
84+
'config' => [
85+
'recordTitleAttribute' => $this->getRecordTitleAttribute(),
86+
'columnIdentifierAttribute' => $this->getColumnIdentifierAttribute(),
87+
'cardLabel' => 'Record',
88+
'pluralCardLabel' => 'Records',
89+
]
11490
];
11591
}
11692

src/Enums/KanbanColor.php

Lines changed: 0 additions & 66 deletions
This file was deleted.

src/Property.php

Lines changed: 0 additions & 162 deletions
This file was deleted.

src/Testing/TestsFlowforge.php

Whitespace-only changes.

0 commit comments

Comments
 (0)