Skip to content

Commit

Permalink
Feat: List Boards
Browse files Browse the repository at this point in the history
  • Loading branch information
ismaail committed Sep 24, 2024
2 parents 17c3283 + e28283c commit 481fabe
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 5 deletions.
29 changes: 29 additions & 0 deletions app/Livewire/HomeComponent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace App\Livewire;

use Domain\Board\Models\Board;
use Domain\User\Models\User;
use Illuminate\Container\Attributes\CurrentUser;
use Illuminate\Contracts\View\View;
use Livewire\Component;

class HomeComponent extends Component
{
private User $user;

public function boot(#[CurrentUser] User $user): void
{
$this->user = $user;
}

public function render(): View
{
return view('livewire.home-component')
->with('boards', Board::all())
->with('current_board_id', $this->user->currentCard?->bucket->board_id)
;
}
}
3 changes: 3 additions & 0 deletions resources/views/components/icons/plus.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<svg {{ $attributes->twMerge('size-6') }} xmlns="http://www.w3.org/2000/svg" fill="fillColor" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
</svg>
2 changes: 1 addition & 1 deletion resources/views/components/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<body>
<nav>
<div class="flex flex-wrap items-start justify-between max-w-screen-xl mx-auto p-4">
<a href="#" class="flex items-center space-x-2">
<a href="{{ route('home') }}" class="flex items-center space-x-2">
<img src="{{ asset('images/logo-m.jpg') }}" class="h-8" alt="Task Pilot Logo" />
<span class="self-center text-3xl font-semibold whitespace-nowrap text-primary">Task Pilot</span>
</a>
Expand Down
17 changes: 17 additions & 0 deletions resources/views/livewire/home-component.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<x-slot name="title">Boards</x-slot>
<div class="flex flex-col w-full px-4 pb-4">
<h1 class="p-4 bg-white/5 rounded text-lg font-semibold text-white">All Board</h1>
<div class="flex w-full flex-grow items-start overflow-y-hidden mt-4 space-x-3">
@foreach($boards as $board)
<a href="{{ route('boards.show', $board->id) }}" class="flex items-center w-72 p-2 space-y-2 rounded bg-gray-100 hover:bg-white/90 font-semibold">
{{ $board->name }}
@if ($current_board_id === $board->id)
<x-icons.play class="ms-auto size-5 fill-primary text-primary"></x-icons.play>
@endif
</a>
@endforeach
<button class="flex items-center gap-x-1 w-72 p-2 rounded text-white hover:text-primary font-semibold cursor-pointer">
<x-icons.plus class="size-5" /> New Board
</button>
</div>
</div>
7 changes: 3 additions & 4 deletions routes/web.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php

use App\Livewire\Board\BoardComponent;
use App\Livewire\HomeComponent;
use Illuminate\Support\Facades\Route;

Route::get('/', function () {
return view('welcome');
});

Route::group(['middleware' => ['auth', 'verified']], function () {
Route::get('/', HomeComponent::class)->name('home');

Route::get('boards/{board}', BoardComponent::class)->name('boards.show');
});

0 comments on commit 481fabe

Please sign in to comment.