Display CMS: Footer-Verlauf, Format-Hinweise und Switch-Fixes.
Blendet den B2IN-Text-Verlauf ohne Footer aus, zeigt 9:16-Format-Badges in der Mediathek, normalisiert Modul-Booleans und korrigiert Flux-Switches im Dark Mode. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
6c2da9bdac
commit
7491d20d39
14 changed files with 366 additions and 10 deletions
|
|
@ -324,6 +324,25 @@ class DisplayVersionEditor extends Component
|
|||
return url('/preview/module/'.$this->version->id.'/item/'.$this->itemId).'?refresh='.$this->previewFrameRefreshCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{status: 'match'|'mismatch'|'unknown', label: string, color: string, description: string}|null
|
||||
*/
|
||||
public function displayMediaFormatStatus(?string $url): ?array
|
||||
{
|
||||
$url = trim((string) $url);
|
||||
|
||||
if ($url === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->displayMediaForUrl($url)?->getDisplayFormatStatus() ?? [
|
||||
'status' => 'unknown',
|
||||
'label' => 'Format unbekannt',
|
||||
'color' => 'zinc',
|
||||
'description' => 'Dieses Medium wurde nicht in der Mediathek gefunden. Ziel ist 9:16 im Hochformat.',
|
||||
];
|
||||
}
|
||||
|
||||
#[On('display-media-selected')]
|
||||
public function onDisplayMediaSelected(string $field, ?int $mediaId, ?string $url): void
|
||||
{
|
||||
|
|
@ -681,6 +700,33 @@ class DisplayVersionEditor extends Component
|
|||
$this->previewFrameRefreshCounter++;
|
||||
}
|
||||
|
||||
private function displayMediaForUrl(string $url): ?DisplayMedia
|
||||
{
|
||||
$mediaPath = $this->mediaPathFromUrl($url);
|
||||
|
||||
return DisplayMedia::query()
|
||||
->where('external_url', $url)
|
||||
->when($mediaPath !== null, fn ($query) => $query->orWhere('path', $mediaPath))
|
||||
->first();
|
||||
}
|
||||
|
||||
private function mediaPathFromUrl(string $url): ?string
|
||||
{
|
||||
$path = parse_url($url, PHP_URL_PATH);
|
||||
$path = is_string($path) ? $path : $url;
|
||||
$path = ltrim($path, '/');
|
||||
|
||||
if (str_starts_with($path, 'storage/')) {
|
||||
return substr($path, strlen('storage/'));
|
||||
}
|
||||
|
||||
if (str_starts_with($path, 'display-media/')) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue