feat: ship creator journey v2 and profile updates

This commit is contained in:
2026-04-12 21:42:07 +02:00
parent a2457f4e49
commit d5cff21ea2
335 changed files with 20147 additions and 1545 deletions

View File

@@ -22,6 +22,7 @@ final class SearchController extends Controller
{
$q = trim((string) $request->query('q', ''));
$sort = $request->query('sort', 'latest');
$hasQuery = $q !== '';
$sortMap = [
'popular' => 'views:desc',
@@ -30,17 +31,17 @@ final class SearchController extends Controller
'downloads' => 'downloads:desc',
];
$artworks = $q !== ''
$artworks = $hasQuery
? $this->search->search($q, [
'sort' => ($sortMap[$sort] ?? 'created_at:desc'),
])
: $this->search->popular(24);
$groups = $q !== ''
$groups = $hasQuery
? $this->groups->searchCards($q, $request->user(), 6)
: $this->groups->surfaceCards($request->user(), 'featured', 4);
$news = $q !== ''
$news = $hasQuery
? NewsArticle::query()
->with(['author:id,username,name', 'category:id,name,slug'])
->published()
@@ -55,15 +56,59 @@ final class SearchController extends Controller
->get()
: collect();
$groupResults = collect($groups ?? []);
$newsResults = collect($news ?? []);
$resultCount = method_exists($artworks, 'total') ? (int) $artworks->total() : 0;
$groupResultCount = $groupResults->count();
$newsResultCount = $newsResults->count();
$hasAnyResults = $resultCount > 0 || $groupResultCount > 0 || $newsResultCount > 0;
$galleryArtworks = collect(method_exists($artworks, 'items') ? $artworks->items() : $artworks)
->map(fn ($art) => $this->mapArtworkCard($art))
->values();
$galleryNextPageUrl = method_exists($artworks, 'nextPageUrl') ? $artworks->nextPageUrl() : null;
return view('search.index', [
'q' => $q,
'hasQuery' => $hasQuery,
'sort' => $sort,
'groups' => $groups,
'groupResults' => $groupResults,
'groupResultCount' => $groupResultCount,
'artworks' => $artworks,
'resultCount' => $resultCount,
'news' => $news,
'page_title' => $q !== '' ? 'Search: ' . $q . ' — Skinbase' : 'Search — Skinbase',
'newsResults' => $newsResults,
'newsResultCount' => $newsResultCount,
'hasAnyResults' => $hasAnyResults,
'galleryArtworks' => $galleryArtworks,
'galleryNextPageUrl' => $galleryNextPageUrl,
'page_title' => $hasQuery ? 'Search: ' . $q . ' — Skinbase' : 'Search — Skinbase',
'page_meta_description' => 'Search Skinbase for artworks, creators, groups, photography, wallpapers and skins.',
'page_robots' => 'noindex,follow',
]);
}
private function mapArtworkCard(mixed $artwork): array
{
return [
'id' => $artwork->id ?? null,
'name' => $artwork->name ?? null,
'thumb' => $artwork->thumb_url ?? $artwork->thumb ?? null,
'thumb_srcset' => $artwork->thumb_srcset ?? null,
'uname' => $artwork->uname ?? '',
'username' => $artwork->username ?? '',
'avatar_url' => $artwork->avatar_url ?? null,
'profile_url' => $artwork->profile_url ?? null,
'published_as_type' => $artwork->published_as_type ?? null,
'publisher' => $artwork->publisher ?? null,
'category_name' => $artwork->category_name ?? '',
'category_slug' => $artwork->category_slug ?? '',
'slug' => $artwork->slug ?? '',
'width' => $artwork->width ?? null,
'height' => $artwork->height ?? null,
'views' => $artwork->views ?? null,
'likes' => $artwork->likes ?? null,
'downloads' => $artwork->downloads ?? null,
];
}
}