перевод лендинга на vue, добавление поддержки inertia
This commit is contained in:
@@ -14,7 +14,8 @@ use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\View\View;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
use Throwable;
|
||||
|
||||
class LandingController extends Controller
|
||||
@@ -23,7 +24,7 @@ class LandingController extends Controller
|
||||
Request $request,
|
||||
AzerothCoreAccountService $accounts,
|
||||
NewsService $news,
|
||||
): View
|
||||
): Response
|
||||
{
|
||||
$realmConfig = config('moonwell.realm');
|
||||
$rates = $realmConfig['rates'] ?? [];
|
||||
@@ -34,19 +35,25 @@ class LandingController extends Controller
|
||||
? route('cabinet.client')
|
||||
: '#join';
|
||||
|
||||
$posts = $news->listForLanding()
|
||||
->values()
|
||||
->map(fn (News $item, int $index): array => [
|
||||
'id' => $item->id,
|
||||
'title' => $item->title,
|
||||
'excerpt' => Str::limit(trim(strip_tags($item->body)), 200),
|
||||
'date' => $item->created_at?->locale(app()->getLocale())->isoFormat('D MMMM YYYY'),
|
||||
'tag' => 'Новости',
|
||||
'tagType' => 'patch',
|
||||
'image_url' => $item->image_url,
|
||||
'featured' => $index === 0,
|
||||
])
|
||||
->all();
|
||||
try {
|
||||
$posts = $news->listForLanding()
|
||||
->values()
|
||||
->map(fn (News $item, int $index): array => [
|
||||
'id' => $item->id,
|
||||
'title' => $item->title,
|
||||
'excerpt' => Str::limit(trim(strip_tags($item->body)), 200),
|
||||
'date' => $item->created_at?->locale(app()->getLocale())->isoFormat('D MMMM YYYY'),
|
||||
'tag' => 'Новости',
|
||||
'tagType' => 'patch',
|
||||
'image_url' => $item->image_url,
|
||||
'featured' => $index === 0,
|
||||
])
|
||||
->all();
|
||||
} catch (Throwable $exception) {
|
||||
report($exception);
|
||||
|
||||
$posts = [];
|
||||
}
|
||||
|
||||
$bootstrap = [
|
||||
'realm' => [
|
||||
@@ -61,16 +68,17 @@ class LandingController extends Controller
|
||||
'rates' => $rates,
|
||||
'client_version' => $realmConfig['client_version'] ?? '3.3.5a',
|
||||
'tagline' => $realmConfig['tagline'] ?? null,
|
||||
'server_name' => $realmConfig['server_name'] ?? 'MoonWell',
|
||||
],
|
||||
'play_url' => $playUrl,
|
||||
'playUrl' => $playUrl,
|
||||
'posts' => $posts,
|
||||
'tweaks' => [
|
||||
'variant' => 'forest',
|
||||
'particles' => true,
|
||||
'moon' => true,
|
||||
],
|
||||
'register_endpoint' => route('game-account.store'),
|
||||
'csrf_token' => csrf_token(),
|
||||
'registerEndpoint' => route('game-account.store'),
|
||||
'csrfToken' => csrf_token(),
|
||||
'auth' => [
|
||||
'authenticated' => $user !== null,
|
||||
'is_admin' => $user?->canAccessAdminPanel() ?? false,
|
||||
@@ -92,10 +100,7 @@ class LandingController extends Controller
|
||||
],
|
||||
];
|
||||
|
||||
return view('landing', [
|
||||
'bootstrap' => $bootstrap,
|
||||
'realm' => $realmConfig,
|
||||
]);
|
||||
return Inertia::render('Landing/Main', $bootstrap);
|
||||
}
|
||||
|
||||
public function register(
|
||||
|
||||
Reference in New Issue
Block a user