presseportale/resources/views/livewire/web/press-release-feed.blade.php
Kevin Adametz 028b059975
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
Editorial-Frontend: oeffentliche Unterseiten, Preise & Linkpflege
Oeffentliche Strecke durchgaengig auf das Editorial-Design umgestellt und
datengetrieben gemacht:

- Newsrooms-Verzeichnis + Newsroom-Detailseiten (Suche, Pagination)
- Preise-Seite neu (Abos via Plan, Einzel-PM via config/billing, Add-ons via
  config/credits); Texte ausgelagert nach lang/{de,en}/pricing.php
- Pricing-Teaser-Komponente auf den Startseiten + Preise-Link in Header/Footer
- Statische Seiten im Editorial-Design ueber neue Komponente x-web.static-page:
  impressum, datenschutz, agb, cookies, faq (Akkordeon), hilfe, kontakt,
  ueber-uns, api (altes Theme/gradient-hero entfernt)
- Header/Footer-Linkpflege: tote #-Anker raus, FAQ/Hilfe/Cookies verlinkt,
  "Anmelden" fuehrt in den Hub
- Legacy-URL-Redirects (.html, presskit->newsroom, Regionen)
- Datums-Bugfix in Feed-Komponenten

Tests: NewsroomPage, PreisePage, PricingTeaser, StaticPages, NavigationLinks,
LegacyRedirect. Doku in docs/frontend aktualisiert.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 16:08:46 +00:00

172 lines
7 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">
Aktuelle Meldungen
</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">
Alle
</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">
Heute
</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">
Diese Woche
</button>
</div>
</header>
<hr class="rule-strong">
@php
$items = $releases->items();
$top = $items[0] ?? null;
$rest = array_slice($items, 1);
$mockFeedItems = [
['time' => '13:42', 'date' => '12. Mai', 'category' => 'Tourismus', 'title' => 'Nachhaltiger Tourismus auf Erfolgskurs: Buchungen steigen um 45 %', 'company' => 'GreenTravel Consulting', 'city' => 'Berlin', 'recommended' => true],
['time' => '12:55', 'date' => '12. Mai', 'category' => 'Bildung', 'title' => 'Digitalisierung im Bildungssektor: Schulen erhalten 2 Mrd. Euro Förderung', 'company' => 'EduTech Initiative', 'city' => 'Frankfurt'],
['time' => '11:20', 'date' => '12. Mai', 'category' => 'Medien', 'title' => 'Medienbranche im Umbruch: Streaming-Dienste überholen klassisches TV', 'company' => 'MediaWatch Analytics', 'city' => 'Hamburg'],
['time' => '10:48', 'date' => '12. Mai', 'category' => 'Handel', 'title' => 'Einzelhandel setzt auf KI: Personalisierte Shopping-Erlebnisse werden Standard', 'company' => 'RetailTech Innovations', 'city' => 'Köln', 'recommended' => true],
['time' => '09:33', 'date' => '12. Mai', 'category' => 'Gesundheit', 'title' => 'Telemedizin-Boom: 3 Millionen Online-Sprechstunden im letzten Quartal', 'company' => 'HealthConnect Digital', 'city' => 'Stuttgart'],
['time' => '08:15', 'date' => '12. Mai', 'category' => 'Mobilität', 'title' => 'E-Mobilität: Ladeinfrastruktur wächst um 38 % gegenüber Vorjahr', 'company' => 'eMobility Verband', 'city' => 'Düsseldorf'],
];
$inFeedAd = [
'time' => '12:14',
'date' => now()->translatedFormat('j. M'),
'category' => 'Cloud · Software',
'title' => 'Microsoft Azure: Neue EU-Region Frankfurt mit DSGVO-zertifizierter KI-Infrastruktur',
'company' => 'Microsoft Deutschland GmbH',
];
@endphp
@if ($top)
<x-web.feed-top-item :release="$top" />
@else
<x-web.feed-top-item />
@endif
@if (! empty($rest))
@foreach ($rest as $i => $release)
<x-web.feed-item :release="$release" :recommended="in_array($i, [0, 3], true)" />
@endforeach
@else
@foreach ($mockFeedItems as $mock)
<x-web.feed-item :mock="$mock" />
@endforeach
@endif
<x-web.feed-ad :ad="$inFeedAd" />
@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">
Weitere {{ number_format(max(0, $totalCount - $releases->currentPage() * $releases->perPage()), 0, ',', '.') }} Meldungen anzeigen →
</a>
</div>
@elseif (! $top)
<div class="flex justify-center mt-7">
<a href="{{ route('web.home') }}"
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">
Zur Startseite →
</a>
</div>
@endif
</div>