From f77866faa5c5eb3055d80c06669469dfea3a6ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Mon, 1 Jun 2026 08:53:46 +0300 Subject: [PATCH] refactor: parse track titles for styles, update date formatting, and adjust UI transition animations in music production views --- .../front/music-productions/index.blade.php | 28 ++++-- .../front/music-productions/show.blade.php | 93 +++++++++++++++++-- 2 files changed, 103 insertions(+), 18 deletions(-) diff --git a/resources/views/front/music-productions/index.blade.php b/resources/views/front/music-productions/index.blade.php index 24a2185..688053f 100644 --- a/resources/views/front/music-productions/index.blade.php +++ b/resources/views/front/music-productions/index.blade.php @@ -103,22 +103,32 @@ @foreach($productions as $index => $production) @php $variant = $variants[$index % count($variants)]; - $categoryLabel = $production->translate('client_name') ?: __('music_productions.card_category_default'); $detailUrl = route('music-productions.show', $production->slug); + + $fullTitle = $production->translate('title'); + $titlePart = $fullTitle; + $stylePart = ''; + if (preg_match('/^(.*?)\s*\((.*?)\)\s*$/u', $fullTitle, $matches)) { + $titlePart = trim($matches[1]); + $stylePart = trim($matches[2]); + } + if (empty($stylePart)) { + $stylePart = $production->translate('client_name') ?: __('music_productions.card_category_default'); + } @endphp
-
{{ $production->translate('client_name') ?: __('music_productions.card_category_default') }}
-
+
{{ $titlePart }}
+
{{ $stylePart }}
+
@if($production->production_date) - {{ $production->production_date->format('Y') }} + {{ $production->production_date->format('d.m.Y') }} @else   @endif
-
{{ $production->translate('title') }}
@@ -317,8 +327,8 @@ --color-white: #fff; --color-yellow: #f0f39c; --color-yellow-light: #fff99e; - --transition-time: 250ms; - --transition-method: ease-in-out; + --transition-time: 550ms; + --transition-method: cubic-bezier(0.34, 1.56, 0.64, 1); --album-size: 260px; --vinyl-offset: 15px; --vinyl-size: calc(var(--album-size) - var(--vinyl-offset)); @@ -418,9 +428,7 @@ .player .player__track::before, .player .player__track::after { - content: '"'; - font-size: 14px; - vertical-align: middle; + content: none; } .album { diff --git a/resources/views/front/music-productions/show.blade.php b/resources/views/front/music-productions/show.blade.php index b31d182..567d350 100644 --- a/resources/views/front/music-productions/show.blade.php +++ b/resources/views/front/music-productions/show.blade.php @@ -1,6 +1,80 @@ @extends('layouts.site') @section('content') +@php + $fullTitle = $production->translate('title'); + $titlePart = $fullTitle; + $stylePart = ''; + if (preg_match('/^(.*?)\s*\((.*?)\)\s*$/u', $fullTitle, $matches)) { + $titlePart = trim($matches[1]); + $stylePart = trim($matches[2]); + } + + $contentHtml = $production->translate('content'); + + $isYoutubeFormat = false; + if (stripos($contentHtml, 'Provided to YouTube') !== false || stripos($contentHtml, 'Auto-generated by YouTube') !== false) { + $isYoutubeFormat = true; + } + + $trackNameParsed = null; + $styleParsed = null; + $distributor = null; + $contributors = []; + $label = null; + $releasedOn = null; + $remainingLines = []; + + if ($isYoutubeFormat) { + $rawText = strip_tags(str_replace(['

', '

', '
', '
', '
'], ["\n", "\n", "\n", "\n", "\n"], $contentHtml)); + $lines = array_filter(array_map('trim', explode("\n", $rawText))); + + foreach ($lines as $line) { + if (empty($line)) continue; + + if (preg_match('/Provided to YouTube by\s+(.+)/i', $line, $m)) { + $distributor = trim($m[1]); + } + elseif (strpos($line, '·') !== false) { + $parts = array_map('trim', explode('·', $line)); + if (count($parts) > 0) { + $trackPart = $parts[0]; + if (preg_match('/^(.*?)\s*\((.*?)\)\s*$/u', $trackPart, $tm)) { + $trackNameParsed = trim($tm[1]); + $styleParsed = trim($tm[2]); + } else { + $trackNameParsed = $trackPart; + } + + for ($i = 1; $i < count($parts); $i++) { + $contributors[] = $parts[$i]; + } + } + } + elseif (preg_match('/℗\s*(.+)/u', $line, $m)) { + $label = trim($m[1]); + } + elseif (preg_match('/Released on:\s*(.+)/i', $line, $m)) { + $releasedOn = trim($m[1]); + } + elseif (stripos($line, 'Auto-generated by YouTube') !== false) { + // Skip line + } + elseif (stripos($line, 'YouTube\'da İzle') !== false || stripos($line, 'Watch on YouTube') !== false) { + // Skip line + } + else { + $normLine = trim(strtolower($line)); + $normTitle = trim(strtolower($production->translate('title'))); + if ($normLine === $normTitle || ($trackNameParsed && $normLine === trim(strtolower($trackNameParsed)))) { + continue; + } + $remainingLines[] = $line; + } + } + } +@endphp +
@@ -11,7 +85,10 @@ {{ $production->translate('client_name') }}
@endif -

{{ $production->translate('title') }}

+

{{ $titlePart }}

+ @if($stylePart || $styleParsed) +

{{ $stylePart ?: $styleParsed }}

+ @endif @if($production->production_date)

@@ -45,15 +122,15 @@

-
{{ $production->translate('client_name') ?: __('music_productions.card_category_default') }}
-
+
{{ $titlePart }}
+
{{ $stylePart ?: ($production->translate('client_name') ?: __('music_productions.card_category_default')) }}
+
@if($production->production_date) - {{ $production->production_date->format('Y') }} + {{ $production->production_date->format('d.m.Y') }} @else   @endif
-
{{ $production->translate('title') }}
@@ -210,8 +287,8 @@ --color-white: #fff; --color-yellow: #f0f39c; --color-yellow-light: #fff99e; - --transition-time: 250ms; - --transition-method: ease-in-out; + --transition-time: 550ms; + --transition-method: cubic-bezier(0.34, 1.56, 0.64, 1); --album-size: 310px; --vinyl-offset: 20px; --vinyl-size: calc(var(--album-size) - var(--vinyl-offset)); @@ -259,7 +336,7 @@ .player .player__content { background-color: var(--color-white); - height: 100%; + height: 135%; padding: 70px 20px 0 20px; position: relative; text-align: left;