Skip to content

Commit 1386c2e

Browse files
Add card-only mode to skip table view and hide toggle
Closes #105 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5faea4a commit 1386c2e

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

resources/views/query-table.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<div class="p-4 flex items-center gap-2 justify-between bg-gray-50">
2626

2727
<div class="p-4 flex items-center gap-2">
28-
@if($this->isCardViewEnabled())
28+
@if($this->isCardViewEnabled() && ! $this->isCardOnly())
2929
@include('query-builder::components.view-toggle')
3030
@endif
3131

resources/views/table.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@if($this->isSearchVisible() && $this->searchableColumnsSet() && ! $this->areActionsVisible())
99
@if($this->isFiltered() || $this->isSearchActive() || $this->rows->count() > 0)
1010
<div class="p-4 flex items-center gap-2 w-full">
11-
@if($this->isCardViewEnabled())
11+
@if($this->isCardViewEnabled() && ! $this->isCardOnly())
1212
@include('query-builder::components.view-toggle')
1313
@endif
1414

src/Support/Concerns/WithCardView.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ public function cardLayout(): ?CardLayout
1313
return null;
1414
}
1515

16+
public function isCardOnly(): bool
17+
{
18+
return false;
19+
}
20+
21+
public function mountWithCardView(): void
22+
{
23+
if ($this->isCardOnly() && $this->isCardViewEnabled()) {
24+
$this->viewMode = 'cards';
25+
}
26+
}
27+
1628
public function toggleViewMode(): void
1729
{
1830
$this->viewMode = $this->viewMode === 'table' ? 'cards' : 'table';

0 commit comments

Comments
 (0)