Homepage
- Add HomepageService with hero, trending (award-weighted), fresh uploads,
popular tags, creator spotlight (weekly uploads ranking), and news sections
- Add React components: HomePage, HomeHero, HomeTrending, HomeFresh,
HomeTags, HomeCreators, HomeNews (lazy-loaded below the fold)
- Wire home.blade.php with JSON props, SEO meta, JSON-LD, and hero preload
- Add HomePage.jsx to vite.config.js inputs
Profile page
- Hero banner with random user artwork as background + dark gradient overlay
- Favourites section uses real Artwork models + <x-artwork-card> for CDN URLs
- Newest artworks grid: gallery-grid → grid grid-cols-2 gap-4
Edit Profile page (user.blade.php)
- Add hero banner (featured wallpaper/photography via artwork_features,
content_type_id IN [2,3]) sourced in UserController
- Remove bg-deep from outer wrapper; card backgrounds: bg-panel → bg-nova-800
- Remove stray AI-generated tag fragment from template
Author profile links
- Fix all /@username routes in: HomepageService, MonthlyCommentatorsController,
LatestCommentsController, MyBuddiesController and corresponding blade views
Legacy view namespace
- Register View::addNamespace('legacy', resource_path('views/_legacy'))
in AppServiceProvider::boot()
- Convert all view('legacy.x') and @include('legacy.x') calls to legacy::x
- Migrate legacy views to resources/views/_legacy/ with namespace support
99 lines
2.9 KiB
PHP
99 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Legacy;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Artwork;
|
|
use App\Services\ArtworkService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class DailyUploadsController extends Controller
|
|
{
|
|
protected ArtworkService $artworks;
|
|
|
|
public function __construct(ArtworkService $artworks)
|
|
{
|
|
$this->artworks = $artworks;
|
|
}
|
|
|
|
public function index(Request $request)
|
|
{
|
|
$isAjax = $request->boolean('ajax');
|
|
$datum = $request->query('datum');
|
|
|
|
if ($isAjax && $datum) {
|
|
// Return partial gallery for the given date
|
|
$arts = $this->fetchByDate($datum);
|
|
return view('legacy::partials.daily-uploads-grid', ['arts' => $arts])->render();
|
|
}
|
|
|
|
// Build date tabs (today .. -14 days)
|
|
$dates = [];
|
|
for ($x = 0; $x > -15; $x--) {
|
|
$ts = strtotime(sprintf('%+d days', $x));
|
|
$dates[] = [
|
|
'iso' => date('Y-m-d', $ts),
|
|
'label' => date('d. F Y', $ts),
|
|
];
|
|
}
|
|
|
|
// initial content: recent (last 7 days)
|
|
$recent = $this->fetchRecent();
|
|
|
|
return view('legacy::daily-uploads', [
|
|
'dates' => $dates,
|
|
'recent' => $recent,
|
|
'page_title' => 'Daily Uploads',
|
|
]);
|
|
}
|
|
|
|
private function fetchByDate(string $date)
|
|
{
|
|
$ars = Artwork::public()
|
|
->published()
|
|
->whereDate('published_at', $date)
|
|
->orderByDesc('published_at')
|
|
->with(['user:id,name', 'categories' => function ($q) {
|
|
$q->select('categories.id', 'categories.name', 'categories.sort_order');
|
|
}])
|
|
->get();
|
|
|
|
return $this->prepareArts($ars);
|
|
}
|
|
|
|
private function fetchRecent()
|
|
{
|
|
$start = now()->subDays(7)->startOfDay();
|
|
|
|
$ars = Artwork::public()
|
|
->published()
|
|
->where('published_at', '>=', $start)
|
|
->orderByDesc('published_at')
|
|
->with(['user:id,name', 'categories' => function ($q) {
|
|
$q->select('categories.id', 'categories.name', 'categories.sort_order');
|
|
}])
|
|
->get();
|
|
|
|
return $this->prepareArts($ars);
|
|
}
|
|
|
|
private function prepareArts($ars)
|
|
{
|
|
return $ars->map(function (Artwork $ar) {
|
|
$primaryCategory = $ar->categories->sortBy('sort_order')->first();
|
|
$present = \App\Services\ThumbnailPresenter::present($ar, 'md');
|
|
|
|
return (object) [
|
|
'id' => $ar->id,
|
|
'name' => $ar->title,
|
|
'thumb' => $present['url'],
|
|
'thumb_srcset' => $present['srcset'] ?? $present['url'],
|
|
'gid_num' => $primaryCategory ? ((int) $primaryCategory->id % 5) * 5 : 0,
|
|
'category_name' => $primaryCategory->name ?? '',
|
|
'uname' => $ar->user->name ?? 'Skinbase',
|
|
];
|
|
});
|
|
}
|
|
}
|