From 9dba92372dfa296f9267b54b476853ba03a8a31d Mon Sep 17 00:00:00 2001 From: andyksaw Date: Sat, 11 Jan 2025 16:54:50 +0900 Subject: [PATCH] Define root view on a per-controller basis --- app/Domains/Manage/RendersManageApp.php | 17 + app/Domains/Review/RendersReviewApp.php | 17 + .../Accounts/AccountBadgeController.php | 6 +- .../Manage/Accounts/AccountController.php | 13 +- .../Accounts/AccountGroupController.php | 6 +- .../Accounts/AccountPlayerController.php | 7 +- .../Manage/Badges/BadgeController.php | 10 +- .../Manage/Bans/GameIPBanController.php | 10 +- .../Manage/Bans/GamePlayerBanController.php | 9 +- .../Manage/Donations/DonationController.php | 11 +- .../Manage/Groups/GroupAccountController.php | 6 +- .../Manage/Groups/GroupController.php | 9 +- .../Controllers/Manage/HomeController.php | 6 +- .../Minecraft/MinecraftConfigController.php | 7 +- .../Minecraft/MinecraftWarpController.php | 9 +- .../Players/MinecraftPlayerController.php | 11 +- .../Manage/Servers/ServerController.php | 10 +- .../Manage/Servers/ServerTokenController.php | 10 +- .../Warnings/PlayerWarningController.php | 9 +- .../Review/BanAppeals/BanAppealController.php | 7 +- .../BuilderRanks/BuilderRanksController.php | 10 +- .../Controllers/Review/HomeController.php | 6 +- app/Http/Middleware/HandleInertiaRequests.php | 12 +- .../manage/Components/InfinitePagination.vue | 2 +- resources/js/manage/Data/BanAppeal.ts | 4 +- .../js/manage/Data/BuilderRankApplication.ts | 23 ++ .../review/Layouts/Root/Partials/SideBar.vue | 2 +- .../review/Pages/BanAppeals/BanAppealList.vue | 2 +- .../review/Pages/BanAppeals/BanAppealShow.vue | 11 +- .../Partials/BanAppealListTable.vue | 4 +- .../BuilderRankApplicationList.vue | 35 ++ .../BuilderRankApplicationShow.vue | 300 ++++++++++++++++++ .../BuilderRankApplicationListTable.vue | 75 +++++ resources/sass/front/front.scss | 2 + routes/web_review.php | 21 +- 35 files changed, 600 insertions(+), 99 deletions(-) create mode 100644 app/Domains/Manage/RendersManageApp.php create mode 100644 app/Domains/Review/RendersReviewApp.php create mode 100644 resources/js/manage/Data/BuilderRankApplication.ts create mode 100644 resources/js/review/Pages/BuilderRankApplications/BuilderRankApplicationList.vue create mode 100644 resources/js/review/Pages/BuilderRankApplications/BuilderRankApplicationShow.vue create mode 100644 resources/js/review/Pages/BuilderRankApplications/Partials/BuilderRankApplicationListTable.vue diff --git a/app/Domains/Manage/RendersManageApp.php b/app/Domains/Manage/RendersManageApp.php new file mode 100644 index 000000000..284e6127a --- /dev/null +++ b/app/Domains/Manage/RendersManageApp.php @@ -0,0 +1,17 @@ +badges->pluck(Badge::primaryKey()); - return Inertia::render('Accounts/AccountBadgeSelect', [ + return $this->inertiaRender('Accounts/AccountBadgeSelect', [ 'badges' => $badges, 'account_badge_ids' => $accountBadgeIds ?? [], 'account_id' => $account->getKey(), diff --git a/app/Http/Controllers/Manage/Accounts/AccountController.php b/app/Http/Controllers/Manage/Accounts/AccountController.php index 48d1a3ae3..a745ec999 100644 --- a/app/Http/Controllers/Manage/Accounts/AccountController.php +++ b/app/Http/Controllers/Manage/Accounts/AccountController.php @@ -3,7 +3,7 @@ namespace App\Http\Controllers\Manage\Accounts; use App\Core\Rules\DiscourseUsernameRule; -use App\Domains\Registration\Events\AccountCreated; +use App\Domains\Manage\RendersManageApp; use App\Domains\Registration\UseCases\CreateUnactivatedAccount; use App\Http\Controllers\WebController; use App\Http\Filters\EqualFilter; @@ -15,10 +15,11 @@ use Illuminate\Support\Facades\Pipeline; use Illuminate\Validation\Rule; use Illuminate\Validation\Rules\Password; -use Inertia\Inertia; class AccountController extends WebController { + use RendersManageApp; + public function index(Request $request) { Gate::authorize('viewAny', Account::class); @@ -38,7 +39,7 @@ public function index(Request $request) if ($request->wantsJson()) { return $accounts; } - return Inertia::render('Accounts/AccountList', compact('accounts')); + return $this->inertiaRender('Accounts/AccountList', compact('accounts')); } public function show(Account $account) @@ -54,14 +55,14 @@ public function show(Account $account) 'donations', ]); - return Inertia::render('Accounts/AccountShow', compact('account')); + return $this->inertiaRender('Accounts/AccountShow', compact('account')); } public function create() { Gate::authorize('create', Account::class); - return Inertia::render('Accounts/AccountCreate'); + return $this->inertiaRender('Accounts/AccountCreate'); } public function store(Request $request, CreateUnactivatedAccount $createUnactivatedAccount) @@ -97,7 +98,7 @@ public function edit(Account $account) { Gate::authorize('update', $account); - return Inertia::render('Accounts/AccountEdit', compact('account')); + return $this->inertiaRender('Accounts/AccountEdit', compact('account')); } public function update(Request $request, Account $account) diff --git a/app/Http/Controllers/Manage/Accounts/AccountGroupController.php b/app/Http/Controllers/Manage/Accounts/AccountGroupController.php index 2d8eb6f81..7cd528346 100644 --- a/app/Http/Controllers/Manage/Accounts/AccountGroupController.php +++ b/app/Http/Controllers/Manage/Accounts/AccountGroupController.php @@ -2,15 +2,17 @@ namespace App\Http\Controllers\Manage\Accounts; +use App\Domains\Manage\RendersManageApp; use App\Http\Controllers\WebController; use App\Models\Account; use App\Models\Group; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; -use Inertia\Inertia; class AccountGroupController extends WebController { + use RendersManageApp; + public function index(Request $request, Account $account) { Gate::authorize('viewAny', Account::class); @@ -18,7 +20,7 @@ public function index(Request $request, Account $account) $groups = Group::where('is_default', false)->get(); $accountGroupIds = $account->groups->pluck(Group::primaryKey()); - return Inertia::render('Accounts/AccountGroupSelect', [ + return $this->inertiaRender('Accounts/AccountGroupSelect', [ 'groups' => $groups, 'account_group_ids' => $accountGroupIds ?? [], 'account_id' => $account->getKey(), diff --git a/app/Http/Controllers/Manage/Accounts/AccountPlayerController.php b/app/Http/Controllers/Manage/Accounts/AccountPlayerController.php index 261d3e113..65ddb72c8 100644 --- a/app/Http/Controllers/Manage/Accounts/AccountPlayerController.php +++ b/app/Http/Controllers/Manage/Accounts/AccountPlayerController.php @@ -4,21 +4,22 @@ use App\Core\Domains\MinecraftUUID\Data\MinecraftUUID; use App\Core\Domains\MinecraftUUID\Rules\MinecraftUUIDRule; +use App\Domains\Manage\RendersManageApp; use App\Http\Controllers\WebController; use App\Models\Account; -use App\Models\Group; use App\Models\MinecraftPlayer; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; -use Inertia\Inertia; class AccountPlayerController extends WebController { + use RendersManageApp; + public function create(Request $request, Account $account) { Gate::authorize('update', $account); - return Inertia::render('Accounts/AccountPlayerSelect', [ + return $this->inertiaRender('Accounts/AccountPlayerSelect', [ 'account_id' => $account->getKey(), ]); } diff --git a/app/Http/Controllers/Manage/Badges/BadgeController.php b/app/Http/Controllers/Manage/Badges/BadgeController.php index 947dc75d7..3cec9a4f7 100644 --- a/app/Http/Controllers/Manage/Badges/BadgeController.php +++ b/app/Http/Controllers/Manage/Badges/BadgeController.php @@ -2,14 +2,16 @@ namespace App\Http\Controllers\Manage\Badges; +use App\Domains\Manage\RendersManageApp; use App\Http\Controllers\WebController; use App\Models\Badge; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; -use Inertia\Inertia; class BadgeController extends WebController { + use RendersManageApp; + public function index(Request $request) { Gate::authorize('viewAny', Badge::class); @@ -20,14 +22,14 @@ public function index(Request $request) if ($request->wantsJson()) { return $badges; } - return Inertia::render('Badges/BadgeList', compact('badges')); + return $this->inertiaRender('Badges/BadgeList', compact('badges')); } public function create(Request $request) { Gate::authorize('create', Badge::class); - return Inertia::render('Badges/BadgeCreate'); + return $this->inertiaRender('Badges/BadgeCreate'); } public function store(Request $request) @@ -57,7 +59,7 @@ public function edit(Badge $badge) { Gate::authorize('update', $badge); - return Inertia::render('Badges/BadgeEdit', compact('badge')); + return $this->inertiaRender('Badges/BadgeEdit', compact('badge')); } public function update(Request $request, Badge $badge) diff --git a/app/Http/Controllers/Manage/Bans/GameIPBanController.php b/app/Http/Controllers/Manage/Bans/GameIPBanController.php index d336e783c..ea76f1e4b 100644 --- a/app/Http/Controllers/Manage/Bans/GameIPBanController.php +++ b/app/Http/Controllers/Manage/Bans/GameIPBanController.php @@ -4,16 +4,18 @@ use App\Core\Domains\MinecraftUUID\Data\MinecraftUUID; use App\Core\Domains\MinecraftUUID\Rules\MinecraftUUIDRule; +use App\Domains\Manage\RendersManageApp; use App\Domains\MinecraftEventBus\Events\IpAddressBanned; use App\Http\Controllers\WebController; use App\Models\GameIPBan; use App\Models\MinecraftPlayer; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; -use Inertia\Inertia; class GameIPBanController extends WebController { + use RendersManageApp; + public function index(Request $request) { Gate::authorize('viewAny', GameIPBan::class); @@ -25,14 +27,14 @@ public function index(Request $request) if (request()->wantsJson()) { return $bans; } - return Inertia::render('IPBans/IPBanList', compact('bans')); + return $this->inertiaRender('IPBans/IPBanList', compact('bans')); } public function create(Request $request) { Gate::authorize('create', GameIPBan::class); - return Inertia::render('IPBans/IPBanCreate'); + return $this->inertiaRender('IPBans/IPBanCreate'); } public function store(Request $request) @@ -65,7 +67,7 @@ public function edit(GameIPBan $ipBan) $ipBan->load('bannerPlayer'); - return Inertia::render('IPBans/IPBanEdit', [ + return $this->inertiaRender('IPBans/IPBanEdit', [ 'ban' => $ipBan, ]); } diff --git a/app/Http/Controllers/Manage/Bans/GamePlayerBanController.php b/app/Http/Controllers/Manage/Bans/GamePlayerBanController.php index eafc10ec7..b5ad95a5e 100644 --- a/app/Http/Controllers/Manage/Bans/GamePlayerBanController.php +++ b/app/Http/Controllers/Manage/Bans/GamePlayerBanController.php @@ -5,6 +5,7 @@ use App\Core\Domains\MinecraftUUID\Data\MinecraftUUID; use App\Core\Domains\MinecraftUUID\Rules\MinecraftUUIDRule; use App\Domains\Bans\Data\UnbanType; +use App\Domains\Manage\RendersManageApp; use App\Domains\MinecraftEventBus\Events\MinecraftUuidBanned; use App\Http\Controllers\WebController; use App\Models\GamePlayerBan; @@ -16,6 +17,8 @@ class GamePlayerBanController extends WebController { + use RendersManageApp; + public function index(Request $request) { Gate::authorize('viewAny', GamePlayerBan::class); @@ -27,7 +30,7 @@ public function index(Request $request) if (request()->wantsJson()) { return $bans; } - return Inertia::render('PlayerBans/PlayerBanList', compact('bans')); + return $this->inertiaRender('PlayerBans/PlayerBanList', compact('bans')); } public function create(Request $request) @@ -37,7 +40,7 @@ public function create(Request $request) $account = $request->user(); $account->load('minecraftAccount'); - return Inertia::render('PlayerBans/PlayerBanCreate', [ + return $this->inertiaRender('PlayerBans/PlayerBanCreate', [ 'account' => $account, ]); } @@ -84,7 +87,7 @@ public function edit(GamePlayerBan $playerBan) $playerBan->load('bannedPlayer', 'bannerPlayer', 'unbannerPlayer'); - return Inertia::render('PlayerBans/PlayerBanEdit', [ + return $this->inertiaRender('PlayerBans/PlayerBanEdit', [ 'ban' => $playerBan, ]); } diff --git a/app/Http/Controllers/Manage/Donations/DonationController.php b/app/Http/Controllers/Manage/Donations/DonationController.php index e9dd2e9a9..03f4e79b0 100644 --- a/app/Http/Controllers/Manage/Donations/DonationController.php +++ b/app/Http/Controllers/Manage/Donations/DonationController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Manage\Donations; +use App\Domains\Manage\RendersManageApp; use App\Http\Controllers\WebController; use App\Models\Donation; use Illuminate\Http\Request; @@ -10,6 +11,8 @@ class DonationController extends WebController { + use RendersManageApp; + public function index(Request $request) { Gate::authorize('viewAny', Donation::class); @@ -21,7 +24,7 @@ public function index(Request $request) if (request()->wantsJson()) { return $donations; } - return Inertia::render( + return $this->inertiaRender( 'Donations/DonationList', compact('donations'), ); @@ -33,7 +36,7 @@ public function show(Donation $donation) $donation->load('perks', 'perks.account'); - return Inertia::render( + return $this->inertiaRender( 'Donations/DonationShow', compact('donation'), ); @@ -43,7 +46,7 @@ public function create(Request $request) { Gate::authorize('create', Donation::class); - return Inertia::render('Donations/DonationCreate'); + return $this->inertiaRender('Donations/DonationCreate'); } public function store(Request $request) @@ -66,7 +69,7 @@ public function edit(Donation $donation) { Gate::authorize('update', $donation); - return Inertia::render( + return $this->inertiaRender( 'Donations/DonationEdit', compact('donation'), ); diff --git a/app/Http/Controllers/Manage/Groups/GroupAccountController.php b/app/Http/Controllers/Manage/Groups/GroupAccountController.php index 50a85bc16..527157f9f 100644 --- a/app/Http/Controllers/Manage/Groups/GroupAccountController.php +++ b/app/Http/Controllers/Manage/Groups/GroupAccountController.php @@ -2,15 +2,17 @@ namespace App\Http\Controllers\Manage\Groups; +use App\Domains\Manage\RendersManageApp; use App\Http\Controllers\WebController; use App\Models\Account; use App\Models\Group; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; -use Inertia\Inertia; class GroupAccountController extends WebController { + use RendersManageApp; + public function index(Request $request, Group $group) { Gate::authorize('view', $group); @@ -26,7 +28,7 @@ public function index(Request $request, Group $group) if ($request->wantsJson()) { return $accounts; } - return Inertia::render( + return $this->inertiaRender( 'Groups/GroupAccountList', compact('accounts', 'group'), ); diff --git a/app/Http/Controllers/Manage/Groups/GroupController.php b/app/Http/Controllers/Manage/Groups/GroupController.php index ccc8a5900..f70990620 100644 --- a/app/Http/Controllers/Manage/Groups/GroupController.php +++ b/app/Http/Controllers/Manage/Groups/GroupController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Manage\Groups; +use App\Domains\Manage\RendersManageApp; use App\Http\Controllers\WebController; use App\Models\Account; use App\Models\Group; @@ -13,6 +14,8 @@ class GroupController extends WebController { + use RendersManageApp; + public function index() { Gate::authorize('viewAny', Group::class); @@ -27,14 +30,14 @@ public function index() ->where('is_default', true) ->map(fn ($group) => $group->accounts_count = Account::doesntHave('groups')->count()); - return Inertia::render('Groups/GroupList', compact('groups')); + return $this->inertiaRender('Groups/GroupList', compact('groups')); } public function create(Request $request) { Gate::authorize('create', Group::class); - return Inertia::render('Groups/GroupCreate'); + return $this->inertiaRender('Groups/GroupCreate'); } public function store(Request $request): RedirectResponse @@ -61,7 +64,7 @@ public function edit(Group $group) { Gate::authorize('update', $group); - return Inertia::render('Groups/GroupEdit', compact('group')); + return $this->inertiaRender('Groups/GroupEdit', compact('group')); } public function update(Request $request, Group $group): RedirectResponse diff --git a/app/Http/Controllers/Manage/HomeController.php b/app/Http/Controllers/Manage/HomeController.php index 68c770a05..eeca9f9a7 100644 --- a/app/Http/Controllers/Manage/HomeController.php +++ b/app/Http/Controllers/Manage/HomeController.php @@ -2,14 +2,16 @@ namespace App\Http\Controllers\Manage; +use App\Domains\Manage\RendersManageApp; use App\Http\Controllers\WebController; use Illuminate\Http\Request; -use Inertia\Inertia; class HomeController extends WebController { + use RendersManageApp; + public function __invoke(Request $request) { - return Inertia::render('Home'); + return $this->inertiaRender('Home'); } } diff --git a/app/Http/Controllers/Manage/Minecraft/MinecraftConfigController.php b/app/Http/Controllers/Manage/Minecraft/MinecraftConfigController.php index 909e6ade6..b65886943 100644 --- a/app/Http/Controllers/Manage/Minecraft/MinecraftConfigController.php +++ b/app/Http/Controllers/Manage/Minecraft/MinecraftConfigController.php @@ -2,23 +2,24 @@ namespace App\Http\Controllers\Manage\Minecraft; +use App\Domains\Manage\RendersManageApp; use App\Domains\MinecraftEventBus\Events\MinecraftConfigUpdated; use App\Http\Controllers\WebController; use App\Models\MinecraftConfig; -use App\Models\MinecraftPlayer; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; -use Inertia\Inertia; class MinecraftConfigController extends WebController { + use RendersManageApp; + public function create() { Gate::authorize('create', MinecraftConfig::class); $config = MinecraftConfig::byLatest()->first(); - return Inertia::render('MinecraftConfig/MinecraftConfig',[ + return $this->inertiaRender('MinecraftConfig/MinecraftConfig',[ 'config' => $config, ]); } diff --git a/app/Http/Controllers/Manage/Minecraft/MinecraftWarpController.php b/app/Http/Controllers/Manage/Minecraft/MinecraftWarpController.php index 099878f6d..7ecd567eb 100644 --- a/app/Http/Controllers/Manage/Minecraft/MinecraftWarpController.php +++ b/app/Http/Controllers/Manage/Minecraft/MinecraftWarpController.php @@ -3,16 +3,17 @@ namespace App\Http\Controllers\Manage\Minecraft; use App\Core\Domains\MinecraftCoordinate\ValidatesCoordinates; +use App\Domains\Manage\RendersManageApp; use App\Http\Controllers\WebController; use App\Models\MinecraftWarp; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; use Illuminate\Validation\Rule; -use Inertia\Inertia; class MinecraftWarpController extends WebController { + use RendersManageApp; use ValidatesCoordinates; public function index(Request $request) @@ -25,14 +26,14 @@ public function index(Request $request) if (request()->wantsJson()) { return $warps; } - return Inertia::render('Warps/WarpList', compact('warps')); + return $this->inertiaRender('Warps/WarpList', compact('warps')); } public function create(Request $request) { Gate::authorize('create', MinecraftWarp::class); - return Inertia::render('Warps/WarpCreate'); + return $this->inertiaRender('Warps/WarpCreate'); } public function store(Request $request): RedirectResponse @@ -54,7 +55,7 @@ public function edit(MinecraftWarp $warp) { Gate::authorize('update', $warp); - return Inertia::render('Warps/WarpEdit', compact('warp')); + return $this->inertiaRender('Warps/WarpEdit', compact('warp')); } public function update(Request $request, MinecraftWarp $warp) diff --git a/app/Http/Controllers/Manage/Players/MinecraftPlayerController.php b/app/Http/Controllers/Manage/Players/MinecraftPlayerController.php index e7cfa64e2..0d0e6210f 100644 --- a/app/Http/Controllers/Manage/Players/MinecraftPlayerController.php +++ b/app/Http/Controllers/Manage/Players/MinecraftPlayerController.php @@ -6,6 +6,7 @@ use App\Core\Domains\MinecraftUUID\Rules\MinecraftUUIDRule; use App\Core\Domains\MinecraftUUID\UseCases\LookupMinecraftUUID; use App\Core\Domains\Mojang\Api\MojangPlayerApi; +use App\Domains\Manage\RendersManageApp; use App\Http\Controllers\WebController; use App\Models\MinecraftPlayer; use Illuminate\Http\Request; @@ -17,6 +18,8 @@ class MinecraftPlayerController extends WebController { + use RendersManageApp; + public function index() { Gate::authorize('viewAny', MinecraftPlayer::class); @@ -28,7 +31,7 @@ public function index() if (request()->wantsJson()) { return $minecraftPlayers; } - return Inertia::render('Players/PlayerList', [ + return $this->inertiaRender('Players/PlayerList', [ 'players' => $minecraftPlayers, ]); } @@ -39,14 +42,14 @@ public function show(MinecraftPlayer $player) $player->load(['account']); - return Inertia::render('Players/PlayerShow', compact('player')); + return $this->inertiaRender('Players/PlayerShow', compact('player')); } public function create() { Gate::authorize('create', MinecraftPlayer::class); - return Inertia::render('Players/PlayerCreate'); + return $this->inertiaRender('Players/PlayerCreate'); } public function store(Request $request, LookupMinecraftUUID $lookupMinecraftUUID) @@ -91,7 +94,7 @@ public function edit(MinecraftPlayer $player) { Gate::authorize('update', $player); - return Inertia::render('Players/PlayerEdit', compact('player')); + return $this->inertiaRender('Players/PlayerEdit', compact('player')); } public function update(Request $request, MinecraftPlayer $player) diff --git a/app/Http/Controllers/Manage/Servers/ServerController.php b/app/Http/Controllers/Manage/Servers/ServerController.php index 6614bec78..8a75e727b 100644 --- a/app/Http/Controllers/Manage/Servers/ServerController.php +++ b/app/Http/Controllers/Manage/Servers/ServerController.php @@ -2,29 +2,31 @@ namespace App\Http\Controllers\Manage\Servers; +use App\Domains\Manage\RendersManageApp; use App\Http\Controllers\WebController; use App\Models\Server; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; -use Inertia\Inertia; class ServerController extends WebController { + use RendersManageApp; + public function index(Request $request) { Gate::authorize('viewAny', Server::class); $servers = Server::orderBy('created_at', 'desc')->get(); - return Inertia::render('Servers/ServerList', compact('servers')); + return $this->inertiaRender('Servers/ServerList', compact('servers')); } public function create(Request $request) { Gate::authorize('create', Server::class); - return Inertia::render('Servers/ServerCreate'); + return $this->inertiaRender('Servers/ServerCreate'); } public function store(Request $request): RedirectResponse @@ -48,7 +50,7 @@ public function edit(Server $server) { Gate::authorize('update', $server); - return Inertia::render('Servers/ServerEdit', compact('server')); + return $this->inertiaRender('Servers/ServerEdit', compact('server')); } public function update(Request $request, Server $server) diff --git a/app/Http/Controllers/Manage/Servers/ServerTokenController.php b/app/Http/Controllers/Manage/Servers/ServerTokenController.php index bd42c6806..1a15a9430 100644 --- a/app/Http/Controllers/Manage/Servers/ServerTokenController.php +++ b/app/Http/Controllers/Manage/Servers/ServerTokenController.php @@ -2,29 +2,31 @@ namespace App\Http\Controllers\Manage\Servers; +use App\Domains\Manage\RendersManageApp; use App\Http\Controllers\WebController; use App\Models\Server; use App\Models\ServerToken; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; -use Inertia\Inertia; class ServerTokenController extends WebController { + use RendersManageApp; + public function index(Request $request) { Gate::authorize('viewAny', ServerToken::class); $tokens = ServerToken::orderBy('created_at', 'desc')->get(); - return Inertia::render('ServerTokens/ServerTokensList', compact('tokens')); + return $this->inertiaRender('ServerTokens/ServerTokensList', compact('tokens')); } public function create(Request $request) { Gate::authorize('create', ServerToken::class); - return Inertia::render('ServerTokens/ServerTokenCreate'); + return $this->inertiaRender('ServerTokens/ServerTokenCreate'); } public function store(Request $request) @@ -50,7 +52,7 @@ public function edit(ServerToken $serverToken) { Gate::authorize('update', ServerToken::class); - return Inertia::render('ServerTokens/ServerTokenEdit', [ + return $this->inertiaRender('ServerTokens/ServerTokenEdit', [ 'token' => $serverToken, ]); } diff --git a/app/Http/Controllers/Manage/Warnings/PlayerWarningController.php b/app/Http/Controllers/Manage/Warnings/PlayerWarningController.php index 14d2d9c5f..3b7f8fc61 100644 --- a/app/Http/Controllers/Manage/Warnings/PlayerWarningController.php +++ b/app/Http/Controllers/Manage/Warnings/PlayerWarningController.php @@ -4,6 +4,7 @@ use App\Core\Domains\MinecraftUUID\Data\MinecraftUUID; use App\Core\Domains\MinecraftUUID\Rules\MinecraftUUIDRule; +use App\Domains\Manage\RendersManageApp; use App\Http\Controllers\WebController; use App\Models\MinecraftPlayer; use App\Models\PlayerWarning; @@ -13,6 +14,8 @@ class PlayerWarningController extends WebController { + use RendersManageApp; + public function index(Request $request) { Gate::authorize('viewAny', PlayerWarning::class); @@ -24,14 +27,14 @@ public function index(Request $request) if (request()->wantsJson()) { return $warnings; } - return Inertia::render('Warnings/WarningList', compact('warnings')); + return $this->inertiaRender('Warnings/WarningList', compact('warnings')); } public function create(Request $request) { Gate::authorize('create', PlayerWarning::class); - return Inertia::render('Warnings/WarningCreate'); + return $this->inertiaRender('Warnings/WarningCreate'); } public function store(Request $request) @@ -74,7 +77,7 @@ public function edit(PlayerWarning $warning) $warning->load('warnedPlayer', 'warnerPlayer'); - return INertia::render('Warnings/WarningEdit', compact('warning')); + return $this->inertiaRender('Warnings/WarningEdit', compact('warning')); } public function update(Request $request, PlayerWarning $warning) diff --git a/app/Http/Controllers/Review/BanAppeals/BanAppealController.php b/app/Http/Controllers/Review/BanAppeals/BanAppealController.php index 536255be4..0ca3b771b 100644 --- a/app/Http/Controllers/Review/BanAppeals/BanAppealController.php +++ b/app/Http/Controllers/Review/BanAppeals/BanAppealController.php @@ -9,6 +9,7 @@ use App\Domains\BanAppeals\Notifications\BanAppealUpdatedNotification; use App\Domains\BanAppeals\UseCases\UpdateBanAppeal; use App\Domains\Bans\Exceptions\NotBannedException; +use App\Domains\Review\RendersReviewApp; use App\Http\Requests\BanAppealUpdateRequest; use App\Models\BanAppeal; use Illuminate\Support\Facades\Gate; @@ -17,6 +18,8 @@ class BanAppealController { + use RendersReviewApp; + public function index() { Gate::authorize('viewAny', BanAppeal::class); @@ -28,7 +31,7 @@ public function index() ->orderBy('created_at', 'desc') ->cursorPaginate(50); - return Inertia::render( + return $this->inertiaRender( 'BanAppeals/BanAppealList', compact('banAppeals'), ); @@ -44,7 +47,7 @@ public function show(BanAppeal $banAppeal) 'deciderPlayer', ]); - return Inertia::render( + return $this->inertiaRender( 'BanAppeals/BanAppealShow', compact('banAppeal'), ); diff --git a/app/Http/Controllers/Review/BuilderRanks/BuilderRanksController.php b/app/Http/Controllers/Review/BuilderRanks/BuilderRanksController.php index 8e4cb22a0..afe2622bf 100644 --- a/app/Http/Controllers/Review/BuilderRanks/BuilderRanksController.php +++ b/app/Http/Controllers/Review/BuilderRanks/BuilderRanksController.php @@ -5,25 +5,31 @@ use App\Domains\BuilderRankApplications\Data\ApplicationStatus; use App\Domains\BuilderRankApplications\UseCases\ApproveBuildRankApplication; use App\Domains\BuilderRankApplications\UseCases\DenyBuildRankApplication; +use App\Domains\Review\RendersReviewApp; use App\Http\Controllers\WebController; use App\Models\BuilderRankApplication; use App\Models\Group; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; use Illuminate\Validation\Rule; +use Inertia\Inertia; class BuilderRanksController extends WebController { + use RendersReviewApp; + public function index(Request $request) { Gate::authorize('viewAny', BuilderRankApplication::class); $applications = BuilderRankApplication::orderbyRaw('FIELD(status, '.ApplicationStatus::IN_PROGRESS->value.') DESC') + ->with('account.minecraftAccount') ->orderBy('created_at', 'desc') ->paginate(100); - return view('manage.pages.builder-rank.index') - ->with(compact('applications')); + return $this->inertiaRender('BuilderRankApplications/BuilderRankApplicationList', + compact('applications'), + ); } public function show(Request $request, BuilderRankApplication $application) diff --git a/app/Http/Controllers/Review/HomeController.php b/app/Http/Controllers/Review/HomeController.php index 775c4dcd2..0341bff8f 100644 --- a/app/Http/Controllers/Review/HomeController.php +++ b/app/Http/Controllers/Review/HomeController.php @@ -2,14 +2,16 @@ namespace App\Http\Controllers\Review; +use App\Domains\Review\RendersReviewApp; use App\Http\Controllers\WebController; use Illuminate\Http\Request; -use Inertia\Inertia; class HomeController extends WebController { + use RendersReviewApp; + public function __invoke(Request $request) { - return Inertia::render('Home'); + return $this->inertiaRender('Home'); } } diff --git a/app/Http/Middleware/HandleInertiaRequests.php b/app/Http/Middleware/HandleInertiaRequests.php index c86c9668b..c8b5fc7d3 100644 --- a/app/Http/Middleware/HandleInertiaRequests.php +++ b/app/Http/Middleware/HandleInertiaRequests.php @@ -16,15 +16,9 @@ class HandleInertiaRequests extends Middleware */ public function rootView(Request $request) { - $prefix = $request->route()->getPrefix(); - - if ($prefix == '/manage') { - return 'manage.app'; - } else if ($prefix == '/review') { - return 'review.app'; - } else { - return parent::rootView($request); - } + // We define this inside Controllers instead due to supporting + // multiple Inertia apps + return parent::rootView($request); } /** diff --git a/resources/js/manage/Components/InfinitePagination.vue b/resources/js/manage/Components/InfinitePagination.vue index d8e8b60d0..f0efc8ea8 100644 --- a/resources/js/manage/Components/InfinitePagination.vue +++ b/resources/js/manage/Components/InfinitePagination.vue @@ -62,7 +62,7 @@ const load = async () => { if (cursor == null) { stop() } - return response.data.data + return response.data?.data ?? [] } finally { loading.value = false } diff --git a/resources/js/manage/Data/BanAppeal.ts b/resources/js/manage/Data/BanAppeal.ts index 65c6754d8..ea18075d6 100644 --- a/resources/js/manage/Data/BanAppeal.ts +++ b/resources/js/manage/Data/BanAppeal.ts @@ -1,6 +1,6 @@ -import { PlayerBan } from '../../manage/Data/PlayerBan' -import { Player } from '../../manage/Data/Player' import { BanAppealStatus } from './BanAppealStatus' +import { Player } from './Player' +import { PlayerBan } from './PlayerBan' export interface BanAppeal { id: number, diff --git a/resources/js/manage/Data/BuilderRankApplication.ts b/resources/js/manage/Data/BuilderRankApplication.ts new file mode 100644 index 000000000..dcca18bcc --- /dev/null +++ b/resources/js/manage/Data/BuilderRankApplication.ts @@ -0,0 +1,23 @@ +import { Account } from './Account' + +export interface BuilderRankApplication { + id: number, + account_id: number, + account?: Account, + minecraft_alias: string, + current_builder_rank: string, + build_location: string, + build_description: string, + additional_notes?: string, + status: BuilderRankApplicationStatus, + denied_reason?: string, + closed_at?: string, + created_at: string, + updated_at: string, +} + +export enum BuilderRankApplicationStatus { + pending = 1, + approved, + denied, +} diff --git a/resources/js/review/Layouts/Root/Partials/SideBar.vue b/resources/js/review/Layouts/Root/Partials/SideBar.vue index ab1667524..8d8fe2b9c 100644 --- a/resources/js/review/Layouts/Root/Partials/SideBar.vue +++ b/resources/js/review/Layouts/Root/Partials/SideBar.vue @@ -50,7 +50,7 @@ const selected = ref(null)
  • -
    +
    @@ -98,9 +97,9 @@ function submit() {
    -
    Account Verified
    +
    Submitted by account?
    - + {{ banAppeal.is_account_verified ? 'Yes' : 'No' }}
    diff --git a/resources/js/review/Pages/BanAppeals/Partials/BanAppealListTable.vue b/resources/js/review/Pages/BanAppeals/Partials/BanAppealListTable.vue index 217c41a72..2e6961cdc 100644 --- a/resources/js/review/Pages/BanAppeals/Partials/BanAppealListTable.vue +++ b/resources/js/review/Pages/BanAppeals/Partials/BanAppealListTable.vue @@ -2,8 +2,8 @@ import { distance, distanceFromNow, format } from '../../../../manage/Utilities/DateFormatter' import { computed } from 'vue' import DataTable from '../../../../manage/Components/DataTable.vue' -import { BanAppeal } from '../../../Data/BanAppeal' -import { BanAppealStatus } from '../../../Data/BanAppealStatus' +import { BanAppeal } from '../../../../manage/Data/BanAppeal' +import { BanAppealStatus } from '../../../../manage/Data/BanAppealStatus' import FilledButton from '../../../../manage/Components/FilledButton.vue' import Pill from '../../../../manage/Components/Pill.vue' import { Link } from '@inertiajs/vue3' diff --git a/resources/js/review/Pages/BuilderRankApplications/BuilderRankApplicationList.vue b/resources/js/review/Pages/BuilderRankApplications/BuilderRankApplicationList.vue new file mode 100644 index 000000000..0e24a1d53 --- /dev/null +++ b/resources/js/review/Pages/BuilderRankApplications/BuilderRankApplicationList.vue @@ -0,0 +1,35 @@ + + + diff --git a/resources/js/review/Pages/BuilderRankApplications/BuilderRankApplicationShow.vue b/resources/js/review/Pages/BuilderRankApplications/BuilderRankApplicationShow.vue new file mode 100644 index 000000000..a48b7c68f --- /dev/null +++ b/resources/js/review/Pages/BuilderRankApplications/BuilderRankApplicationShow.vue @@ -0,0 +1,300 @@ + + + diff --git a/resources/js/review/Pages/BuilderRankApplications/Partials/BuilderRankApplicationListTable.vue b/resources/js/review/Pages/BuilderRankApplications/Partials/BuilderRankApplicationListTable.vue new file mode 100644 index 000000000..8924852d2 --- /dev/null +++ b/resources/js/review/Pages/BuilderRankApplications/Partials/BuilderRankApplicationListTable.vue @@ -0,0 +1,75 @@ + + + diff --git a/resources/sass/front/front.scss b/resources/sass/front/front.scss index 8b8df635b..079fef5ec 100644 --- a/resources/sass/front/front.scss +++ b/resources/sass/front/front.scss @@ -4,6 +4,8 @@ @tailwind components; @tailwind utilities; + +// --- WARNING: everything below here is deprecated --- @import "foundation/colors"; @import "foundation/dimensions"; @import "foundation/typography"; diff --git a/routes/web_review.php b/routes/web_review.php index 8cd3b2f7d..4a5ed072a 100644 --- a/routes/web_review.php +++ b/routes/web_review.php @@ -18,21 +18,14 @@ ->group(function() { Route::get('/', HomeController::class); - Route::group([ - 'prefix' => 'builder-ranks', - 'as' => 'builder-ranks.', - ], function () { - Route::get('/', [BuilderRanksController::class, 'index']) - ->name('index'); + Route::prefix('builder-ranks')->group(function () { + Route::get('/', [BuilderRanksController::class, 'index']); - Route::get('{application}', [BuilderRanksController::class, 'show']) - ->name('show'); - - Route::post('{application}/approve', [BuilderRanksController::class, 'approve']) - ->name('approve'); - - Route::post('{application}/deny', [BuilderRanksController::class, 'deny']) - ->name('deny'); + Route::prefix('{application}')->group(function () { + Route::get('/', [BuilderRanksController::class, 'show']); + Route::post('approve', [BuilderRanksController::class, 'approve']); + Route::post('deny', [BuilderRanksController::class, 'deny']); + }); }); Route::resource('ban-appeals', BanAppealController::class)