初始化
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', $thread->title . ' - 论坛')
|
||||
|
||||
@section('content')
|
||||
<section class="px-4 py-12 sm:px-6 lg:px-8 lg:py-16">
|
||||
<div class="mx-auto max-w-3xl">
|
||||
<nav class="mb-6 flex items-center gap-1.5 text-sm text-muted">
|
||||
<a href="{{ route('forum.index') }}" class="hover:text-primary">论坛</a>
|
||||
<span>/</span>
|
||||
<a href="{{ route('forum.board', $thread->board->slug) }}" class="hover:text-primary">{{ $thread->board->name }}</a>
|
||||
<span>/</span>
|
||||
<span class="text-fg">{{ $thread->title }}</span>
|
||||
</nav>
|
||||
|
||||
<article class="rounded-lg border border-line bg-surface p-6 shadow-soft sm:p-8">
|
||||
<h1 class="text-2xl font-bold tracking-tight text-fg sm:text-3xl">{{ $thread->title }}</h1>
|
||||
<p class="mt-3 text-xs text-muted">{{ $thread->user?->name }} · {{ $thread->created_at->format('Y-m-d H:i') }} · {{ $thread->views }} 浏览 <x-level-badge :user="$thread->user" /></p>
|
||||
<div class="prose mt-5 text-fg">
|
||||
{!! nl2br(e($thread->body)) !!}
|
||||
</div>
|
||||
@if ($thread->is_locked)
|
||||
<p class="mt-4 flex items-center gap-2 rounded-lg border border-danger bg-danger-soft px-4 py-3 text-sm text-danger">
|
||||
<x-icon name="lock" :size="16" /> 该帖子已锁定,无法回复。
|
||||
</p>
|
||||
@endif
|
||||
</article>
|
||||
|
||||
<h2 class="mb-4 mt-10 text-lg font-semibold text-fg">回复({{ $replies->total() }})</h2>
|
||||
<div class="space-y-4">
|
||||
@forelse ($replies as $reply)
|
||||
<div class="rounded-lg border border-line bg-surface p-5 shadow-soft">
|
||||
<div class="text-xs text-muted">{{ $reply->user?->name }} · {{ $reply->created_at->format('Y-m-d H:i') }} <x-level-badge :user="$reply->user" /></div>
|
||||
<div class="prose mt-2 text-fg">
|
||||
{!! nl2br(e($reply->body)) !!}
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<p class="text-sm text-muted">还没有回复。</p>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<div class="mt-8">
|
||||
{{ $replies->links('pagination::bootstrap-5') }}
|
||||
</div>
|
||||
|
||||
@auth
|
||||
@unless ($thread->is_locked)
|
||||
<div class="mt-8 rounded-lg border border-line bg-surface p-6 shadow-soft sm:p-8">
|
||||
<h3 class="text-lg font-semibold text-fg">发表回复</h3>
|
||||
<form method="POST" action="{{ route('forum.replies.store', $thread) }}" class="mt-5 space-y-5">
|
||||
@csrf
|
||||
<div>
|
||||
<label for="reply-body" class="mb-1.5 block text-sm font-medium text-fg">内容</label>
|
||||
<textarea id="reply-body" name="body" required class="w-full rounded-lg border border-line bg-surface px-3 py-2.5 text-sm text-fg placeholder:text-muted focus:border-primary focus:outline-none focus:shadow-[0_0_0_3px_var(--color-primary-soft)]"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="inline-flex items-center justify-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-semibold text-white transition hover:bg-primary-hover">
|
||||
<x-icon name="send" :size="18" /> 回复
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@endunless
|
||||
@else
|
||||
<p class="mt-8 text-sm text-muted"><a href="{{ route('login') }}" class="font-medium text-primary hover:text-primary-hover">登录</a> 后参与回复。</p>
|
||||
@endauth
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user