From 2d981081f22f1dd0436abd8e147c614f405bef0c Mon Sep 17 00:00:00 2001 From: myrmidex Date: Thu, 10 Jul 2025 11:06:17 +0200 Subject: [PATCH] Show enable status on front page --- app/Http/Controllers/OnboardingController.php | 5 +- app/Services/SystemStatusService.php | 49 ++++++ resources/views/pages/dashboard.blade.php | 164 ++++++++++++++++++ 3 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 app/Services/SystemStatusService.php create mode 100644 resources/views/pages/dashboard.blade.php diff --git a/app/Http/Controllers/OnboardingController.php b/app/Http/Controllers/OnboardingController.php index 3c37e59..a0ff6a5 100644 --- a/app/Http/Controllers/OnboardingController.php +++ b/app/Http/Controllers/OnboardingController.php @@ -6,6 +6,7 @@ use App\Models\PlatformAccount; use App\Models\PlatformChannel; use App\Models\PlatformInstance; +use App\Services\SystemStatusService; use Illuminate\Http\Request; use Illuminate\View\View; use Illuminate\Http\RedirectResponse; @@ -16,7 +17,9 @@ public function index(): View|RedirectResponse { // Check if user needs onboarding if (!$this->needsOnboarding()) { - return redirect()->route('feeds.index'); + $systemStatus = resolve(SystemStatusService::class)->getSystemStatus(); + + return view('pages.dashboard', compact('systemStatus')); } return view('onboarding.welcome'); diff --git a/app/Services/SystemStatusService.php b/app/Services/SystemStatusService.php new file mode 100644 index 0000000..290183b --- /dev/null +++ b/app/Services/SystemStatusService.php @@ -0,0 +1,49 @@ +exists()) { + $isEnabled = false; + $reasons[] = 'No active feeds configured'; + } + + if (!PlatformChannel::where('is_active', true)->exists()) { + $isEnabled = false; + $reasons[] = 'No active platform channels configured'; + } + + if (!FeedPlatformChannel::where('is_active', true)->exists()) { + $isEnabled = false; + $reasons[] = 'No active feed-to-channel routes configured'; + } + + return [ + 'is_enabled' => $isEnabled, + 'status' => $isEnabled ? 'Enabled' : 'Disabled', + 'status_class' => $isEnabled ? 'text-green-600' : 'text-red-600', + 'reasons' => $reasons, + ]; + } + + public function canProcessArticles(): bool + { + return $this->getSystemStatus()['is_enabled']; + } +} \ No newline at end of file diff --git a/resources/views/pages/dashboard.blade.php b/resources/views/pages/dashboard.blade.php new file mode 100644 index 0000000..a598fae --- /dev/null +++ b/resources/views/pages/dashboard.blade.php @@ -0,0 +1,164 @@ +@extends('layouts.app') + +@section('content') +
+
+
+

Dashboard

+
+ +
+ +
+
+
+
+ @if($systemStatus['is_enabled']) +
+ +
+ @else +
+ +
+ @endif +
+
+
+
System Status
+
+ {{ $systemStatus['status'] }} +
+
+
+
+ + @if(!$systemStatus['is_enabled'] && count($systemStatus['reasons']) > 0) +
+

Reasons for being disabled:

+
    + @foreach($systemStatus['reasons'] as $reason) +
  • + + {{ $reason }} +
  • + @endforeach +
+
+ @endif + + @if(!$systemStatus['is_enabled']) + + @endif +
+
+ + +
+
+
+
+ +
+
+
+
Quick Stats
+
Coming Soon
+
+
+
+
+
+ + +
+
+
+
+ +
+
+
+
Recent Activity
+
+ View Logs +
+
+
+
+
+
+
+ + + +
+
+@endsection \ No newline at end of file