Skip to content

Commit 5085116

Browse files
committed
Refactor Kanban board page; update a navigation icon type and improve README for clarity and structure
1 parent 2cf5b82 commit 5085116

File tree

2 files changed

+11
-30
lines changed

2 files changed

+11
-30
lines changed

README.md

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -136,29 +136,6 @@ For drag and drop ordering to work, you can either:
136136

137137
For a functional Kanban board, you only need to implement **two methods**:
138138

139-
### 1. getSubject() - Provides the data source
140-
```php
141-
public function getSubject(): Builder
142-
{
143-
return Task::query();
144-
}
145-
```
146-
147-
### 2. mount() - Configures the board
148-
```php
149-
public function mount(): void
150-
{
151-
$this
152-
->titleField('title'); // Required: Field used for card titles
153-
->columnField('status') // Required: Field that determines column placement
154-
->columns([ // Required: Define your columns
155-
'todo' => 'To Do',
156-
'in_progress' => 'In Progress',
157-
'completed' => 'Completed',
158-
])
159-
}
160-
```
161-
162139
### Example: Minimal Read-Only Board
163140

164141
Here's a complete example of a minimal read-only board:
@@ -174,19 +151,21 @@ use Relaticle\Flowforge\Filament\Pages\KanbanBoardPage;
174151

175152
class TasksBoardPage extends KanbanBoardPage
176153
{
177-
protected static ?string $navigationIcon = 'heroicon-o-view-columns';
154+
protected static string|null|\BackedEnum $navigationIcon = 'heroicon-o-view-columns';
178155

156+
// Required: Provide the model data source
179157
public function getSubject(): Builder
180158
{
181159
return Task::query();
182160
}
183161

162+
// Required: To configure the board with title and column fields
184163
public function mount(): void
185164
{
186165
$this
187166
->titleField('title');
188167
->columnField('status')
189-
->columns([
168+
->columns([
190169
'todo' => 'To Do',
191170
'in_progress' => 'In Progress',
192171
'completed' => 'Completed',
@@ -206,6 +185,7 @@ If you want users to be able to add new cards to the board, implement this metho
206185
```php
207186
use Filament\Actions\Action;
208187
use Filament\Forms;
188+
use Filament\Schemas\Schema;
209189

210190
public function createAction(Action $action): Action
211191
{
@@ -214,8 +194,8 @@ public function createAction(Action $action): Action
214194
->icon('heroicon-o-plus')
215195
->modalHeading('Create Task')
216196
->modalWidth('xl')
217-
->form(function (Forms\Form $form) {
218-
return $form->schema([
197+
->form(function (Schema $schema) {
198+
return $schema->schema([
219199
Forms\Components\TextInput::make('title')
220200
->required()
221201
->placeholder('Enter task title')
@@ -237,14 +217,15 @@ If you want users to be able to edit existing cards, implement this method:
237217
```php
238218
use Filament\Actions\Action;
239219
use Filament\Forms;
220+
use Filament\Schemas\Schema;
240221

241222
public function editAction(Action $action): Action
242223
{
243224
return $action
244225
->modalHeading('Edit Task')
245226
->modalWidth('xl')
246-
->form(function (Forms\Form $form) {
247-
return $form->schema([
227+
->form(function (Schema $schema) {
228+
return $schema->schema([
248229
Forms\Components\TextInput::make('title')
249230
->required()
250231
->placeholder('Enter task title')

stubs/kanban-board-page.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use Relaticle\Flowforge\Filament\Pages\KanbanBoardPage;
88

99
class {{ class }} extends KanbanBoardPage
1010
{
11-
protected static ?string $navigationIcon = 'heroicon-o-view-columns';
11+
protected static string|null|\BackedEnum $navigationIcon = 'heroicon-o-view-columns';
1212
protected static ?string $navigationLabel = '{{ navigationLabel }}';
1313
protected static ?string $title = '{{ title }}';
1414

0 commit comments

Comments
 (0)