Wire admin studio SSR and search infrastructure
This commit is contained in:
@@ -3,12 +3,15 @@
|
||||
namespace App\Http\Controllers\Web\Posts;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Support\Seo\SeoFactory;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
class FollowingFeedController extends Controller
|
||||
{
|
||||
public function __construct(private SeoFactory $seoFactory) {}
|
||||
|
||||
/**
|
||||
* GET /feed/following
|
||||
* Renders the Following Feed Inertia page.
|
||||
@@ -16,6 +19,13 @@ class FollowingFeedController extends Controller
|
||||
*/
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$seo = $this->seoFactory->simplePage(
|
||||
title: 'Following Feed — ' . config('seo.site_name', 'Skinbase'),
|
||||
description: 'Posts from creators you follow on Skinbase.',
|
||||
canonical: url('/feed/following'),
|
||||
indexable: false,
|
||||
);
|
||||
|
||||
return Inertia::render('Feed/FollowingFeed', [
|
||||
'auth' => [
|
||||
'user' => $request->user() ? [
|
||||
@@ -25,6 +35,7 @@ class FollowingFeedController extends Controller
|
||||
'avatar' => $request->user()->profile?->avatar_url ?? null,
|
||||
] : null,
|
||||
],
|
||||
'seo' => $seo,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,26 @@
|
||||
namespace App\Http\Controllers\Web\Posts;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Support\Seo\SeoFactory;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
class HashtagFeedController extends Controller
|
||||
{
|
||||
public function __construct(private SeoFactory $seoFactory) {}
|
||||
|
||||
/** GET /tags/{tag} */
|
||||
public function index(Request $request, string $tag): Response
|
||||
{
|
||||
$normalTag = strtolower($tag);
|
||||
|
||||
$seo = $this->seoFactory->simplePage(
|
||||
title: '#' . $normalTag . ' — ' . config('seo.site_name', 'Skinbase'),
|
||||
description: 'Explore posts tagged with #' . $normalTag . ' on Skinbase.',
|
||||
canonical: url('/tags/' . rawurlencode($normalTag)),
|
||||
);
|
||||
|
||||
return Inertia::render('Feed/HashtagFeed', [
|
||||
'auth' => $request->user() ? [
|
||||
'user' => [
|
||||
@@ -21,7 +32,8 @@ class HashtagFeedController extends Controller
|
||||
'avatar' => $request->user()->profile?->avatar_url ?? null,
|
||||
],
|
||||
] : null,
|
||||
'tag' => strtolower($tag),
|
||||
'tag' => $normalTag,
|
||||
'seo' => $seo,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,25 @@
|
||||
namespace App\Http\Controllers\Web\Posts;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Support\Seo\SeoFactory;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
class SavedFeedController extends Controller
|
||||
{
|
||||
public function __construct(private SeoFactory $seoFactory) {}
|
||||
|
||||
/** GET /feed/saved */
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$seo = $this->seoFactory->simplePage(
|
||||
title: 'Saved Posts — ' . config('seo.site_name', 'Skinbase'),
|
||||
description: 'Your saved posts on Skinbase.',
|
||||
canonical: url('/feed/saved'),
|
||||
indexable: false,
|
||||
);
|
||||
|
||||
return Inertia::render('Feed/SavedFeed', [
|
||||
'auth' => [
|
||||
'user' => [
|
||||
@@ -21,6 +31,7 @@ class SavedFeedController extends Controller
|
||||
'avatar' => $request->user()->profile?->avatar_url ?? null,
|
||||
],
|
||||
],
|
||||
'seo' => $seo,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Web\Posts;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Posts\PostHashtagService;
|
||||
use App\Support\Seo\SeoFactory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Inertia\Inertia;
|
||||
@@ -11,7 +12,10 @@ use Inertia\Response;
|
||||
|
||||
class SearchFeedController extends Controller
|
||||
{
|
||||
public function __construct(private PostHashtagService $hashtagService) {}
|
||||
public function __construct(
|
||||
private PostHashtagService $hashtagService,
|
||||
private SeoFactory $seoFactory,
|
||||
) {}
|
||||
|
||||
/** GET /feed/search */
|
||||
public function index(Request $request): Response
|
||||
@@ -22,6 +26,12 @@ class SearchFeedController extends Controller
|
||||
fn () => $this->hashtagService->trending(10, 24)
|
||||
);
|
||||
|
||||
$seo = $this->seoFactory->simplePage(
|
||||
title: 'Search Posts — ' . config('seo.site_name', 'Skinbase'),
|
||||
description: 'Search posts, hashtags and creators on Skinbase.',
|
||||
canonical: url('/feed/search'),
|
||||
);
|
||||
|
||||
return Inertia::render('Feed/SearchFeed', [
|
||||
'auth' => $request->user() ? [
|
||||
'user' => [
|
||||
@@ -31,8 +41,9 @@ class SearchFeedController extends Controller
|
||||
'avatar' => $request->user()->profile?->avatar_url ?? null,
|
||||
],
|
||||
] : null,
|
||||
'initialQuery' => $request->query('q', ''),
|
||||
'trendingHashtags' => $trendingHashtags,
|
||||
'initialQuery' => $request->query('q', ''),
|
||||
'trendingHashtags' => $trendingHashtags,
|
||||
'seo' => $seo,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Web\Posts;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Posts\PostHashtagService;
|
||||
use App\Support\Seo\SeoFactory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Inertia\Inertia;
|
||||
@@ -11,13 +12,22 @@ use Inertia\Response;
|
||||
|
||||
class TrendingFeedController extends Controller
|
||||
{
|
||||
public function __construct(private PostHashtagService $hashtagService) {}
|
||||
public function __construct(
|
||||
private PostHashtagService $hashtagService,
|
||||
private SeoFactory $seoFactory,
|
||||
) {}
|
||||
|
||||
/** GET /feed/trending */
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$trendingHashtags = Cache::remember('trending_hashtags', 300, fn () => $this->hashtagService->trending(10, 24));
|
||||
|
||||
$seo = $this->seoFactory->simplePage(
|
||||
title: 'Trending Posts — ' . config('seo.site_name', 'Skinbase'),
|
||||
description: 'Discover the most popular and engaging posts on Skinbase right now.',
|
||||
canonical: url('/feed/trending'),
|
||||
);
|
||||
|
||||
return Inertia::render('Feed/TrendingFeed', [
|
||||
'auth' => $request->user() ? [
|
||||
'user' => [
|
||||
@@ -28,6 +38,7 @@ class TrendingFeedController extends Controller
|
||||
],
|
||||
] : null,
|
||||
'trendingHashtags' => $trendingHashtags,
|
||||
'seo' => $seo,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user