From 095477b846ee7a5a3f10bc7baa4da1c94dbce8ce Mon Sep 17 00:00:00 2001
From: Sofiane Lasri-Trienpont <alasri250@gmail.com>
Date: Sun, 23 Feb 2025 15:48:15 +0100
Subject: [PATCH] feat: add maintenance mode alert to admin home page

- Commented out the 'private_mode' configuration in app.php
- Added an alert in the admin home view to notify users when maintenance mode is active, guiding them to the settings page to disable it.
---
 config/app.php                       | 2 +-
 resources/views/admin/home.blade.php | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/config/app.php b/config/app.php
index 9ea28a0..5044bc0 100644
--- a/config/app.php
+++ b/config/app.php
@@ -127,7 +127,7 @@
 
     'protected_account_email' => env('PROTECTED_ACCOUNT_EMAIL', ''),
 
-    'private_mode' => env('APP_PRIVATE_MODE', false),
+    // 'private_mode' => env('APP_PRIVATE_MODE', false),
 
     'imagick' => [
         'max_width' => env('IMAGICK_MAX_WIDTH', 16000), // 16k
diff --git a/resources/views/admin/home.blade.php b/resources/views/admin/home.blade.php
index 65c1ae2..7ab23f5 100644
--- a/resources/views/admin/home.blade.php
+++ b/resources/views/admin/home.blade.php
@@ -2,6 +2,14 @@
 
 @section('content')
     <div class="container" id="admin-home">
+        @if(\App\Models\DbConfig::get('maintenance_mode', 'true'))
+            <x-bs.alert type="warning" :dismissible="false" icon="info" title="Information" style="max-width: none;">
+                Le site est masqué au public car le mode maintenance est activé.<br>
+                <a href="{{ route('admin.settings.update-website-config') }}" class="alert-link">
+                    Rendez-vous sur la page de configuration du site pour le désactiver.
+                </a>
+            </x-bs.alert>
+        @endif
         <h3 class="mb-4">Statistiques des Visites uniques</h3>
 
         <div class="grid mb-4">
-- 
GitLab