diff --git a/app/Components/CreateButton.php b/app/Components/CreateButton.php index 35ed42a..1572c87 100644 --- a/app/Components/CreateButton.php +++ b/app/Components/CreateButton.php @@ -6,5 +6,5 @@ use PHPNative\UI\Widget\Button; class CreateButton extends Button { - public string $style = "bg-green-200 hover:bg-white text-black hover:text-green-500 p-4 w-full border border-black hover:border-red-500"; + public string $style = "bg-green-200 hover:bg-white text-black hover:text-green-500 m-10 p-8 w-full border border-black hover:border-red-500"; } \ No newline at end of file diff --git a/app/Components/ProjectList.php b/app/Components/ProjectList.php index 51d10fb..3dbeeb5 100644 --- a/app/Components/ProjectList.php +++ b/app/Components/ProjectList.php @@ -2,6 +2,8 @@ namespace App\Components; +use App\Model\Project; +use PHPNative\Framework\Parallel\Worker; use PHPNative\UI\Collection\Views; use PHPNative\UI\Widget\Container; use PHPNative\UI\Widget\Label; @@ -11,18 +13,64 @@ class ProjectList extends Container public CreateButton $createButton; + public ProjectListData $listData; + + public function __construct() { parent::__construct(); - $this->style = 'border-r-4 border-slate-500 basis-2/6'; + $this->style = 'border-r-4 border-slate-500 basis-2/6 h-full flex flex-col'; $this->createButton = new CreateButton(label: "New Project"); + $this->createButton->setOnClick(fn(Worker $worker) => $this->reloadProjects($worker)); + $this->listData = new ProjectListData(); + } + + private function reloadProjects(Worker $worker): void { + $worker->async(function() { + sleep("1"); + return [ + new Project(uniqid(), "First Project"), + new Project(uniqid(), "Second Project"), + new Project(uniqid(), "First Project"), + new Project(uniqid(), "Second Project"), + new Project(uniqid(), "First Project"), + new Project(uniqid(), "Second Project"), + new Project(uniqid(), "First Project"), + new Project(uniqid(), "Second Project"), + new Project(uniqid(), "First Project"), + new Project(uniqid(), "Second Project"), + new Project(uniqid(), "First Project"), + new Project(uniqid(), "Second Project"), + new Project(uniqid(), "First Project"), + new Project(uniqid(), "Second Project"), + new Project(uniqid(), "First Project"), + new Project(uniqid(), "Second Project"), + new Project(uniqid(), "First Project"), + new Project(uniqid(), "Second Project"), + new Project(uniqid(), "First Project"), + new Project(uniqid(), "Second Project"), + new Project(uniqid(), "First Project"), + new Project(uniqid(), "Second Project"), + new Project(uniqid(), "First Project"), + new Project(uniqid(), "Second Project"), + new Project(uniqid(), "Third Project") + ]; + }, function($data) { + $this->listData->views = new Views(); + + /** @var Project $row */ + foreach($data as $row) { + $this->listData->views->add(new Label($row->title, style: 'w-full p-2 pl-10 hover:bg-slate-300')); + } + }); } public function getViews(): ?Views { return new Views([ $this->createButton, - // new Label(label: 'Projects:', style: 'w-full') + new Label(label: 'Projects:', style: 'ml-10 w-full'), + $this->listData ]); } } \ No newline at end of file diff --git a/app/Components/ProjectListData.php b/app/Components/ProjectListData.php new file mode 100644 index 0000000..66ac12f --- /dev/null +++ b/app/Components/ProjectListData.php @@ -0,0 +1,25 @@ +style = 'flex flex-col overflow-auto'; + $this->views = new Views(); + } + + public function getViews(): ?Views + { + return $this->views; + } +} \ No newline at end of file diff --git a/app/Components/TaskList.php b/app/Components/TaskList.php index 6dc6d61..cc3e868 100644 --- a/app/Components/TaskList.php +++ b/app/Components/TaskList.php @@ -5,16 +5,19 @@ namespace App\Components; use PHPNative\UI\Collection\Views; use PHPNative\UI\View; use PHPNative\UI\Widget\Container; +use PHPNative\UI\Widget\Label; class TaskList extends Container { public function __construct() { - $this->style = "basis-4/6 bg-sky-400"; + $this->style = "basis-4/6 h-full flex flex-col"; } public function getViews(): ?Views { - return null; + return new Views([ + new Label(label: 'Issues', style: 'w-full p-30 m-40 bg-lime-400 text-black') + ]); } } \ No newline at end of file diff --git a/app/Model/Project.php b/app/Model/Project.php new file mode 100644 index 0000000..6ad0dc8 --- /dev/null +++ b/app/Model/Project.php @@ -0,0 +1,10 @@ +