初始化
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', $board->name . ' - 论坛')
|
||||
|
||||
@section('content')
|
||||
<section class="px-4 py-12 sm:px-6 lg:px-8 lg:py-16">
|
||||
<div class="mx-auto max-w-5xl">
|
||||
<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>
|
||||
<span class="text-fg">{{ $board->name }}</span>
|
||||
</nav>
|
||||
|
||||
<div class="mb-6 flex flex-wrap items-center justify-between gap-3">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold tracking-tight text-fg sm:text-3xl">{{ $board->name }}</h1>
|
||||
<p class="mt-2 text-sm text-muted">{{ $board->description }}</p>
|
||||
</div>
|
||||
@auth
|
||||
<a href="#new-thread" class="inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-white transition hover:bg-primary-hover">
|
||||
<x-icon name="plus" :size="16" /> 发起帖子
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ route('login') }}" class="inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-white transition hover:bg-primary-hover">
|
||||
登录后发帖
|
||||
</a>
|
||||
@endauth
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
@forelse ($threads as $thread)
|
||||
<a href="{{ route('forum.thread', $thread) }}" class="group flex items-center justify-between gap-4 rounded-lg border border-line bg-surface p-5 shadow-soft transition hover:border-primary hover:shadow-card">
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold text-fg transition group-hover:text-primary">
|
||||
@if ($thread->is_pinned)<x-icon name="pin" :size="14" class="text-warning" /> @endif
|
||||
{{ $thread->title }}
|
||||
</h3>
|
||||
<p class="mt-1 text-xs text-muted">{{ $thread->user->name }} · {{ $thread->created_at->format('Y-m-d') }} · {{ $thread->views }} 浏览</p>
|
||||
</div>
|
||||
<span class="shrink-0 text-muted transition group-hover:text-primary">
|
||||
<x-icon name="arrow" :size="20" />
|
||||
</span>
|
||||
</a>
|
||||
@empty
|
||||
<p class="text-sm text-muted">该版块还没有帖子。</p>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<div class="mt-8">
|
||||
{{ $threads->links('pagination::bootstrap-5') }}
|
||||
</div>
|
||||
|
||||
@auth
|
||||
<div id="new-thread" class="mt-8 rounded-lg border border-line bg-surface p-6 shadow-soft sm:p-8">
|
||||
<h2 class="text-lg font-semibold text-fg">发起新帖</h2>
|
||||
<form method="POST" action="{{ route('forum.threads.store') }}" class="mt-5 space-y-5">
|
||||
@csrf
|
||||
<input type="hidden" name="board_id" value="{{ $board->id }}">
|
||||
<div>
|
||||
<label for="title" class="mb-1.5 block text-sm font-medium text-fg">标题</label>
|
||||
<input id="title" type="text" name="title" maxlength="120" 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)]">
|
||||
</div>
|
||||
<div>
|
||||
<label for="body" class="mb-1.5 block text-sm font-medium text-fg">内容</label>
|
||||
<textarea id="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>
|
||||
@endauth
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
@@ -0,0 +1,44 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', '技术论坛 - 深圳市云创芯电子有限公司')
|
||||
|
||||
@section('content')
|
||||
<section class="px-4 py-12 sm:px-6 lg:px-8 lg:py-16">
|
||||
<div class="max-w-8xl mx-auto">
|
||||
<div class="mb-8">
|
||||
<h1 class="text-2xl font-bold tracking-tight text-fg sm:text-3xl">技术论坛</h1>
|
||||
<p class="mt-2 text-sm text-muted">与工程师交流选型、调试与量产经验。</p>
|
||||
</div>
|
||||
|
||||
@guest
|
||||
<div class="mb-8 flex flex-col gap-4 rounded-lg border border-line bg-surface p-5 shadow-soft sm:flex-row sm:items-center sm:justify-between">
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="inline-flex h-11 w-11 items-center justify-center rounded-lg bg-primary-soft text-primary">
|
||||
<x-icon name="chat" :size="24" />
|
||||
</span>
|
||||
<p class="text-lg text-fg">登录后即可参与版块讨论、发帖与回复。</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<a href="{{ url('/login') }}" class="inline-flex items-center justify-center rounded-lg border border-line px-6 py-2.5 text-lg font-semibold text-fg transition hover:border-primary hover:text-primary">登录</a>
|
||||
<a href="{{ url('/register') }}" class="inline-flex items-center justify-center rounded-lg bg-primary px-6 py-2.5 text-lg font-semibold text-white transition hover:bg-primary-hover">注册</a>
|
||||
</div>
|
||||
</div>
|
||||
@endguest
|
||||
|
||||
<div class="mt-8 grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
||||
@forelse ($boards as $board)
|
||||
<a href="{{ route('forum.board', $board->slug) }}" class="group flex flex-col rounded-lg border border-line bg-surface p-6 shadow-soft transition hover:-translate-y-0.5 hover:border-primary hover:shadow-card">
|
||||
<span class="inline-flex h-10 w-10 items-center justify-center rounded-lg bg-primary-soft text-primary">
|
||||
<x-icon name="chat" :size="22" />
|
||||
</span>
|
||||
<h3 class="mt-4 text-lg font-semibold text-fg transition group-hover:text-primary">{{ $board->name }}</h3>
|
||||
<p class="mt-2 line-clamp-2 text-sm text-muted">{{ $board->description }}</p>
|
||||
<p class="mt-4 text-xs text-muted">{{ $board->threads_count }} 个帖子</p>
|
||||
</a>
|
||||
@empty
|
||||
<p class="text-sm text-muted">版块即将开放,敬请期待。</p>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
@@ -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