Show post authors and action buttons

This commit is contained in:
Micha
2026-01-11 01:54:45 +01:00
parent c8d2bd508e
commit bbbf8eb6c1
5 changed files with 62 additions and 7 deletions

View File

@@ -7,6 +7,7 @@
## 2026-01-11
- Restyled the thread view to mimic phpBB: compact toolbar, title row, and post layout.
- Added phpBB-style post action buttons and post author info for replies.
## 2025-12-30
- Added soft deletes with audit metadata (deleted_at/deleted_by) for forums, threads, and posts.

View File

@@ -11,7 +11,7 @@ class PostController extends Controller
{
public function index(Request $request): JsonResponse
{
$query = Post::query()->withoutTrashed();
$query = Post::query()->withoutTrashed()->with('user');
$threadParam = $request->query('thread');
if (is_string($threadParam)) {
@@ -45,6 +45,8 @@ class PostController extends Controller
'body' => $data['body'],
]);
$post->loadMissing('user');
return response()->json($this->serializePost($post), 201);
}
@@ -81,6 +83,7 @@ class PostController extends Controller
'body' => $post->body,
'thread' => "/api/threads/{$post->thread_id}",
'user_id' => $post->user_id,
'user_name' => $post->user?->name,
'created_at' => $post->created_at?->toIso8601String(),
'updated_at' => $post->updated_at?->toIso8601String(),
];

View File

@@ -4,7 +4,7 @@
use Illuminate\Foundation\Application;
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
define(constant_name: 'LARAVEL_START', value: microtime(as_float: true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
@@ -13,6 +13,6 @@ require __DIR__.'/vendor/autoload.php';
/** @var Application $app */
$app = require_once __DIR__.'/bootstrap/app.php';
$status = $app->handleCommand(new ArgvInput);
$status = $app->handleCommand(input: new ArgvInput);
exit($status);

View File

@@ -252,6 +252,38 @@ a {
margin-bottom: 0.75rem;
}
.bb-post-header-meta {
display: flex;
align-items: center;
gap: 0.6rem;
}
.bb-post-actions {
display: inline-flex;
align-items: center;
gap: 0.35rem;
}
.bb-post-action {
width: 44px;
height: 44px;
border-radius: 6px;
border: 1px solid #2a2f3a;
background: #20252f;
color: #c7cdd7;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 1.3rem;
transition: border-color 0.15s ease, color 0.15s ease;
}
.bb-post-action:hover {
color: var(--bb-accent, #f29b3f);
border-color: var(--bb-accent, #f29b3f);
}
.bb-post-body {
white-space: pre-wrap;
color: var(--bb-ink);

View File

@@ -125,10 +125,29 @@ export default function ThreadView() {
</aside>
<div className="bb-post-content">
<div className="bb-post-header">
<span>{t('thread.by')} {authorName}</span>
{post.created_at && (
<span>{post.created_at.slice(0, 10)}</span>
)}
<div className="bb-post-header-meta">
<span>{t('thread.by')} {authorName}</span>
{post.created_at && (
<span>{post.created_at.slice(0, 10)}</span>
)}
</div>
<div className="bb-post-actions">
<button type="button" className="bb-post-action" aria-label="Edit post">
<i className="bi bi-pencil" aria-hidden="true" />
</button>
<button type="button" className="bb-post-action" aria-label="Delete post">
<i className="bi bi-x-lg" aria-hidden="true" />
</button>
<button type="button" className="bb-post-action" aria-label="Report post">
<i className="bi bi-exclamation-lg" aria-hidden="true" />
</button>
<button type="button" className="bb-post-action" aria-label="Post info">
<i className="bi bi-info-lg" aria-hidden="true" />
</button>
<button type="button" className="bb-post-action" aria-label="Quote post">
<i className="bi bi-quote" aria-hidden="true" />
</button>
</div>
</div>
<div className="bb-post-body">{post.body}</div>
</div>