Implement nice admin panel

This commit is contained in:
myrmidex 2025-07-05 01:17:24 +02:00
parent 62c0938018
commit 085fa85fcd
4 changed files with 127 additions and 50 deletions

View file

@ -1,10 +1,30 @@
<html> <!DOCTYPE html>
<html lang="en">
<head> <head>
<title>Lemmy Poster</title> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@yield('title', 'Lemmy Poster Admin')</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
</head> </head>
<body> <body class="bg-gray-100">
@include('partials.navbar') <div class="flex h-screen">
@include('partials.sidebar')
<!-- Main Content -->
<div class="flex-1 flex flex-col overflow-hidden">
<!-- Header -->
<header class="bg-white shadow-sm border-b border-gray-200">
<div class="px-6 py-4">
<h1 class="text-2xl font-semibold text-gray-800">@yield('page-title', 'Dashboard')</h1>
</div>
</header>
<!-- Content -->
<main class="flex-1 overflow-y-auto p-6">
@yield('content') @yield('content')
</main>
</div>
</div>
</body> </body>
</html> </html>

View file

@ -1,28 +1,49 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('page-title', 'Articles')
<h1>Articles</h1>
<table> @section('content')
<thead> <div class="bg-white rounded-lg shadow">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-lg font-medium text-gray-900">Article Feed</h2>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr> <tr>
<th>ID</th> <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
<th>URL</th> <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">URL</th>
<th>Created At</th> <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Created At</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody class="bg-white divide-y divide-gray-200">
@foreach($articles as $article) @foreach($articles as $article)
<tr> <tr class="hover:bg-gray-50">
<td>{{ $article->id }}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $article->id }}</td>
<td>{{ $article->url }}</td> <td class="px-6 py-4 text-sm text-gray-900">
<td>{{ $article->created_at->format('Y-m-d H:i') }}</td> <a href="{{ $article->url }}" target="_blank" class="text-blue-600 hover:text-blue-900 hover:underline">
{{ Str::limit($article->url, 60) }}
</a>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full
{{ $article->articlePublication ? 'bg-green-100 text-green-800' : 'bg-yellow-100 text-yellow-800' }}">
{{ $article->articlePublication ? 'Published' : 'Pending' }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $article->created_at->format('Y-m-d H:i') }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div>
<div class="pagination-wrapper"> @if($articles->hasPages())
<div class="px-6 py-4 border-t border-gray-200">
{{ $articles->links() }} {{ $articles->links() }}
</div> </div>
@endif
</div>
@endsection @endsection

View file

@ -1,26 +1,40 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('page-title', 'System Logs')
<h1>Logs</h1>
<table> @section('content')
<thead> <div class="bg-white rounded-lg shadow">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-lg font-medium text-gray-900">Recent Logs</h2>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr> <tr>
<th>ID</th> <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
<th>Level</th> <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Level</th>
<th>Message</th> <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Message</th>
<th>Created At</th> <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Created At</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody class="bg-white divide-y divide-gray-200">
@foreach($logs as $log) @foreach($logs as $log)
<tr> <tr class="hover:bg-gray-50">
<td>{{ $log->id }}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $log->id }}</td>
<td>{{ ucfirst($log->level->value) }}</td> <td class="px-6 py-4 whitespace-nowrap">
<td>{{ $log->message }}</td> <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full
<td>{{ $log->created_at->format('Y-m-d H:i') }}</td> {{ $log->level->value === 'error' ? 'bg-red-100 text-red-800' :
($log->level->value === 'warning' ? 'bg-yellow-100 text-yellow-800' : 'bg-green-100 text-green-800') }}">
{{ ucfirst($log->level->value) }}
</span>
</td>
<td class="px-6 py-4 text-sm text-gray-900">{{ Str::limit($log->message, 100) }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $log->created_at->format('Y-m-d H:i') }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div>
</div>
@endsection @endsection

View file

@ -0,0 +1,22 @@
<!-- Sidebar -->
<div class="bg-gray-800 text-white w-64 flex-shrink-0">
<div class="p-4">
<h2 class="text-xl font-bold">Lemmy Poster</h2>
<p class="text-gray-400 text-sm">Admin Panel</p>
</div>
<nav class="mt-8">
<a href="/articles" class="flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white transition-colors {{ request()->is('articles') ? 'bg-gray-700 text-white' : '' }}">
<i class="fas fa-newspaper mr-3"></i>
Articles
</a>
<a href="/logs" class="flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white transition-colors {{ request()->is('logs') ? 'bg-gray-700 text-white' : '' }}">
<i class="fas fa-list mr-3"></i>
Logs
</a>
<a href="/horizon" class="flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white transition-colors">
<i class="fas fa-chart-line mr-3"></i>
Queue Monitor
</a>
</nav>
</div>