Öffentliche Seiten auf gemeinsames Editorial-Design (x-web.site-header/-footer,
Design-Tokens) und Ausgaben-Präfix /{edition}/ (de|en) umgestellt.
- Routing: neue Middleware SetEdition (Locale + URL::defaults), /{edition}-Gruppe
in routes/web.php, Root-Redirect auf /de, 301 für Legacy-.html-URLs,
Baseline-Default in AppServiceProvider.
- Neue URL-Schemata: /{edition}/press-release/{slug}, /{edition}/category/{slug}.
- Ausgabe = Sprache: DE/EN-Umschalter (Region/CH/AT entfernt); EditorialClock
und Livewire-Komponenten sprachdynamisch.
- Detail-, Kategorie- und Veröffentlichen-Seite mit echten Daten neu aufgebaut.
- Suche aktiviert: Volt-Komponente livewire/web/search (Titel/Text/Keywords +
Firma + Rubrik, Filter, Sortierung, Pagination, URL-Parameter q/category/sort).
- Rubriken-Navigation statt Übersichtsseite: Helper CategoryNavigation;
web/kategorien.blade.php + Route entfernt (Legacy-301).
- Tests: Edition-Routing, Kategorie-Seite/-Navigation, Detail, Veröffentlichen,
Suche, EditorialClock. Doku in "Echte öffentliche Unterseiten.md" aktualisiert.
Co-authored-by: Cursor <cursoragent@cursor.com>
172 lines
7 KiB
PHP
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. MMM'),
|
|
'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>
|