Skip to content

Commit 8df56bc

Browse files
authored
Merge pull request #129 from devoption/codex/feat-34-livewire-foundation
feat: add the Livewire UI foundation
2 parents e8efdbe + 7cfa990 commit 8df56bc

File tree

11 files changed

+622
-17
lines changed

11 files changed

+622
-17
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ composer native:dev
6767

6868
That path installs dependencies, prepares the Laravel app, bootstraps NativePHP, and starts the local desktop development loop.
6969

70+
### Frontend Foundation
71+
72+
Katra's base UI foundation now includes Tailwind CSS v4 and Livewire 4.
73+
74+
- Use `npm install` if you only need the frontend toolchain without running the full `composer setup` bootstrap.
75+
- Use `npm run dev` while shaping Blade, Tailwind, and Livewire UI work in the browser.
76+
- Use `npm run build` to verify the production asset bundle.
77+
- Visit `/foundation-preview` to confirm the branded Livewire + Tailwind foundation is rendering successfully.
78+
7079
### Authentication
7180

7281
Katra now uses Laravel Fortify for the first authentication foundation.

app/Livewire/FoundationPreview.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
namespace App\Livewire;
4+
5+
use Illuminate\View\View;
6+
use Livewire\Component;
7+
8+
class FoundationPreview extends Component
9+
{
10+
public int $surfaceIndex = 0;
11+
12+
/**
13+
* @var array<int, array{label: string, title: string, detail: string}>
14+
*/
15+
protected array $surfaces = [
16+
[
17+
'label' => 'Desktop',
18+
'title' => 'Desktop-first shell',
19+
'detail' => 'NativePHP remains the first-class local shell for Katra while Laravel stays at the core.',
20+
],
21+
[
22+
'label' => 'Server',
23+
'title' => 'Server deployment',
24+
'detail' => 'The same Laravel foundation is intended to run as a traditional shared or dedicated server deployment.',
25+
],
26+
[
27+
'label' => 'Container',
28+
'title' => 'Container runtime',
29+
'detail' => 'Docker and Kubernetes targets stay in view so the product model is not trapped in a desktop-only shape.',
30+
],
31+
];
32+
33+
public function cycleSurface(): void
34+
{
35+
$this->surfaceIndex = ($this->surfaceIndex + 1) % count($this->surfaces);
36+
}
37+
38+
public function updatingSurfaceIndex(mixed $value): void
39+
{
40+
$this->surfaceIndex = $this->normalizeSurfaceIndex((int) $value);
41+
}
42+
43+
public function hydrate(): void
44+
{
45+
$this->surfaceIndex = $this->normalizeSurfaceIndex($this->surfaceIndex);
46+
}
47+
48+
public function render(): View
49+
{
50+
$this->surfaceIndex = $this->normalizeSurfaceIndex($this->surfaceIndex);
51+
52+
return view('livewire.foundation-preview', [
53+
'surfaces' => $this->surfaces,
54+
'activeSurface' => $this->surfaces[$this->surfaceIndex],
55+
]);
56+
}
57+
58+
protected function normalizeSurfaceIndex(int $index): int
59+
{
60+
$maxIndex = count($this->surfaces) - 1;
61+
62+
if ($maxIndex < 0 || $index < 0) {
63+
return 0;
64+
}
65+
66+
if ($index > $maxIndex) {
67+
return $maxIndex;
68+
}
69+
70+
return $index;
71+
}
72+
}

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"laravel/mcp": "^0.6.3",
1717
"laravel/pennant": "^1.0",
1818
"laravel/tinker": "^3.0",
19+
"livewire/livewire": "^4.2",
1920
"nativephp/desktop": "dev-l13-compatibility",
2021
"postare/blade-mdi": "^1.0"
2122
},

composer.lock

Lines changed: 77 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)