From a859b4c40dbd845425d76dfdbdd8ef71f76ef135 Mon Sep 17 00:00:00 2001 From: Xinecraft Date: Sat, 26 Oct 2024 00:35:07 +0530 Subject: [PATCH] add banwarden to nav --- .../Components/PhpVarsToJsTransformer.php | 34 +++++++++++++------ config/minetrax.php | 8 +++++ 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/app/View/Components/PhpVarsToJsTransformer.php b/app/View/Components/PhpVarsToJsTransformer.php index f6c16a8ca..05efebf3e 100644 --- a/app/View/Components/PhpVarsToJsTransformer.php +++ b/app/View/Components/PhpVarsToJsTransformer.php @@ -25,14 +25,6 @@ class PhpVarsToJsTransformer extends Component 'key' => 'route-stats-01', 'authenticated' => false, ], - [ - 'type' => 'route', - 'name' => 'Polls', - 'title' => 'Polls', - 'route' => 'poll.index', - 'key' => 'route-polls-01', - 'authenticated' => false, - ], ]; const DEFAULT_NAV_RIGHT = [ @@ -99,7 +91,7 @@ class PhpVarsToJsTransformer extends Component public function render() { $useWebsockets = config('broadcasting.default') == 'pusher' || config('broadcasting.default') == 'ably'; - $useWebsockets = $useWebsockets && config('broadcasting.connections.'.config('broadcasting.default').'.key'); + $useWebsockets = $useWebsockets && config('broadcasting.connections.' . config('broadcasting.default') . '.key'); $pusher = [ 'USE_WEBSOCKETS' => $useWebsockets, @@ -133,16 +125,36 @@ private function generateCustomNavbarData($navbarSettings) $customNavbarEnabled = $navbarSettings->enable_custom_navbar; // If custom navbar is disabled, generate default navbar - if (! $customNavbarEnabled) { + if (!$customNavbarEnabled) { $customPagesInNavbar = CustomPage::visible()->navbar()->select(['id', 'title', 'path', 'is_in_navbar', 'is_visible', 'is_open_in_new_tab'])->get(); $leftNavbar = self::DEFAULT_NAV_LEFT; + // Add BanWarden to navbar if enabled + if (config('minetrax.banwarden_enabled')) { + $leftNavbar[] = [ + 'type' => 'route', + 'name' => 'Punishments', + 'title' => 'Punishments', + 'route' => 'player.punishment.index', + 'key' => 'route-punishments-01', + 'authenticated' => false, + ]; + } + $dropdownList = [ 'type' => 'dropdown', 'name' => 'Dropdown', 'title' => 'Others', 'key' => 'dropdown-others-01', 'children' => [ + [ + 'type' => 'route', + 'name' => 'Polls', + 'title' => 'Polls', + 'route' => 'poll.index', + 'key' => 'route-polls-01', + 'authenticated' => false, + ], [ 'type' => 'route', 'name' => 'News', @@ -198,7 +210,7 @@ private function generateCustomNavbarData($navbarSettings) 'path' => $page->path, ], 'is_open_in_new_tab' => $page->is_open_in_new_tab, - 'key' => 'custom-page-'.$page->id.'-01', + 'key' => 'custom-page-' . $page->id . '-01', ]; } $leftNavbar[] = $dropdownList; diff --git a/config/minetrax.php b/config/minetrax.php index 15d124a1a..7afc2eaf6 100644 --- a/config/minetrax.php +++ b/config/minetrax.php @@ -249,6 +249,14 @@ 'key' => 'route-change-player-skin', 'authenticated' => true, ], + [ + 'type' => 'route', + 'name' => 'Punishments', + 'title' => 'Punishments', + 'route' => 'player.punishment.index', + 'key' => 'route-punishments', + 'authenticated' => false, + ], ], /*