12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
159
resources/views/livewire/web/press-release-feed.blade.php
Normal file
159
resources/views/livewire/web/press-release-feed.blade.php
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Models\PressRelease;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
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;
|
||||
|
||||
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
|
||||
{
|
||||
return $this->baseQuery()
|
||||
->when($this->timeframe === 'today', fn (Builder $query) => $query->whereDate('published_at', today()))
|
||||
->when($this->timeframe === 'week', fn (Builder $query) => $query->where('published_at', '>=', now()->subDays(7)))
|
||||
->orderByDesc('published_at')
|
||||
->paginate(8);
|
||||
}
|
||||
|
||||
private function totalCount(): int
|
||||
{
|
||||
return $this->baseQuery()->count();
|
||||
}
|
||||
|
||||
private function baseQuery(): Builder
|
||||
{
|
||||
return PressRelease::query()
|
||||
->with([
|
||||
'company',
|
||||
'category.translations' => fn ($query) => $query->where('locale', 'de'),
|
||||
'images' => fn ($query) => $query
|
||||
->orderByDesc('is_preview')
|
||||
->orderBy('sort_order')
|
||||
->limit(1),
|
||||
])
|
||||
->whereIn('portal', $this->portalValues())
|
||||
->where('status', PressReleaseStatus::Published)
|
||||
->where('language', 'de')
|
||||
->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('kategorien') }}"
|
||||
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">
|
||||
Alle Rubriken entdecken →
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue