mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-04-25 16:15:23 -05:00
Started working on Admin Dashboard, setup layout and the nav-bar
This commit is contained in:
parent
cd9d96d421
commit
fceab708aa
16
dist/app/Http/Controllers/Web/Admin/DashboardController.php
vendored
Normal file
16
dist/app/Http/Controllers/Web/Admin/DashboardController.php
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function dashboard()
|
||||
{
|
||||
View::share('title', 'Dashboard');
|
||||
return view('admin.dashboard');
|
||||
}
|
||||
}
|
||||
4
dist/app/Providers/RouteServiceProvider.php
vendored
4
dist/app/Providers/RouteServiceProvider.php
vendored
|
|
@ -48,6 +48,10 @@ public function boot(): void
|
|||
Route::middleware(['api', 'api.session'])
|
||||
->prefix('metrics')
|
||||
->group(base_path('routes/metrics.php'));
|
||||
|
||||
Route::middleware(['web', 'auth'])
|
||||
->prefix('admin')
|
||||
->group(base_path('routes/admin.php'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
29
dist/app/View/Components/Admin/Navbar.php
vendored
Normal file
29
dist/app/View/Components/Admin/Navbar.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components\Admin;
|
||||
|
||||
use App\Models\User\User;
|
||||
use Auth;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Navbar extends Component
|
||||
{
|
||||
public User $user;
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->user = Auth::user();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.admin.navbar');
|
||||
}
|
||||
}
|
||||
46
dist/app/View/Components/Auth/User.php
vendored
Normal file
46
dist/app/View/Components/Auth/User.php
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components\Auth;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class User extends Component
|
||||
{
|
||||
public string $profileUrl;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public \App\Models\User\User $user,
|
||||
public bool $showAvatar = true,
|
||||
public bool $showName = true,
|
||||
)
|
||||
{
|
||||
$this->profileUrl = 'https://steamcommunity.com/profiles/'.$user->steam_id;
|
||||
}
|
||||
|
||||
public function avatarFull(): string
|
||||
{
|
||||
return $this->user->avatar_full ?? $this->user->avatar_medium ?? $this->user->avatar_small;
|
||||
}
|
||||
|
||||
public function avatarMedium(): string
|
||||
{
|
||||
return $this->user->avatar_medium ?? $this->user->avatar_small ?? $this->user->avatar_full ?? '';
|
||||
}
|
||||
|
||||
public function avatarSmall(): string {
|
||||
return $this->user->avatar_small ?? $this->user->avatar_medium ?? $this->user->avatar_full ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.auth.user');
|
||||
}
|
||||
}
|
||||
26
dist/app/View/Components/Layouts/App.php
vendored
Normal file
26
dist/app/View/Components/Layouts/App.php
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components\Layouts;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class App extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.layouts.app');
|
||||
}
|
||||
}
|
||||
26
dist/app/View/Components/Layouts/admin.php
vendored
Normal file
26
dist/app/View/Components/Layouts/admin.php
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components\Layouts;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class admin extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.layouts.admin');
|
||||
}
|
||||
}
|
||||
3
dist/resources/views/admin/dashboard.blade.php
vendored
Normal file
3
dist/resources/views/admin/dashboard.blade.php
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<x-layouts.admin>
|
||||
Dashboard
|
||||
</x-layouts.admin>
|
||||
13
dist/resources/views/app.blade.php
vendored
13
dist/resources/views/app.blade.php
vendored
|
|
@ -1,12 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<title>{{ $title ?? 'Deathgarden Rebirth' }}</title>
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
@inertiaHead
|
||||
@stack('head')
|
||||
</head>
|
||||
<body>
|
||||
@inertia
|
||||
<body class="bg-gray-950 font-sans text-white antialiased">
|
||||
{{ $slot }}
|
||||
</body>
|
||||
<footer>
|
||||
@stack('footer')
|
||||
</footer>
|
||||
</html>
|
||||
21
dist/resources/views/components/admin/navbar.blade.php
vendored
Normal file
21
dist/resources/views/components/admin/navbar.blade.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/** @var \App\Models\User\User $user */
|
||||
?>
|
||||
|
||||
<nav class="bg-gray-800 flex flex-row p-3 w-full items-center align-middle">
|
||||
<a href="{{ route('admin.dashboard') }}">
|
||||
<span class="font-bold text-lg mr-4">
|
||||
Administration
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@isset($title)
|
||||
<span class="italic">
|
||||
{{ $title }}
|
||||
</span>
|
||||
@endisset
|
||||
|
||||
<div class="ml-auto max-h-10 object-scale-down">
|
||||
<x-auth.user :$user/>
|
||||
</div>
|
||||
</nav>
|
||||
24
dist/resources/views/components/auth/user.blade.php
vendored
Normal file
24
dist/resources/views/components/auth/user.blade.php
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/** @var \App\Models\User\User $user */
|
||||
/** @var string $profileUrl */
|
||||
/** @var bool $showAvatar */
|
||||
/** @var bool $showName */
|
||||
?>
|
||||
|
||||
<div class="flex items-center" style="max-height: inherit">
|
||||
@if($showName)
|
||||
<a href="{{ $profileUrl }}" target="_blank">
|
||||
<span class="mx-1">
|
||||
{{ $user->last_known_username }}
|
||||
</span>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if($showAvatar)
|
||||
<a href="{{ $profileUrl }}" target="_blank" style="max-height: inherit">
|
||||
<img src="{{ $avatarFull }}"
|
||||
alt="Avatar"
|
||||
class="rounded-lg mx-1" style="max-height: inherit">
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
8
dist/resources/views/components/layouts/admin.blade.php
vendored
Normal file
8
dist/resources/views/components/layouts/admin.blade.php
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<x-layouts.app>
|
||||
<div class="grid grid-cols-1 grid-rows-2">
|
||||
<x-admin.navbar class="row-span-1"/>
|
||||
<div class="row-span-2">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
</div>
|
||||
</x-layouts.app>
|
||||
17
dist/resources/views/components/layouts/app.blade.php
vendored
Normal file
17
dist/resources/views/components/layouts/app.blade.php
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<title>{{ $title ?? 'Deathgarden Rebirth' }}</title>
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
@stack('head')
|
||||
</head>
|
||||
<body class="bg-gray-950 font-sans text-white antialiased">
|
||||
{{ $slot }}
|
||||
</body>
|
||||
<footer>
|
||||
@stack('footer')
|
||||
</footer>
|
||||
</html>
|
||||
7
dist/resources/views/layouts/raw.blade.php
vendored
7
dist/resources/views/layouts/raw.blade.php
vendored
|
|
@ -4,11 +4,14 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<title>{{ $title ?? 'Deathgarden Rebirth' }}</title>
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
@stack('head')
|
||||
</head>
|
||||
<body class="bg-gray-950 font-sans text-white antialiased">
|
||||
{{ $slot }}
|
||||
</body>
|
||||
|
||||
@stack('js')
|
||||
<footer>
|
||||
@stack('js')
|
||||
</footer>
|
||||
</html>
|
||||
14
dist/routes/admin.php
vendored
Normal file
14
dist/routes/admin.php
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\Web\Admin\DashboardController;
|
||||
use App\Http\Controllers\Web\GameFileController;
|
||||
|
||||
Route::redirect('', 'admin/dashboard');
|
||||
Route::get('dashboard', [DashboardController::class, 'dashboard'])->name('admin.dashboard');
|
||||
|
||||
Route::get('file-manager', [GameFileController::class, 'index']);
|
||||
Route::post('file-manager', [GameFileController::class, 'store'])->name('file.store');
|
||||
|
||||
Route::fallback(function () {
|
||||
return redirect(route('admin.dashboard'));
|
||||
});
|
||||
5
dist/routes/web.php
vendored
5
dist/routes/web.php
vendored
|
|
@ -33,11 +33,6 @@
|
|||
return \Inertia\Inertia::render('Dashboard');
|
||||
});
|
||||
|
||||
Route::middleware('auth')->group(function () {
|
||||
Route::get('/admin/file-manager', [\App\Http\Controllers\Web\GameFileController::class, 'index']);
|
||||
Route::post('/admin/file-manager', [\App\Http\Controllers\Web\GameFileController::class, 'store'])->name('file.store');
|
||||
});
|
||||
|
||||
Route::middleware('verify_migration_key')->get('/migrate-database', function () {
|
||||
Artisan::call('migrate --no-interaction');
|
||||
print Artisan::output();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user