feat: Add mobile responsive layout, open room access, and admin room management

Mobile Responsive Layout:
- Add useMediaQuery, useIsMobile, useIsTablet, useIsDesktop hooks for device detection
- Create MobileHeader component with hamburger menu and action drawer
- Create BottomToolbar for mobile navigation (Files, Members)
- Create SlidePanel component for full-screen mobile sidebars
- Update RoomDetail.tsx with mobile/desktop conditional rendering
- Update RoomList.tsx with single-column grid and touch-friendly buttons
- Add CSS custom properties for safe areas and touch targets (min 44px)
- Add mobile viewport meta tags for notched devices

Open Room Access:
- All authenticated users can view all rooms (not just their own)
- Users can join active rooms they're not members of
- Add is_member field to room responses
- Update room list API to return all rooms by default

Admin Room Management:
- Add permanent delete functionality for system admins
- Add delete confirmation dialog with room title verification
- Broadcast room deletion via WebSocket to connected users
- Add users search API for adding members

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-05 09:12:10 +08:00
parent 1e44a63a8e
commit 1d5d4d447d
48 changed files with 3505 additions and 401 deletions

View File

@@ -2,6 +2,9 @@ import { create } from 'zustand'
import { persist } from 'zustand/middleware'
import type { User } from '../types'
// System admin email - must match backend SYSTEM_ADMIN_EMAIL
const SYSTEM_ADMIN_EMAIL = 'ymirliu@panjit.com.tw'
interface AuthState {
token: string | null
user: User | null
@@ -49,3 +52,18 @@ export const useAuthStore = create<AuthState>()(
}
)
)
/**
* Check if the current user is a system administrator
*/
export function isSystemAdmin(username: string | undefined): boolean {
return username === SYSTEM_ADMIN_EMAIL
}
/**
* Hook to check if current user is admin
*/
export function useIsAdmin(): boolean {
const user = useAuthStore((state) => state.user)
return isSystemAdmin(user?.username)
}