From bfd0bee4bc47ec4ef344040501dc5bfb8277c160 Mon Sep 17 00:00:00 2001 From: Eser DENIZ Date: Wed, 2 Apr 2025 11:44:16 +0200 Subject: [PATCH 1/3] fix: menu facade + better default for quit --- src/Facades/Menu.php | 37 +++++++++++++++++++------------------ src/Menu/MenuBuilder.php | 4 ++++ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/Facades/Menu.php b/src/Facades/Menu.php index 332de247..a2549884 100644 --- a/src/Facades/Menu.php +++ b/src/Facades/Menu.php @@ -19,25 +19,26 @@ * @method static Link route(string $url, string $label = null, ?string $hotkey = null) * @method static Radio radio(string $label, bool $checked = false, ?string $hotkey = null) * @method static Role app() - * @method static Role file() - * @method static Role edit() - * @method static Role view() - * @method static Role window() - * @method static Role help() - * @method static Role fullscreen() + * @method static Role about(string $label = null) + * @method static Role file(string $label = null) + * @method static Role edit(string $label = null) + * @method static Role view(string $label = null) + * @method static Role window(string $label = null) + * @method static Role help(string $label = null) + * @method static Role fullscreen(string $label = null) * @method static Role separator() - * @method static Role devTools() - * @method static Role undo() - * @method static Role redo() - * @method static Role cut() - * @method static Role copy() - * @method static Role paste() - * @method static Role pasteAndMatchStyle() - * @method static Role reload() - * @method static Role minimize() - * @method static Role close() - * @method static Role quit() - * @method static Role hide() + * @method static Role devTools(string $label = null) + * @method static Role undo(string $label = null) + * @method static Role redo(string $label = null) + * @method static Role cut(string $label = null) + * @method static Role copy(string $label = null) + * @method static Role paste(string $label = null) + * @method static Role pasteAndMatchStyle(string $label = null) + * @method static Role reload(string $label = null) + * @method static Role minimize(string $label = null) + * @method static Role close(string $label = null) + * @method static Role quit(string $label = null) + * @method static Role hide(string $label = null) * @method static void create(MenuItem ...$items) * @method static void default() */ diff --git a/src/Menu/MenuBuilder.php b/src/Menu/MenuBuilder.php index f0627f78..629cbd46 100644 --- a/src/Menu/MenuBuilder.php +++ b/src/Menu/MenuBuilder.php @@ -150,6 +150,10 @@ public function close(?string $label = null): Items\Role public function quit(?string $label = null): Items\Role { + if (is_null($label)) { + $label = config('app.name'); + } + return new Items\Role(RolesEnum::QUIT, $label); } From ed88a8cf6933df1ae412282b817a9402a89c1cda Mon Sep 17 00:00:00 2001 From: Eser DENIZ Date: Wed, 2 Apr 2025 11:48:30 +0200 Subject: [PATCH 2/3] fix: update quit label for better clarity --- src/Menu/MenuBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Menu/MenuBuilder.php b/src/Menu/MenuBuilder.php index 629cbd46..f2ef764a 100644 --- a/src/Menu/MenuBuilder.php +++ b/src/Menu/MenuBuilder.php @@ -151,7 +151,7 @@ public function close(?string $label = null): Items\Role public function quit(?string $label = null): Items\Role { if (is_null($label)) { - $label = config('app.name'); + $label = __('Quit').' '.config('app.name'); } return new Items\Role(RolesEnum::QUIT, $label); From 093db5269048358541cf6764c76084a14df0b805 Mon Sep 17 00:00:00 2001 From: Eser DENIZ Date: Wed, 2 Apr 2025 12:54:38 +0200 Subject: [PATCH 3/3] fix: update method signatures in Menu class to allow nullable labels --- src/Facades/Menu.php | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Facades/Menu.php b/src/Facades/Menu.php index a2549884..d197305e 100644 --- a/src/Facades/Menu.php +++ b/src/Facades/Menu.php @@ -19,26 +19,26 @@ * @method static Link route(string $url, string $label = null, ?string $hotkey = null) * @method static Radio radio(string $label, bool $checked = false, ?string $hotkey = null) * @method static Role app() - * @method static Role about(string $label = null) - * @method static Role file(string $label = null) - * @method static Role edit(string $label = null) - * @method static Role view(string $label = null) - * @method static Role window(string $label = null) - * @method static Role help(string $label = null) - * @method static Role fullscreen(string $label = null) + * @method static Role about(?string $label = null) + * @method static Role file(?string $label = null) + * @method static Role edit(?string $label = null) + * @method static Role view(?string $label = null) + * @method static Role window(?string $label = null) + * @method static Role help(?string $label = null) + * @method static Role fullscreen(?string $label = null) * @method static Role separator() - * @method static Role devTools(string $label = null) - * @method static Role undo(string $label = null) - * @method static Role redo(string $label = null) - * @method static Role cut(string $label = null) - * @method static Role copy(string $label = null) - * @method static Role paste(string $label = null) - * @method static Role pasteAndMatchStyle(string $label = null) - * @method static Role reload(string $label = null) - * @method static Role minimize(string $label = null) - * @method static Role close(string $label = null) - * @method static Role quit(string $label = null) - * @method static Role hide(string $label = null) + * @method static Role devTools(?string $label = null) + * @method static Role undo(?string $label = null) + * @method static Role redo(?string $label = null) + * @method static Role cut(?string $label = null) + * @method static Role copy(?string $label = null) + * @method static Role paste(?string $label = null) + * @method static Role pasteAndMatchStyle(?string $label = null) + * @method static Role reload(?string $label = null) + * @method static Role minimize(?string $label = null) + * @method static Role close(?string $label = null) + * @method static Role quit(?string $label = null) + * @method static Role hide(?string $label = null) * @method static void create(MenuItem ...$items) * @method static void default() */