Frontend-Umbau (Kevin, 06.07.2026), Ergebnis des businessportal24-Audits: - Fake-Anzeigen und Mock-/Fallback-Daten entfernt (focus-ad, feed-ad, highlight-card, press-release-card, featured-releases, press-releases-grid); Sektionen rendern nur noch mit echten Daten oder gar nicht - Newsletter-Strip und Newsletter-Box zurueckgebaut (Feature nachgelagert, vor Reaktivierung DOI-Flow noetig) - Echte Boersendaten: MarketDataService (Yahoo-Finance-Quotes, config/market.php, Cache) + market:refresh alle 15 Min. im Scheduler; live-ticker blendet sich ohne Daten aus - EN-Lokalisierung der Kern-Seiten via lang/de/web.php + lang/en/web.php; Carbon-Locale folgt app()->getLocale() - Web-Tests auf den neuen Frontend-Stand nachgezogen (Suite: 993 gruen) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
140 lines
4.8 KiB
PHP
140 lines
4.8 KiB
PHP
<?php
|
|
|
|
use App\Enums\Portal;
|
|
use App\Enums\PressReleaseStatus;
|
|
use App\Models\PressRelease;
|
|
use App\Support\EditorialClock;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Pagination\LengthAwarePaginator;
|
|
use Illuminate\Support\Carbon;
|
|
use Livewire\Attributes\Locked;
|
|
use Livewire\Volt\Component;
|
|
use Livewire\WithPagination;
|
|
|
|
new class extends Component
|
|
{
|
|
use WithPagination;
|
|
|
|
public string $timeframe = 'all';
|
|
|
|
#[Locked]
|
|
public ?string $portal = null;
|
|
|
|
#[Locked]
|
|
public string $language = 'de';
|
|
|
|
protected array $queryString = [
|
|
'timeframe' => ['except' => 'all'],
|
|
];
|
|
|
|
public function setTimeframe(string $timeframe): void
|
|
{
|
|
$this->timeframe = $timeframe;
|
|
$this->resetPage();
|
|
}
|
|
|
|
public function with(): array
|
|
{
|
|
return [
|
|
'releases' => $this->pressReleases(),
|
|
'totalCount' => $this->totalCount(),
|
|
];
|
|
}
|
|
|
|
private function pressReleases(): LengthAwarePaginator
|
|
{
|
|
$reference = $this->referenceNow();
|
|
|
|
return $this->baseQuery()
|
|
->when($this->timeframe === 'today', fn (Builder $query) => $query->whereDate('published_at', $reference->toDateString()))
|
|
->when($this->timeframe === 'week', fn (Builder $query) => $query->where('published_at', '>=', $reference->copy()->subDays(7)))
|
|
->orderByDesc('published_at')
|
|
->paginate(8);
|
|
}
|
|
|
|
private function referenceNow(): Carbon
|
|
{
|
|
return EditorialClock::reference($this->portalValues(), $this->language);
|
|
}
|
|
|
|
private function totalCount(): int
|
|
{
|
|
return $this->baseQuery()->count();
|
|
}
|
|
|
|
private function baseQuery(): Builder
|
|
{
|
|
return PressRelease::query()
|
|
->with([
|
|
'company',
|
|
'category.translations' => fn ($query) => $query->where('locale', $this->language),
|
|
'images' => fn ($query) => $query
|
|
->orderByDesc('is_preview')
|
|
->orderBy('sort_order')
|
|
->limit(1),
|
|
])
|
|
->whereIn('portal', $this->portalValues())
|
|
->where('status', PressReleaseStatus::Published)
|
|
->where('language', $this->language)
|
|
->whereNotNull('published_at')
|
|
->where('published_at', '<=', now());
|
|
}
|
|
|
|
/**
|
|
* @return array<int, string>
|
|
*/
|
|
private function portalValues(): array
|
|
{
|
|
$primary = $this->portal ?? Portal::Businessportal24->value;
|
|
|
|
return [$primary, Portal::Both->value];
|
|
}
|
|
}; ?>
|
|
|
|
<div wire:loading.class="opacity-60">
|
|
<header class="flex items-baseline justify-between mb-4 min-h-[34px] flex-wrap gap-3">
|
|
<h2 class="font-serif text-[28px] font-semibold m-0 tracking-[-0.3px] leading-[1.2] text-ink">
|
|
{{ __('web.feed.title') }}
|
|
</h2>
|
|
<div class="flex gap-[18px] text-[12.5px] text-ink-3">
|
|
<button type="button" wire:click="setTimeframe('all')"
|
|
class="cursor-pointer transition-colors @if ($timeframe === 'all') text-ink border-b-[1.5px] border-brand pb-0.5 @else hover:text-ink @endif">
|
|
{{ __('web.feed.filter_all') }}
|
|
</button>
|
|
<button type="button" wire:click="setTimeframe('today')"
|
|
class="cursor-pointer transition-colors @if ($timeframe === 'today') text-ink border-b-[1.5px] border-brand pb-0.5 @else hover:text-ink @endif">
|
|
{{ __('web.feed.filter_today') }}
|
|
</button>
|
|
<button type="button" wire:click="setTimeframe('week')"
|
|
class="cursor-pointer transition-colors @if ($timeframe === 'week') text-ink border-b-[1.5px] border-brand pb-0.5 @else hover:text-ink @endif">
|
|
{{ __('web.feed.filter_week') }}
|
|
</button>
|
|
</div>
|
|
</header>
|
|
<hr class="rule-strong">
|
|
|
|
@php
|
|
$items = $releases->items();
|
|
$top = $items[0] ?? null;
|
|
$rest = array_slice($items, 1);
|
|
@endphp
|
|
|
|
@if ($top)
|
|
<x-web.feed-top-item :release="$top" />
|
|
@else
|
|
<p class="py-8 text-[13.5px] text-ink-3 m-0">{{ __('web.feed.empty') }}</p>
|
|
@endif
|
|
|
|
@foreach ($rest as $release)
|
|
<x-web.feed-item :release="$release" :recommended="($release->content_score ?? 0) >= 80" />
|
|
@endforeach
|
|
|
|
@if ($releases->hasMorePages())
|
|
<div class="flex justify-center mt-7">
|
|
<a href="{{ $releases->nextPageUrl() }}"
|
|
class="inline-flex items-center gap-2 px-[18px] py-2.5 text-[13px] font-semibold text-ink bg-transparent border border-bg-rule-strong rounded-[2px] cursor-pointer hover:bg-ink hover:text-bg transition-colors">
|
|
{{ __('web.feed.more', ['count' => number_format(max(0, $totalCount - $releases->currentPage() * $releases->perPage()), 0, ',', '.')]) }} →
|
|
</a>
|
|
</div>
|
|
@endif
|
|
</div>
|