feat: complete UI redesign with dark mode, sidebar navigation, and modern design system
Implemented comprehensive UI overhaul with three-layer architecture: Layer 1 - Theme System: - CSS variables for light/dark themes (theme.css) - Theme composable with light/dark/auto mode (useTheme.ts) - Sidebar state management composable (useSidebar.ts) - Refactored main.css to use CSS variables throughout Layer 2 - Core Components: - AppSidebar with collapsible navigation (desktop) and overlay (mobile) - CollapsibleSection reusable component for expandable cards - Restructured App.vue with new sidebar layout - Integrated Lucide icons library (lucide-vue-next) Layer 3 - Views & Components: - Updated all 14 views with CSS variables and responsive design - Replaced inline SVG with Lucide icon components - Added collapsible sections to Dashboard, Admin pages, UserProfile - Updated 3 shared components (BookingForm, SpaceCalendar, AttachmentsList) Features: - Dark/light/auto theme with persistent preference - Collapsible sidebar (icons-only on desktop, overlay on mobile) - Consistent color palette using CSS variables - Full responsive design across all pages - Modern minimalist aesthetic with Indigo accent color Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,34 +1,29 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<header v-if="authStore.isAuthenticated" class="header">
|
||||
<div class="container">
|
||||
<h1>Space Booking</h1>
|
||||
<nav>
|
||||
<router-link to="/dashboard">Dashboard</router-link>
|
||||
<router-link to="/spaces">Spaces</router-link>
|
||||
<router-link to="/my-bookings">My Bookings</router-link>
|
||||
<router-link v-if="authStore.isAdmin" to="/admin">Spaces Admin</router-link>
|
||||
<router-link v-if="authStore.isAdmin" to="/users">Users Admin</router-link>
|
||||
<router-link v-if="authStore.isAdmin" to="/admin/pending">Pending Requests</router-link>
|
||||
<router-link v-if="authStore.isAdmin" to="/admin/settings">Settings</router-link>
|
||||
<router-link v-if="authStore.isAdmin" to="/admin/reports">Reports</router-link>
|
||||
<router-link v-if="authStore.isAdmin" to="/admin/audit-log">Audit Log</router-link>
|
||||
<AppSidebar v-if="authStore.isAuthenticated" />
|
||||
|
||||
<div class="app-main" :class="{ 'with-sidebar': authStore.isAuthenticated, 'sidebar-collapsed': collapsed }">
|
||||
<!-- Mobile header bar -->
|
||||
<div v-if="authStore.isAuthenticated" class="mobile-header">
|
||||
<button class="mobile-hamburger" @click="toggleMobile" aria-label="Open menu">
|
||||
<Menu :size="22" />
|
||||
</button>
|
||||
<span class="mobile-title">Space Booking</span>
|
||||
<div class="mobile-actions">
|
||||
<!-- Notification Bell -->
|
||||
<div class="notification-wrapper">
|
||||
<button @click="toggleNotifications" class="notification-bell" aria-label="Notifications">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path>
|
||||
<path d="M13.73 21a2 2 0 0 1-3.46 0"></path>
|
||||
</svg>
|
||||
<span v-if="unreadCount > 0" class="badge">{{ unreadCount }}</span>
|
||||
<Bell :size="20" />
|
||||
<span v-if="unreadCount > 0" class="notification-badge">{{ unreadCount }}</span>
|
||||
</button>
|
||||
|
||||
<!-- Notification Dropdown -->
|
||||
<div v-if="showNotifications" class="notification-dropdown" ref="dropdownRef">
|
||||
<div class="notification-header">
|
||||
<h3>Notifications</h3>
|
||||
<button @click="closeNotifications" class="close-btn">×</button>
|
||||
<button @click="closeNotifications" class="close-btn">
|
||||
<X :size="18" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="notification-loading">Loading...</div>
|
||||
@@ -51,14 +46,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button @click="logout" class="btn-logout">Logout ({{ authStore.user?.email }})</button>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<main class="main">
|
||||
<router-view />
|
||||
</main>
|
||||
|
||||
<main class="content">
|
||||
<router-view />
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -67,10 +61,14 @@ import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { notificationsApi } from '@/services/api'
|
||||
import { useSidebar } from '@/composables/useSidebar'
|
||||
import type { Notification } from '@/types'
|
||||
import AppSidebar from '@/components/AppSidebar.vue'
|
||||
import { Menu, Bell, X } from 'lucide-vue-next'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const router = useRouter()
|
||||
const { collapsed, toggleMobile } = useSidebar()
|
||||
|
||||
const notifications = ref<Notification[]>([])
|
||||
const showNotifications = ref(false)
|
||||
@@ -83,17 +81,11 @@ const unreadCount = computed(() => {
|
||||
return notifications.value.filter((n) => !n.is_read).length
|
||||
})
|
||||
|
||||
const logout = () => {
|
||||
authStore.logout()
|
||||
router.push('/login')
|
||||
}
|
||||
|
||||
const fetchNotifications = async () => {
|
||||
if (!authStore.isAuthenticated) return
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
// Get all notifications, sorted by created_at DESC (from API)
|
||||
notifications.value = await notificationsApi.getAll()
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch notifications:', error)
|
||||
@@ -114,18 +106,15 @@ const closeNotifications = () => {
|
||||
}
|
||||
|
||||
const handleNotificationClick = async (notification: Notification) => {
|
||||
// Mark as read
|
||||
if (!notification.is_read) {
|
||||
try {
|
||||
await notificationsApi.markAsRead(notification.id)
|
||||
// Update local state
|
||||
notification.is_read = true
|
||||
} catch (error) {
|
||||
console.error('Failed to mark notification as read:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// Navigate to booking if available
|
||||
if (notification.booking_id) {
|
||||
closeNotifications()
|
||||
router.push('/my-bookings')
|
||||
@@ -147,25 +136,20 @@ const formatTime = (dateStr: string): string => {
|
||||
return date.toLocaleDateString()
|
||||
}
|
||||
|
||||
// Click outside to close
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
const target = event.target as HTMLElement
|
||||
if (
|
||||
dropdownRef.value &&
|
||||
!dropdownRef.value.contains(event.target as Node) &&
|
||||
!(event.target as HTMLElement).closest('.notification-bell')
|
||||
!dropdownRef.value.contains(target) &&
|
||||
!target.closest('.notification-bell')
|
||||
) {
|
||||
closeNotifications()
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// Initial fetch
|
||||
fetchNotifications()
|
||||
|
||||
// Auto-refresh every 30 seconds
|
||||
refreshInterval = window.setInterval(fetchNotifications, 30000)
|
||||
|
||||
// Add click outside listener
|
||||
document.addEventListener('click', handleClickOutside)
|
||||
})
|
||||
|
||||
@@ -178,64 +162,68 @@ onUnmounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.header {
|
||||
background: #2c3e50;
|
||||
color: white;
|
||||
padding: 1rem 0;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
/* Layout */
|
||||
.app-main {
|
||||
min-height: 100vh;
|
||||
transition: margin-left var(--transition-normal);
|
||||
}
|
||||
|
||||
.container {
|
||||
.app-main.with-sidebar {
|
||||
margin-left: var(--sidebar-width);
|
||||
}
|
||||
|
||||
.app-main.with-sidebar.sidebar-collapsed {
|
||||
margin-left: var(--sidebar-collapsed-width);
|
||||
}
|
||||
|
||||
.content {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 1rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 2rem 1.5rem;
|
||||
}
|
||||
|
||||
/* Mobile header */
|
||||
.mobile-header {
|
||||
display: none;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 50;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.75rem 1rem;
|
||||
background: var(--color-surface);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
nav {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
nav a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 4px;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
nav a:hover,
|
||||
nav a.router-link-active {
|
||||
background: rgba(255,255,255,0.1);
|
||||
}
|
||||
|
||||
.btn-logout {
|
||||
background: #e74c3c;
|
||||
color: white;
|
||||
.mobile-hamburger {
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 4px;
|
||||
color: var(--color-text-primary);
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
padding: 0.4rem;
|
||||
border-radius: var(--radius-sm);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background var(--transition-fast);
|
||||
}
|
||||
|
||||
.btn-logout:hover {
|
||||
background: #c0392b;
|
||||
.mobile-hamburger:hover {
|
||||
background: var(--color-bg-secondary);
|
||||
}
|
||||
|
||||
.main {
|
||||
max-width: 1200px;
|
||||
margin: 2rem auto;
|
||||
padding: 0 1rem;
|
||||
.mobile-title {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
color: var(--color-text-primary);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.mobile-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
/* Notifications */
|
||||
@@ -246,44 +234,47 @@ nav a.router-link-active {
|
||||
.notification-bell {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: white;
|
||||
color: var(--color-text-secondary);
|
||||
cursor: pointer;
|
||||
padding: 0.5rem;
|
||||
border-radius: 4px;
|
||||
padding: 0.4rem;
|
||||
border-radius: var(--radius-sm);
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background 0.2s;
|
||||
transition: all var(--transition-fast);
|
||||
}
|
||||
|
||||
.notification-bell:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
background: var(--color-bg-secondary);
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.notification-bell .badge {
|
||||
.notification-badge {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
background: #e74c3c;
|
||||
top: 0;
|
||||
right: 0;
|
||||
background: var(--color-danger);
|
||||
color: white;
|
||||
border-radius: 10px;
|
||||
padding: 2px 6px;
|
||||
font-size: 0.7rem;
|
||||
padding: 1px 5px;
|
||||
font-size: 0.65rem;
|
||||
font-weight: bold;
|
||||
min-width: 18px;
|
||||
min-width: 16px;
|
||||
text-align: center;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.notification-dropdown {
|
||||
position: absolute;
|
||||
top: calc(100% + 10px);
|
||||
top: calc(100% + 8px);
|
||||
right: 0;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
background: var(--color-surface);
|
||||
border-radius: var(--radius-lg);
|
||||
box-shadow: var(--shadow-lg);
|
||||
border: 1px solid var(--color-border);
|
||||
width: 360px;
|
||||
max-height: 400px;
|
||||
max-height: 420px;
|
||||
overflow: hidden;
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
@@ -294,42 +285,39 @@ nav a.router-link-active {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 1rem;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
background: #f8f9fa;
|
||||
padding: 1rem 1.25rem;
|
||||
border-bottom: 1px solid var(--color-border-light);
|
||||
}
|
||||
|
||||
.notification-header h3 {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
color: #2c3e50;
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.5rem;
|
||||
color: #7f8c8d;
|
||||
color: var(--color-text-muted);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
padding: 0.25rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--radius-sm);
|
||||
transition: all var(--transition-fast);
|
||||
}
|
||||
|
||||
.close-btn:hover {
|
||||
background: #e0e0e0;
|
||||
color: #2c3e50;
|
||||
background: var(--color-bg-secondary);
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.notification-loading,
|
||||
.notification-empty {
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
color: #7f8c8d;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.notification-list {
|
||||
@@ -338,28 +326,32 @@ nav a.router-link-active {
|
||||
}
|
||||
|
||||
.notification-item {
|
||||
padding: 1rem;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
padding: 1rem 1.25rem;
|
||||
border-bottom: 1px solid var(--color-border-light);
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
transition: background var(--transition-fast);
|
||||
}
|
||||
|
||||
.notification-item:hover {
|
||||
background: #f8f9fa;
|
||||
background: var(--color-surface-hover);
|
||||
}
|
||||
|
||||
.notification-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.notification-item.unread {
|
||||
background: #e8f4fd;
|
||||
border-left: 3px solid #3498db;
|
||||
background: var(--color-accent-light);
|
||||
border-left: 3px solid var(--color-accent);
|
||||
}
|
||||
|
||||
.notification-item.unread:hover {
|
||||
background: #d6ebfa;
|
||||
background: var(--color-surface-hover);
|
||||
}
|
||||
|
||||
.notification-title {
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
color: var(--color-text-primary);
|
||||
margin-bottom: 0.25rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
@@ -369,21 +361,41 @@ nav a.router-link-active {
|
||||
}
|
||||
|
||||
.notification-message {
|
||||
color: #555;
|
||||
color: var(--color-text-secondary);
|
||||
font-size: 0.85rem;
|
||||
margin-bottom: 0.5rem;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.notification-time {
|
||||
color: #95a5a6;
|
||||
color: var(--color-text-muted);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.app-main.with-sidebar {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.app-main.with-sidebar.sidebar-collapsed {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.mobile-header {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 1.25rem 1rem;
|
||||
}
|
||||
|
||||
.notification-dropdown {
|
||||
width: 320px;
|
||||
position: fixed;
|
||||
left: 1rem;
|
||||
right: 1rem;
|
||||
top: 60px;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user