From cbc4dd1bfec63af11a929a0e2ab924a3ecb26796 Mon Sep 17 00:00:00 2001 From: Thomas Peterson Date: Mon, 23 Sep 2024 13:10:38 +0200 Subject: [PATCH] Backup --- app/Components/CreateButton.php | 10 ++++++++++ app/Components/MainLayout.php | 29 ++++++++++++++++++++++++++++ app/Components/ProjectList.php | 28 +++++++++++++++++++++++++++ app/Components/TaskList.php | 20 +++++++++++++++++++ app/Components/WindowView.php | 25 ++++++++++++++++++++++++ app/Views/Components/MainLayout.php | 10 ---------- app/Views/Components/TestButton.php | 10 ---------- app/Views/MainView.php | 30 ----------------------------- app/Windows/MainWindow.php | 20 +++++++++---------- 9 files changed, 122 insertions(+), 60 deletions(-) create mode 100644 app/Components/CreateButton.php create mode 100644 app/Components/MainLayout.php create mode 100644 app/Components/ProjectList.php create mode 100644 app/Components/TaskList.php create mode 100644 app/Components/WindowView.php delete mode 100644 app/Views/Components/MainLayout.php delete mode 100644 app/Views/Components/TestButton.php delete mode 100644 app/Views/MainView.php diff --git a/app/Components/CreateButton.php b/app/Components/CreateButton.php new file mode 100644 index 0000000..35ed42a --- /dev/null +++ b/app/Components/CreateButton.php @@ -0,0 +1,10 @@ +projectList = new ProjectList(); + $this->taskList = new TaskList(); + } + + public function getViews(): ?Views + { + return new Views([ + $this->projectList, + $this->taskList, + ]); + } + +} \ No newline at end of file diff --git a/app/Components/ProjectList.php b/app/Components/ProjectList.php new file mode 100644 index 0000000..51d10fb --- /dev/null +++ b/app/Components/ProjectList.php @@ -0,0 +1,28 @@ +style = 'border-r-4 border-slate-500 basis-2/6'; + $this->createButton = new CreateButton(label: "New Project"); + } + + public function getViews(): ?Views + { + return new Views([ + $this->createButton, + // new Label(label: 'Projects:', style: 'w-full') + ]); + } +} \ No newline at end of file diff --git a/app/Components/TaskList.php b/app/Components/TaskList.php new file mode 100644 index 0000000..6dc6d61 --- /dev/null +++ b/app/Components/TaskList.php @@ -0,0 +1,20 @@ +style = "basis-4/6 bg-sky-400"; + } + + public function getViews(): ?Views + { + return null; + } +} \ No newline at end of file diff --git a/app/Components/WindowView.php b/app/Components/WindowView.php new file mode 100644 index 0000000..f8d7281 --- /dev/null +++ b/app/Components/WindowView.php @@ -0,0 +1,25 @@ +mainLayout = new MainLayout(); + } + + public function getViews(): ?Views + { + return new Views([$this->mainLayout]); + } + +} \ No newline at end of file diff --git a/app/Views/Components/MainLayout.php b/app/Views/Components/MainLayout.php deleted file mode 100644 index 7f9374a..0000000 --- a/app/Views/Components/MainLayout.php +++ /dev/null @@ -1,10 +0,0 @@ -style = "bg-white p-6"; - - $this->testButton = new TestButton(label: "Exit"); - $this->test1Button = new TestButton(label: "Login"); - } - - public function getView(): View - { - return new MainLayout([ - $this->test1Button, - $this->testButton - ]); - } -} \ No newline at end of file diff --git a/app/Windows/MainWindow.php b/app/Windows/MainWindow.php index 83236c8..fd0ae1d 100644 --- a/app/Windows/MainWindow.php +++ b/app/Windows/MainWindow.php @@ -2,27 +2,27 @@ namespace App\Windows; -use App\Views\MainView; +use App\Components\WindowView; use PHPNative\Framework\Application\Window; use PHPNative\UI\View; class MainWindow implements Window { - public function __construct(private MainView $mainView) - { - $this->mainView->testButton->setOnClick(function () use ($mainView) { - echo $this->mainView->testButton->label; - }); - } + public WindowView $windowView; - public function getView(): View + public function __construct() { - return $this->mainView; + $this->windowView = new WindowView(); } public function getTitle(): string { - return "DEMO APP"; + return "Project Management Example Application"; + } + + public function getView(): ?View + { + return $this->windowView; } } \ No newline at end of file