From 097c6719a18bd75c92d462e1f580074865efaa10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Mon, 11 May 2026 11:17:18 +0300 Subject: [PATCH] refactor: remove secondary landing page sections to enforce a hero-only product layout --- .../Products/Schemas/LandingPageSection.php | 117 +-------- app/Http/Controllers/ProductController.php | 9 +- .../views/front/products/landing.blade.php | 244 +----------------- 3 files changed, 12 insertions(+), 358 deletions(-) diff --git a/app/Filament/Admin/Resources/Products/Schemas/LandingPageSection.php b/app/Filament/Admin/Resources/Products/Schemas/LandingPageSection.php index 167c60f..abcbe5c 100644 --- a/app/Filament/Admin/Resources/Products/Schemas/LandingPageSection.php +++ b/app/Filament/Admin/Resources/Products/Schemas/LandingPageSection.php @@ -96,122 +96,7 @@ class LandingPageSection ]) ->columns(2) ->collapsible() - ->collapsed(), - - // App Features Section - Section::make(__('products.app_features_section')) - ->schema([ - Repeater::make('landing_page_data.features') - ->label(__('products.features')) - ->schema([ - Select::make('icon') - ->label(__('products.feature_icon')) - ->options($iconOptions) - ->searchable(), - TextInput::make('title') - ->label(__('products.feature_title')) - ->columnSpanFull(), - Textarea::make('description') - ->label(__('products.feature_description')) - ->rows(2) - ->columnSpanFull(), - ]) - ->columns(1) - ->defaultItems(0) - ->addActionLabel(__('products.add_feature')) - ->reorderable() - ->collapsible() - ->itemLabel(fn (array $state): ?string => $state['title'] ?? __('products.feature') . ' #' . ($state['_index'] ?? '')) - ->columnSpanFull(), - - // Note: Translations should match the order of features above - // Each feature translation array index should correspond to the feature index - ]) - ->collapsible() - ->collapsed(), - - // How It Works Section - Section::make(__('products.how_it_works_section')) - ->schema([ - FileUpload::make('landing_page_data.how_it_works.download_image') - ->label(__('products.how_it_works_image')) - ->image() - ->disk('public') - ->directory('products/landing') - ->columnSpanFull(), - TextInput::make('landing_page_data.how_it_works.download_form_label') - ->label(__('products.download_form_label')) - ->placeholder(__('products.download_form_label_placeholder')) - ->columnSpanFull(), - - // Steps (4 steps with translations) - Repeater::make('landing_page_data.how_it_works.steps') - ->label(__('products.steps')) - ->schema([ - TextInput::make('number') - ->label(__('products.step_number')) - ->numeric() - ->default(fn ($get) => ($get('../../../_index') ?? 0) + 1), - TextInput::make('title') - ->label(__('products.step_title')) - ->columnSpanFull(), - Textarea::make('description') - ->label(__('products.step_description')) - ->rows(2) - ->columnSpanFull(), - ]) - ->columns(1) - ->defaultItems(0) - ->reorderable() - ->collapsible() - ->itemLabel(fn (array $state): ?string => __('products.step') . ' ' . ($state['number'] ?? '') . ': ' . ($state['title'] ?? '')) - ->columnSpanFull(), - - // Note: Steps translations should match the order of steps above - // Each step translation array index should correspond to the step index - ]) - ->collapsible() - ->collapsed(), - - // Video Section - Section::make(__('products.video_section')) - ->schema([ - TextInput::make('landing_page_data.video.youtube_video_id') - ->label(__('products.youtube_video_id')) - ->placeholder('165101721') - ->helperText(__('products.youtube_video_id_helper')) - ->columnSpanFull(), - ]) - ->collapsible() - ->collapsed(), - - // FAQ Section - Section::make(__('products.faq_section')) - ->schema([ - Repeater::make('landing_page_data.faqs') - ->label(__('products.faqs')) - ->schema([ - TextInput::make('question') - ->label(__('products.faq_question')) - ->columnSpanFull(), - Textarea::make('answer') - ->label(__('products.faq_answer')) - ->rows(3) - ->columnSpanFull(), - ]) - ->columns(1) - ->defaultItems(0) - ->addActionLabel(__('products.add_faq')) - ->reorderable() - ->collapsible() - ->itemLabel(fn (array $state): ?string => $state['question'] ?? __('products.faq') . ' #' . ($state['_index'] ?? '')) - ->columnSpanFull(), - - // Note: FAQ translations should match the order of FAQs above - // Each FAQ translation array index should correspond to the FAQ index - ]) - ->collapsible() - ->collapsed(), + ->collapsed(false), ]) ->visible(fn (Get $get) => $get('type') === 'product') ->columnSpanFull(); diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index 4f05fbe..045a231 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -74,12 +74,7 @@ class ProductController extends Controller return view($product->view_template, compact('product', 'settings', 'renderedHeader', 'renderedFooter', 'meta')); } - // Use landing page template if landing_page_data exists - if (!empty($product->landing_page_data)) { - return view('front.products.landing', compact('product', 'settings', 'renderedHeader', 'renderedFooter', 'meta')); - } - - // Default view - return view('front.products.show', compact('product', 'settings', 'renderedHeader', 'renderedFooter', 'meta')); + // Use landing page template (Hero only) for all products + return view('front.products.landing', compact('product', 'settings', 'renderedHeader', 'renderedFooter', 'meta')); } } diff --git a/resources/views/front/products/landing.blade.php b/resources/views/front/products/landing.blade.php index 60bad3d..7d26456 100644 --- a/resources/views/front/products/landing.blade.php +++ b/resources/views/front/products/landing.blade.php @@ -10,11 +10,14 @@ use Illuminate\Support\Facades\Storage; @php $landingData = $product->landing_page_data ?? []; $hero = $landingData['hero'] ?? []; - $features = $landingData['features'] ?? []; - $howItWorks = $landingData['how_it_works'] ?? []; - $steps = $howItWorks['steps'] ?? []; - $video = $landingData['video'] ?? []; - $faqs = $landingData['faqs'] ?? []; + + // Fallback if hero data is empty + if (empty($hero['slogan']) && empty($hero['sub_slogan']) && empty($hero['featured_image'])) { + $hero['slogan'] = $product->translate('title'); + $hero['sub_slogan'] = Str::limit(strip_tags($product->translate('content')), 160); + $hero['featured_image'] = $product->hero_image; + } + $currentLang = app()->getLocale(); // Helper function to get translated value with fallback @@ -43,7 +46,7 @@ use Illuminate\Support\Facades\Storage; @endif
@if(!empty($hero['app_store_link'])) - + App Store @endif @@ -84,235 +87,6 @@ use Illuminate\Support\Facades\Storage; @endif - - {{-- App Features Section --}} - @if(!empty($features)) -
-
-
-
-

{{ t('Özellikler') }}

-

- {{ $product->translate('title') }} {{ t('deneyiminizi mükemmelleştirmek için buradayız.') }} -

-
- -
- -
-
-
- @foreach($features as $index => $feature) - @php - $featureTitle = $getTranslated($feature, 'title'); - @endphp -
- @if(!empty($feature['icon'])) -
- @php - $iconPath = public_path('assets/img/icons/solid/' . $feature['icon'] . '.svg'); - $iconUrl = file_exists($iconPath) - ? asset('assets/img/icons/solid/' . $feature['icon'] . '.svg') - : null; - @endphp - @if($iconUrl) - {{ $featureTitle }} - @else -
- {{ substr($feature['icon'], 0, 2) }} -
- @endif -
- @endif - @if($featureTitle) -

{{ $featureTitle }}

- @endif -
- - @endforeach -
- -
- -
- -
- -
- - @endif - - {{-- Description Section --}} - @php - $productContent = $product->translate('content'); - @endphp - @if(!empty($productContent)) - {!! $productContent !!} - @endif - - {{-- How It Works Section --}} - @if(!empty($howItWorks) && !empty($steps)) -
-
-
-
- @if($howItWorksLabel = $getTranslated($howItWorks, 'download_form_label')) -

- {{ $howItWorksLabel }} -

- @endif -
- -
- -
-
-
- @if(!empty($howItWorks['download_image'])) -
-
- How It Works -
-
- - @endif -
-
- @foreach($steps as $index => $step) - @if($index < 2) -
- {{ str_pad($step['number'] ?? ($index + 1), 2, '0', STR_PAD_LEFT) }} - @if($stepTitle = $getTranslated($step, 'title')) -

{{ $stepTitle }}

- @endif - @if($stepDescription = $getTranslated($step, 'description')) -

{{ $stepDescription }}

- @endif -
- - @endif - @endforeach -
- -
- @foreach($steps as $index => $step) - @if($index >= 2) -
- {{ str_pad($step['number'] ?? ($index + 1), 2, '0', STR_PAD_LEFT) }} - @if($stepTitle = $getTranslated($step, 'title')) -

{{ $stepTitle }}

- @endif - @if($stepDescription = $getTranslated($step, 'description')) -

{{ $stepDescription }}

- @endif -
- - @endif - @endforeach -
- -
- -
- -
- -
- -
- - @endif - - {{-- Video Section --}} - @if(!empty($video['youtube_video_id'])) -
-
-
-
-
-
- -
-
-
- -
- -
- -
- - @endif - - {{-- FAQ Section --}} - @if(!empty($faqs)) -
-
-
- - - - - -
-
-
-
-
-
- -

- {{ t('Sık Sorulan Sorular')}} -

-
-
-
-
- @foreach($faqs as $index => $faq) -
-
- -
- -
-
-

{!! nl2br(e($getTranslated($faq, 'answer'))) !!}

-
- -
- -
- - @endforeach -
- -
- -
- -
- -
- -
- -
- - @endif @endsection