Files
2026-09-16 23:20:08 +07:00

34 lines
2.4 KiB
PHP

<?php
// components/layout_topbar.php
$current_page = basename($_SERVER['PHP_SELF']);
$is_settings_page = ($current_page === 'admin_settings.php');
$t = function($class_str) use ($is_settings_page) {
if ($is_settings_page) {
$class_str = str_replace('emerald', 'blue', $class_str);
$class_str = str_replace('teal', 'indigo', $class_str);
}
return $class_str;
};
?>
<header class="flex items-center justify-between px-4 lg:px-10 py-4 lg:py-5 bg-white/70 lg:bg-white/40 backdrop-blur-md border-b border-white/50 sticky top-0 z-20 shadow-sm lg:shadow-none">
<div class="flex items-center gap-2 lg:gap-4">
<button id="sidebar-toggle" class="lg:hidden p-2 text-slate-600 hover:bg-slate-100 rounded-lg transition-colors">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path></svg>
</button>
<span class="<?php echo $t('flex items-center gap-1 lg:gap-2 font-semibold text-emerald-800 bg-gradient-to-r from-emerald-50 to-teal-50 px-3 py-1.5 lg:px-4 lg:py-2 rounded-full shadow-sm text-xs lg:text-sm border border-emerald-200/60 backdrop-blur-sm transition-all hover:shadow-md'); ?>">
<svg class="<?php echo $t('w-4 h-4 text-emerald-600'); ?>" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
<span id="live-clock" class="tracking-wide">กำลังโหลดเวลา...</span>
</span>
</div>
<div class="flex items-center gap-3 lg:gap-4">
<div class="flex flex-col items-end hidden sm:flex">
<span class="font-bold text-slate-700 text-sm lg:text-base"><?php echo htmlspecialchars($name); ?></span>
<span class="text-xs text-slate-500 font-medium"><?php echo htmlspecialchars($position); ?> (IP: <?php echo htmlspecialchars($ip); ?>)</span>
</div>
<div class="<?php echo $t('w-10 h-10 lg:w-12 lg:h-12 rounded-full bg-emerald-100 flex items-center justify-center text-emerald-600 font-bold text-lg lg:text-xl shadow-[0_4px_10px_rgba(16,185,129,0.2)] border-2 border-white ring-2 ring-emerald-50/50 cursor-pointer hover:scale-105 transition-transform'); ?>">
<?php echo strtoupper(mb_substr($name, 0, 1, 'UTF-8')); ?>
</div>
</div>
</header>