fix: resolve duplicate header and improve Redis management

- Dashboard: Remove redundant header (Layout already provides it)
- projectctl.sh: Add start_redis/stop_redis functions for automatic
  Redis lifecycle management on project start/stop
- rate_limiter.py: Add fallback to memory storage when Redis unavailable

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beabigegg
2026-01-07 21:53:16 +08:00
parent 4b5a9c1d0a
commit a7c452ffd8
3 changed files with 154 additions and 84 deletions

View File

@@ -1,95 +1,34 @@
import { useAuth } from '../contexts/AuthContext'
export default function Dashboard() {
const { user, logout } = useAuth()
const handleLogout = async () => {
await logout()
}
const { user } = useAuth()
return (
<div style={styles.container}>
<header style={styles.header}>
<h1 style={styles.title}>Project Control</h1>
<div style={styles.userInfo}>
<span style={styles.userName}>{user?.name}</span>
{user?.is_system_admin && (
<span style={styles.badge}>Admin</span>
)}
<button onClick={handleLogout} style={styles.logoutButton}>
Logout
</button>
</div>
</header>
<main style={styles.main}>
<div style={styles.welcomeCard}>
<h2>Welcome, {user?.name}!</h2>
<p>Email: {user?.email}</p>
<p>Role: {user?.role || 'No role assigned'}</p>
{user?.is_system_admin && (
<p style={styles.adminNote}>
You have system administrator privileges.
</p>
)}
</div>
<div style={styles.infoCard}>
<h3>Getting Started</h3>
<p>
This is the Project Control system dashboard. Features will be
added as development progresses.
<div style={styles.welcomeCard}>
<h2>Welcome, {user?.name}!</h2>
<p>Email: {user?.email}</p>
<p>Role: {user?.role || 'No role assigned'}</p>
{user?.is_system_admin && (
<p style={styles.adminNote}>
You have system administrator privileges.
</p>
</div>
</main>
)}
</div>
<div style={styles.infoCard}>
<h3>Getting Started</h3>
<p>
This is the Project Control system dashboard. Features will be
added as development progresses.
</p>
</div>
</div>
)
}
const styles: { [key: string]: React.CSSProperties } = {
container: {
minHeight: '100vh',
backgroundColor: '#f5f5f5',
},
header: {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
padding: '16px 24px',
backgroundColor: 'white',
boxShadow: '0 1px 3px rgba(0, 0, 0, 0.1)',
},
title: {
fontSize: '20px',
fontWeight: 600,
color: '#333',
margin: 0,
},
userInfo: {
display: 'flex',
alignItems: 'center',
gap: '12px',
},
userName: {
color: '#666',
},
badge: {
backgroundColor: '#0066cc',
color: 'white',
padding: '2px 8px',
borderRadius: '4px',
fontSize: '12px',
fontWeight: 500,
},
logoutButton: {
padding: '8px 16px',
backgroundColor: '#f5f5f5',
border: '1px solid #ddd',
borderRadius: '4px',
cursor: 'pointer',
fontSize: '14px',
},
main: {
padding: '24px',
maxWidth: '1200px',
margin: '0 auto',