Merge branches 'main' and 'main' of http://192.168.1.29:3500/perco/HouseHub
Deploy HouseHub / deploy (push) Successful in 1s

This commit is contained in:
Cedric
2026-05-12 11:37:35 +02:00
10 changed files with 117 additions and 28 deletions
+6 -6
View File
@@ -5,22 +5,22 @@
/* ─── HOME PAGE ─────────────────────────────────────────────────────────────── */ /* ─── HOME PAGE ─────────────────────────────────────────────────────────────── */
/* Le header home.css a plus de spécificité que global.css → on le force ici */ /* Le header home.css a plus de spécificité que global.css → on le force ici */
[data-theme="dark"] body.pf-home .pf-header { [data-theme="dark"] body[data-page="home"] .pf-header {
background: rgba(13,17,23,.92) !important; background: rgba(13,17,23,.92) !important;
border-color: rgba(48,54,61,.6) !important; border-color: rgba(48,54,61,.6) !important;
backdrop-filter: blur(8px) !important; backdrop-filter: blur(8px) !important;
} }
[data-theme="dark"] body.pf-home .pf-module-card { [data-theme="dark"] body[data-page="home"] .pf-module-card {
background: rgba(22,27,34,.92) !important; background: rgba(22,27,34,.92) !important;
border: 1px solid var(--border-light) !important; border: 1px solid var(--border-light) !important;
box-shadow: 0 4px 15px rgba(0,0,0,.4) !important; box-shadow: 0 4px 15px rgba(0,0,0,.4) !important;
} }
[data-theme="dark"] body.pf-home .pf-module-card:hover { [data-theme="dark"] body[data-page="home"] .pf-module-card:hover {
border-color: var(--primary) !important; border-color: var(--primary) !important;
} }
[data-theme="dark"] body.pf-home .pf-card-title { color: var(--text-main); } [data-theme="dark"] body[data-page="home"] .pf-card-title { color: var(--text-main); }
[data-theme="dark"] body.pf-home .pf-card-desc { color: var(--text-muted); } [data-theme="dark"] body[data-page="home"] .pf-card-desc { color: var(--text-muted); }
[data-theme="dark"] body.pf-home .pf-card-cta { color: var(--primary); } [data-theme="dark"] body[data-page="home"] .pf-card-cta { color: var(--primary); }
/* ─── SHARED / GLOBAL PATTERNS ──────────────────────────────────────────────── */ /* ─── SHARED / GLOBAL PATTERNS ──────────────────────────────────────────────── */
[data-theme="dark"] .pf-card { background: var(--bg-panel) !important; border-color: var(--border-light) !important; color: var(--text-main) !important; } [data-theme="dark"] .pf-card { background: var(--bg-panel) !important; border-color: var(--border-light) !important; color: var(--text-main) !important; }
+1 -1
View File
@@ -10,7 +10,7 @@ require_once __DIR__ . '/includes/i18n.php';
$pageTitle = tr('fc_page_title'); $pageTitle = tr('fc_page_title');
$activePage = "family-calendar"; $activePage = "family-calendar";
$bodyClass = "pf-family-calendar"; $mainClass = "pf-family-calendar";
$pageCss = "/modules/family-calendar/family-calendar.css"; $pageCss = "/modules/family-calendar/family-calendar.css";
require __DIR__ . '/header.php'; require __DIR__ . '/header.php';
+1 -1
View File
@@ -12,7 +12,7 @@ if (session_status() === PHP_SESSION_NONE) { session_start(); }
$year = (int)date('Y'); $year = (int)date('Y');
$pageTitle = tr('gift_page_title'); $pageTitle = tr('gift_page_title');
$activePage = "gift-list"; $activePage = "gift-list";
$bodyClass = "pf-gift-list"; $mainClass = "pf-gift-list";
$pageCss = "/modules/gift-list/gift-list.css"; $pageCss = "/modules/gift-list/gift-list.css";
$children = ['Pol', 'Pep', 'Elna', 'Bru', 'Guim']; $children = ['Pol', 'Pep', 'Elna', 'Bru', 'Guim'];
+2 -2
View File
@@ -39,7 +39,7 @@ $currentLang = $_SESSION['app_lang'] ?? 'fr';
} }
</style> </style>
</head> </head>
<body class="<?= htmlspecialchars($bodyClass ?? '') ?>"> <body data-page="<?= htmlspecialchars($activePage ?? '') ?>">
<header class="pf-header"> <header class="pf-header">
<a href="/index.php" class="pf-logo">HouseHub</a> <a href="/index.php" class="pf-logo">HouseHub</a>
@@ -107,7 +107,7 @@ $currentLang = $_SESSION['app_lang'] ?? 'fr';
</div> </div>
<?php endif; ?> <?php endif; ?>
<main class="pf-main"> <main class="pf-main<?= ($mainClass ?? '') ? ' '.htmlspecialchars($mainClass) : '' ?>">
<script> <script>
/** /**
+1 -1
View File
@@ -17,7 +17,7 @@ $pageTitle = ($tab === 'holiday_detail')
: tr('hdl_title_list'); : tr('hdl_title_list');
$activePage = "holidays"; $activePage = "holidays";
$bodyClass = "pf-holidays"; $mainClass = "pf-holidays";
$pageCss = "/modules/holidays/holidays.css"; $pageCss = "/modules/holidays/holidays.css";
require __DIR__ . '/header.php'; require __DIR__ . '/header.php';
+18
View File
@@ -0,0 +1,18 @@
<?php
require __DIR__ . '/includes/auth.php';
require_login();
$family_id = $_SESSION['user']['family_id'];
if (!$family_id) { http_response_code(404); exit; }
$file = null;
foreach (glob('/uploads/home_bg_' . $family_id . '.*') as $f) { $file = $f; break; }
if (!$file || !file_exists($file)) { http_response_code(404); exit; }
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
$mime = ['jpg'=>'image/jpeg','jpeg'=>'image/jpeg','png'=>'image/png','webp'=>'image/webp'][$ext] ?? 'image/jpeg';
header('Content-Type: ' . $mime);
header('Cache-Control: private, max-age=3600');
readfile($file);
+11 -2
View File
@@ -11,11 +11,20 @@ require_once __DIR__ . '/includes/i18n.php';
// Configuration de la page // Configuration de la page
$pageTitle = tr('home_title'); $pageTitle = tr('home_title');
$activePage = "home"; $activePage = "home";
$bodyClass = "pf-home"; // Important pour l'image de fond définie dans home.css // background géré par home.css via body[data-page="home"]
$pageCss = "/modules/home/home.css"; $pageCss = "/modules/home/home.css";
require __DIR__ . '/header.php'; require __DIR__ . '/header.php';
?>
// Override background si image personnalisée uploadée
$_fid = $_SESSION['user']['family_id'] ?? null;
$_has_custom_bg = false;
if ($_fid) {
foreach (glob('/uploads/home_bg_' . $_fid . '.*') as $_f) { $_has_custom_bg = true; break; }
}
if ($_has_custom_bg): ?>
<style>body[data-page="home"] { background-image: url('/home-bg.php?v=<?= filemtime($_f) ?>'); }</style>
<?php endif; ?>
<div class="pf-container"> <div class="pf-container">
+14 -14
View File
@@ -1,7 +1,7 @@
/* modules/home/home.css */ /* modules/home/home.css */
/* === 1. CONFIGURATION DU FOND & DU BODY === */ /* === 1. CONFIGURATION DU FOND & DU BODY === */
body.pf-home { body[data-page="home"] {
/* Image de fond desktop */ /* Image de fond desktop */
background-image: url("/modules/home/assets/img/background.jpg"); background-image: url("/modules/home/assets/img/background.jpg");
background-size: cover; background-size: cover;
@@ -14,7 +14,7 @@ body.pf-home {
} }
/* Voile sombre pour garantir la lisibilité du texte blanc */ /* Voile sombre pour garantir la lisibilité du texte blanc */
body.pf-home::before { body[data-page="home"]::before {
content: ""; content: "";
position: fixed; position: fixed;
inset: 0; inset: 0;
@@ -23,7 +23,7 @@ body.pf-home::before {
} }
/* === 2. HEADER SPÉCIFIQUE (Translucide) === */ /* === 2. HEADER SPÉCIFIQUE (Translucide) === */
body.pf-home .pf-header { body[data-page="home"] .pf-header {
background: rgba(36, 59, 83, 0.85); /* Ton ancien bleu sombre */ background: rgba(36, 59, 83, 0.85); /* Ton ancien bleu sombre */
backdrop-filter: blur(8px); /* Effet verre dépoli */ backdrop-filter: blur(8px); /* Effet verre dépoli */
border-bottom: 1px solid rgba(255, 255, 255, 0.1); border-bottom: 1px solid rgba(255, 255, 255, 0.1);
@@ -31,33 +31,33 @@ body.pf-home .pf-header {
} }
/* Adaptation des couleurs des liens du header sur fond sombre */ /* Adaptation des couleurs des liens du header sur fond sombre */
body.pf-home .pf-logo { body[data-page="home"] .pf-logo {
color: #ffffff; color: #ffffff;
} }
body.pf-home .pf-burger-btn { body[data-page="home"] .pf-burger-btn {
color: #ffffff; color: #ffffff;
} }
body.pf-home .pf-nav-link { body[data-page="home"] .pf-nav-link {
color: rgba(255, 255, 255, 0.8); color: rgba(255, 255, 255, 0.8);
} }
body.pf-home .pf-nav-link:hover { body[data-page="home"] .pf-nav-link:hover {
background: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.2);
color: #ffffff; color: #ffffff;
} }
body.pf-home .pf-nav-link--active { body[data-page="home"] .pf-nav-link--active {
background: rgba(255, 255, 255, 0.9); background: rgba(255, 255, 255, 0.9);
color: #243b53; /* Texte foncé sur fond blanc */ color: #243b53; /* Texte foncé sur fond blanc */
} }
/* Badge utilisateur */ /* Badge utilisateur */
body.pf-home .pf-user-badge { body[data-page="home"] .pf-user-badge {
color: rgba(255, 255, 255, 0.9); color: rgba(255, 255, 255, 0.9);
} }
body.pf-home .pf-logout-btn { body[data-page="home"] .pf-logout-btn {
color: #fca5a5; color: #fca5a5;
} /* Rouge clair */ } /* Rouge clair */
body.pf-home .pf-logout-btn:hover { body[data-page="home"] .pf-logout-btn:hover {
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
border-color: #fca5a5; border-color: #fca5a5;
} }
@@ -86,7 +86,7 @@ body.pf-home .pf-logout-btn:hover {
/* === 4. GRILLE DES MODULES === */ /* === 4. GRILLE DES MODULES === */
/* Titre de section "Modules" */ /* Titre de section "Modules" */
body.pf-home .pf-modules-grid { body[data-page="home"] .pf-modules-grid {
/* On ajoute un titre visuel ou on espace simplement */ /* On ajoute un titre visuel ou on espace simplement */
margin-top: 20px; margin-top: 20px;
} }
@@ -115,7 +115,7 @@ body.pf-home .pf-modules-grid {
/* === 5. MOBILE RESPONSIVE === */ /* === 5. MOBILE RESPONSIVE === */
@media (max-width: 768px) { @media (max-width: 768px) {
body.pf-home { body[data-page="home"] {
/* Image spécifique mobile */ /* Image spécifique mobile */
background-image: url("/modules/home/assets/img/background_m.jpg"); background-image: url("/modules/home/assets/img/background_m.jpg");
background-attachment: scroll; /* Fixed bug souvent sur mobile, scroll est mieux */ background-attachment: scroll; /* Fixed bug souvent sur mobile, scroll est mieux */
@@ -133,7 +133,7 @@ body.pf-home .pf-modules-grid {
} }
/* Ajustement header mobile */ /* Ajustement header mobile */
body.pf-home .pf-header { body[data-page="home"] .pf-header {
padding: 0 16px; padding: 0 16px;
} }
} }
+62
View File
@@ -86,6 +86,32 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
->execute([$new_code, $family_id]); ->execute([$new_code, $family_id]);
$success = "Nouveau code d'invitation généré."; $success = "Nouveau code d'invitation généré.";
} }
if ($action === 'upload_home_bg' && $family_id) {
$upload_dir = '/uploads/';
if (!is_dir($upload_dir)) @mkdir($upload_dir, 0755, true);
$file = $_FILES['home_bg'] ?? null;
if ($file && $file['error'] === 0) {
$ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
if (!in_array($ext, ['jpg','jpeg','png','webp'])) {
$error = "Format non supporté (jpg, png, webp).";
} else {
$dest = $upload_dir . 'home_bg_' . $family_id . '.' . $ext;
// Supprimer anciens fichiers de ce family
foreach (glob($upload_dir . 'home_bg_' . $family_id . '.*') as $old) @unlink($old);
if (move_uploaded_file($file['tmp_name'], $dest)) {
$success = "Image d'accueil mise à jour.";
} else {
$error = "Erreur lors de l'upload.";
}
}
}
}
if ($action === 'reset_home_bg' && $family_id) {
foreach (glob('/uploads/home_bg_' . $family_id . '.*') as $old) @unlink($old);
$success = "Image d'accueil réinitialisée.";
}
} }
// ─── Chargement données ─────────────────────────────────────────────────────── // ─── Chargement données ───────────────────────────────────────────────────────
@@ -181,6 +207,42 @@ require __DIR__ . '/header.php';
</section> </section>
<?php endif; ?> <?php endif; ?>
<!-- ── Fond page d'accueil ───────────────────────────────────────────── -->
<?php if ($family_id):
$bg_file = null;
foreach (glob('/uploads/home_bg_' . $family_id . '.*') as $f) { $bg_file = $f; break; }
$has_custom_bg = $bg_file !== null;
?>
<section style="background:white;border:1px solid #e2e8f0;border-radius:12px;padding:24px;margin-bottom:24px">
<h2 style="font-size:1rem;font-weight:700;margin-bottom:6px">🖼️ Image d'accueil</h2>
<p style="color:#64748b;font-size:0.85rem;margin-bottom:20px">Photo de fond affichée sur la page d'accueil (partagée avec tous les membres).</p>
<?php if ($has_custom_bg): ?>
<div style="margin-bottom:16px;border-radius:10px;overflow:hidden;max-height:160px;position:relative">
<img src="/home-bg.php" alt="Fond actuel" style="width:100%;height:160px;object-fit:cover">
<span style="position:absolute;top:8px;right:8px;background:rgba(0,0,0,.55);color:#fff;font-size:.75rem;padding:3px 8px;border-radius:6px">Image personnalisée</span>
</div>
<?php endif; ?>
<form method="post" enctype="multipart/form-data" style="display:flex;align-items:flex-end;gap:10px;flex-wrap:wrap">
<input type="hidden" name="action" value="upload_home_bg">
<div class="pf-form-group" style="flex:1;min-width:200px">
<label class="pf-label">Nouvelle image (jpg, png, webp — max 10 Mo)</label>
<input type="file" name="home_bg" class="pf-input" accept="image/jpeg,image/png,image/webp" required>
</div>
<button type="submit" class="pf-btn" style="flex-shrink:0">Enregistrer</button>
</form>
<?php if ($has_custom_bg): ?>
<form method="post" style="margin-top:10px">
<input type="hidden" name="action" value="reset_home_bg">
<button type="submit" class="pf-btn btn-secondary" style="font-size:.85rem"
onclick="return confirm('Revenir à l\'image par défaut ?')">🔄 Remettre l'image par défaut</button>
</form>
<?php endif; ?>
</section>
<?php endif; ?>
<!-- ── Profil ──────────────────────────────────────────────────────────── --> <!-- ── Profil ──────────────────────────────────────────────────────────── -->
<section style="background:white;border:1px solid #e2e8f0;border-radius:12px;padding:24px;margin-bottom:24px"> <section style="background:white;border:1px solid #e2e8f0;border-radius:12px;padding:24px;margin-bottom:24px">
<h2 style="font-size:1rem;font-weight:700;margin-bottom:20px">👤 Mon profil</h2> <h2 style="font-size:1rem;font-weight:700;margin-bottom:20px">👤 Mon profil</h2>