This commit is contained in:
2026-03-20 21:17:26 +01:00
parent 1a62fcb81d
commit 29c3ff8572
229 changed files with 13147 additions and 2577 deletions

View File

@@ -1,17 +1,21 @@
@extends('layouts.nova.content-layout')
@php
$hero_title = $story->title;
$hero_description = $story->excerpt ?: \Illuminate\Support\Str::limit(strip_tags((string) $story->content), 160);
$storySummary = $story->excerpt ?: \Illuminate\Support\Str::limit(trim(strip_tags($safeContent)), 160);
@endphp
@push('head')
@php
$storyUrl = $story->canonical_url ?: route('stories.show', ['slug' => $story->slug]);
$creatorName = $story->creator?->display_name ?: $story->creator?->username ?: 'Unknown creator';
$metaDescription = $story->meta_description ?: $hero_description;
$metaDescription = $story->meta_description ?: $storySummary;
$metaTitle = $story->meta_title ?: $story->title;
$ogImage = $story->og_image ?: $story->cover_url;
$creatorFollowProps = $story->creator ? [
'username' => $story->creator->username,
'following' => (bool) ($storySocialProps['state']['is_following_creator'] ?? false),
'followers_count' => (int) ($storySocialProps['creator']['followers_count'] ?? 0),
] : null;
@endphp
<meta property="og:type" content="article" />
<meta property="og:title" content="{{ $metaTitle }}" />
@@ -44,6 +48,10 @@
</script>
@endpush
@section('page-hero')
<div class="hidden" aria-hidden="true"></div>
@endsection
@section('page-content')
<div class="mx-auto grid max-w-7xl gap-8 lg:grid-cols-12">
<article class="lg:col-span-8">
@@ -65,41 +73,13 @@
<p class="mt-3 text-gray-300">{{ $story->excerpt }}</p>
@endif
<div class="mt-6 prose prose-invert max-w-none prose-a:text-sky-300 prose-pre:bg-gray-900">
<div class="story-prose mt-6 prose prose-invert max-w-none prose-a:text-sky-300 prose-pre:overflow-x-auto prose-pre:rounded-2xl prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-950 prose-pre:px-8 prose-pre:py-6 prose-pre:text-slate-100 prose-pre:shadow-[0_24px_70px_rgba(2,6,23,0.45)] prose-pre:ring-1 prose-pre:ring-sky-500/10 prose-pre:font-mono prose-pre:text-[0.95rem] prose-pre:leading-8 prose-code:text-amber-200 prose-code:bg-white/[0.08] prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded-md prose-code:before:content-none prose-code:after:content-none prose-blockquote:border-l-4 prose-blockquote:border-sky-400/55 prose-blockquote:bg-sky-400/[0.06] prose-blockquote:px-5 prose-blockquote:py-3 prose-blockquote:rounded-r-xl prose-blockquote:text-white/82 prose-blockquote:italic prose-pre:prose-code:bg-transparent prose-pre:prose-code:p-0 prose-pre:prose-code:text-slate-100 prose-pre:prose-code:rounded-none [&_ul]:list-disc [&_ul]:pl-6 [&_ul]:space-y-2 [&_ol]:list-decimal [&_ol]:pl-6 [&_ol]:space-y-2 [&_li]:text-white/85">
{!! $safeContent !!}
</div>
</div>
</div>
<section class="mt-8 rounded-xl border border-gray-700 bg-gray-800/60 p-6">
<h2 class="mb-5 text-xl font-semibold tracking-tight text-white">Discussion</h2>
@if($comments->isEmpty())
<p class="text-sm text-gray-400">No comments yet.</p>
@else
<div class="space-y-4">
@foreach($comments as $comment)
<div class="rounded-lg border border-gray-700 bg-gray-900/60 p-4">
<div class="mb-2 text-xs text-gray-400">
{{ $comment->author_username ?? 'User' }}
<span class="mx-1"></span>
{{ optional($comment->created_at)->diffForHumans() }}
</div>
<p class="text-sm leading-relaxed text-gray-200">{{ $comment->body }}</p>
</div>
@endforeach
</div>
@endif
@auth
@if($story->creator)
<form method="POST" action="{{ url('/@' . $story->creator->username . '/comment') }}" class="mt-5 space-y-3">
@csrf
<textarea name="body" rows="3" class="w-full rounded-lg border border-gray-700 bg-gray-900 px-3 py-2 text-sm text-white" placeholder="Add a comment for this creator"></textarea>
<button class="rounded-lg border border-sky-500/40 bg-sky-500/10 px-4 py-2 text-sm text-sky-200 transition hover:scale-[1.01]">Post comment</button>
</form>
@endif
@endauth
</section>
<section class="mt-8" id="story-social-root" data-props='@json($storySocialProps)'></section>
</article>
<aside class="space-y-8 lg:col-span-4">
@@ -109,10 +89,7 @@
<span>{{ $story->creator?->display_name ?: $story->creator?->username }}</span>
</a>
@if($story->creator)
<form method="POST" action="{{ url('/@' . $story->creator->username . '/follow') }}" class="mt-4">
@csrf
<button class="w-full rounded-lg border border-sky-500/40 bg-sky-500/10 px-3 py-2 text-sm text-sky-200 transition hover:scale-[1.01]">Follow Creator</button>
</form>
<div class="mt-4" id="story-creator-follow-root" data-props='@json($creatorFollowProps)'></div>
@endif
</div>