Skip to content

Commit

Permalink
add banwarden to nav
Browse files Browse the repository at this point in the history
  • Loading branch information
Xinecraft committed Oct 25, 2024
1 parent 3d27171 commit a859b4c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
34 changes: 23 additions & 11 deletions app/View/Components/PhpVarsToJsTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions config/minetrax.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
],

/*
Expand Down

0 comments on commit a859b4c

Please sign in to comment.