@extends('front.'.config('app.template', 'tendra').'.master') @section('body')
{{-- Back Link --}} {{-- Error Messages --}} @if(session('error') || isset($error))
{{ session('error') ?? $error ?? __('An error occurred') }}
@endif @if(isset($story) && $story)
{{-- Story Info --}}
{{-- Cover Image --}} @if(isset($story->cover_image) && $story->cover_image) {{ $story->title ?? __('Story Cover') }} @else
🎧
@endif

{{ $story->title ?? __('Untitled Story') }}

{{ (isset($story->category) && $story->category && isset($story->category->name)) ? $story->category->name : __('Uncategorized') }} @if(isset($story->duration) && $story->duration) • {{ $story->duration }} @endif @if(isset($story->created_at) && $story->created_at) • {{ $story->created_at->format('M d, Y') }} @endif
@if(isset($story->is_free) && $story->is_free) {{ __('Free') }} @elseif(isset($story->price)) {{ config('payments.currency_symbol', '$') }}{{ $story->price ?? '0.00' }} @endif
{{-- Rating Display --}} @if($averageRating)
@for($i = 1; $i <= 5; $i++) @endfor
{{ number_format($averageRating, 1) }} ({{ $totalRatings }} {{ __('ratings') }})
@endif
{!! nl2br(e($story->description)) !!}
{{-- Audio Player / Purchase Section --}} @if($userHasAccess) @if($story->audio_file)

{{ __('Listen to Story') }}

@endif @else
@if(!Auth::check())

{{ __('Sign in to access this story') }}

@elseif(!$story->is_free)

{{ __('Purchase this story to listen') }}

@endif
@endif {{-- User Rating (if has access) --}} @if(Auth::check() && $userHasAccess)

{{ __('Rate this Story') }}

@for($i = 1; $i <= 5; $i++) @endfor @if($userRating) {{ __('Your rating') }}: {{ $userRating->rating }}/5 @endif
@endif
{{-- Sidebar --}}
{{-- Comments Section --}} @if(Auth::check() && $userHasAccess)

{{ __('Add Comment') }}

@endif {{-- Existing Comments --}} @if($story->comments->count() > 0)

{{ __('Comments') }} ({{ $story->comments->count() }})

@foreach($story->comments as $comment)
{{ substr($comment->user->name, 0, 1) }}
{{ $comment->user->name }}
{{ $comment->created_at->diffForHumans() }}
{{ $comment->comment }}
@endforeach
@endif {{-- Related Stories --}} @if($relatedStories->count() > 0)

{{ __('Related Stories') }}

@foreach($relatedStories as $relatedStory)
@if($relatedStory->cover_image) {{ $relatedStory->title }} @else
🎧
@endif
{{ $relatedStory->title }}
@if($relatedStory->is_free) {{ __('Free') }} @else {{ config('payments.currency_symbol') }}{{ $relatedStory->price }} @endif
@endforeach
@endif
@else {{-- Fallback when story is not available --}}
😞

{{ __('Story Not Available') }}

{{ __('The story you are looking for is not available or has been removed.') }}

{{ __('Browse All Stories') }}
@endif
@endsection