Update frontend to modern responsive design (v2.0.0)

Modernized the web interface with a mobile-first responsive design:

- Added CSS custom properties (variables) for consistent theming
- Implemented responsive breakpoints (640px, 768px) for mobile/tablet/desktop
- Applied fluid typography using clamp() for automatic font scaling
- Enhanced animations (fade-in, slide-in, scale effects) for smooth UX
- Improved component styling with modern shadows and hover effects
- Added backdrop blur effects on modals
- Optimized touch targets (min 44px height) for mobile accessibility
- Updated button groups and layouts to stack on mobile
- Enhanced visual hierarchy with better spacing and typography
- Improved recordings grid with responsive card layout

Template version bumped from 1.9.2 to 2.0.0

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-30 10:01:28 +07:00
parent 86b2770d3e
commit 46c727ea75

View File

@@ -151,7 +151,7 @@ BACKUP_ON_WRITE = BACKUP_CONFIG.get('backup_on_write', True)
WEB_PORT = SYS_CONFIG['web']['port'] WEB_PORT = SYS_CONFIG['web']['port']
# Template version - increment this when HTML template changes # Template version - increment this when HTML template changes
TEMPLATE_VERSION = "1.9.2" # Updated: Use Unicode escapes for emojis in JavaScript strings TEMPLATE_VERSION = "2.0.0" # Updated: Modern responsive design with mobile-first approach, improved layout and animations
# Flask app # Flask app
app = Flask(__name__) app = Flask(__name__)
@@ -1351,302 +1351,531 @@ def main():
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rotary Phone Control Panel</title> <title>Rotary Phone Control Panel</title>
<style> <style>
:root {
--primary: #667eea;
--primary-dark: #5568d3;
--secondary: #764ba2;
--success: #10b981;
--success-dark: #059669;
--danger: #ef4444;
--danger-dark: #dc2626;
--warning: #f59e0b;
--gray-50: #f9fafb;
--gray-100: #f3f4f6;
--gray-200: #e5e7eb;
--gray-300: #d1d5db;
--gray-400: #9ca3af;
--gray-500: #6b7280;
--gray-600: #4b5563;
--gray-700: #374151;
--gray-900: #111827;
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
--radius-sm: 8px;
--radius-md: 12px;
--radius-lg: 16px;
--transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
* { * {
margin: 0; margin: 0;
padding: 0; padding: 0;
box-sizing: border-box; box-sizing: border-box;
} }
body { body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
min-height: 100vh; min-height: 100vh;
padding: 20px; padding: 1rem;
line-height: 1.6;
} }
@media (min-width: 768px) {
body {
padding: 2rem;
}
}
.container { .container {
max-width: 1200px; max-width: 1400px;
margin: 0 auto; margin: 0 auto;
width: 100%;
} }
.header { .header {
text-align: center; text-align: center;
color: white; color: white;
margin-bottom: 30px; margin-bottom: 2rem;
animation: fadeInDown 0.6s ease-out;
} }
@keyframes fadeInDown {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.header h1 { .header h1 {
font-size: 2.5em; font-size: clamp(1.75rem, 5vw, 3rem);
margin-bottom: 10px; margin-bottom: 0.5rem;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3); text-shadow: 2px 2px 8px rgba(0,0,0,0.2);
font-weight: 700;
letter-spacing: -0.02em;
} }
.header p { .header p {
font-size: 1.1em; font-size: clamp(0.95rem, 2vw, 1.15rem);
opacity: 0.9; opacity: 0.95;
font-weight: 300;
} }
.card { .card {
background: white; background: white;
border-radius: 15px; border-radius: var(--radius-lg);
padding: 25px; padding: 1.5rem;
margin-bottom: 20px; margin-bottom: 1.5rem;
box-shadow: 0 10px 30px rgba(0,0,0,0.3); box-shadow: var(--shadow-xl);
transition: var(--transition);
animation: fadeInUp 0.6s ease-out backwards;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.3s; }
.card:nth-child(5) { animation-delay: 0.4s; }
.card:nth-child(6) { animation-delay: 0.5s; }
.card:nth-child(7) { animation-delay: 0.6s; }
@media (min-width: 768px) {
.card {
padding: 2rem;
}
}
.card:hover {
box-shadow: 0 25px 35px -5px rgba(0, 0, 0, 0.15);
transform: translateY(-2px);
} }
.status-card { .status-card {
display: flex; display: flex;
align-items: center; flex-direction: column;
justify-content: space-between; gap: 1rem;
} }
@media (min-width: 640px) {
.status-card {
flex-direction: row;
align-items: center;
justify-content: space-between;
}
}
.status-indicator { .status-indicator {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 10px; gap: 0.75rem;
flex-wrap: wrap;
} }
.status-dot { .status-dot {
width: 20px; width: 18px;
height: 20px; height: 18px;
border-radius: 50%; border-radius: 50%;
animation: pulse 2s infinite; animation: pulse 2s infinite;
flex-shrink: 0;
} }
.status-dot.on-hook { .status-dot.on-hook {
background: #10b981; background: var(--success);
box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
} }
.status-dot.off-hook { .status-dot.off-hook {
background: #ef4444; background: var(--danger);
box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
} }
.status-dot.recording { .status-dot.recording {
background: #f59e0b; background: var(--warning);
box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
} }
@keyframes pulse { @keyframes pulse {
0%, 100% { opacity: 1; } 0%, 100% {
50% { opacity: 0.5; } opacity: 1;
transform: scale(1);
}
50% {
opacity: 0.7;
transform: scale(1.05);
}
} }
.card h2 { .card h2 {
color: #333; color: var(--gray-900);
margin-bottom: 20px; margin-bottom: 1.25rem;
font-size: 1.5em; font-size: clamp(1.25rem, 3vw, 1.5rem);
border-bottom: 2px solid #667eea; font-weight: 700;
padding-bottom: 10px; border-bottom: 3px solid var(--primary);
padding-bottom: 0.75rem;
letter-spacing: -0.01em;
} }
.upload-section { .upload-section {
border: 2px dashed #667eea; border: 2px dashed var(--primary);
border-radius: 10px; border-radius: var(--radius-md);
padding: 30px; padding: 1.5rem;
text-align: center; text-align: center;
margin-bottom: 20px; margin-bottom: 1.5rem;
background: #f8f9fa; background: var(--gray-50);
transition: var(--transition);
} }
@media (min-width: 768px) {
.upload-section {
padding: 2rem;
}
}
.upload-section:hover {
border-color: var(--primary-dark);
background: white;
}
.upload-section input[type="file"] { .upload-section input[type="file"] {
display: none; display: none;
} }
.upload-label { .upload-label {
display: inline-block; display: inline-block;
padding: 12px 30px; padding: 0.875rem 1.75rem;
background: #667eea; background: var(--primary);
color: white; color: white;
border-radius: 8px; border-radius: var(--radius-sm);
cursor: pointer; cursor: pointer;
font-weight: 600; font-weight: 600;
transition: background 0.3s; transition: var(--transition);
font-size: 0.95rem;
box-shadow: var(--shadow-md);
} }
.upload-label:hover { .upload-label:hover {
background: #5568d3; background: var(--primary-dark);
transform: translateY(-1px);
box-shadow: var(--shadow-lg);
}
.upload-label:active {
transform: translateY(0);
} }
.sound-selector { .sound-selector {
width: 100%; width: 100%;
padding: 12px; padding: 0.875rem 1rem;
font-size: 1em; font-size: 0.95rem;
border: 2px solid #e5e7eb; border: 2px solid var(--gray-200);
border-radius: 8px; border-radius: var(--radius-sm);
background: white; background: white;
cursor: pointer; cursor: pointer;
transition: border-color 0.3s; transition: var(--transition);
font-family: inherit;
} }
.sound-selector:hover { .sound-selector:hover {
border-color: #667eea; border-color: var(--primary);
} }
.sound-selector:focus { .sound-selector:focus {
outline: none; outline: none;
border-color: #667eea; border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
} }
.btn { .btn {
padding: 10px 20px; padding: 0.75rem 1.5rem;
border: none; border: none;
border-radius: 8px; border-radius: var(--radius-sm);
cursor: pointer; cursor: pointer;
font-weight: 600; font-weight: 600;
transition: all 0.3s; transition: var(--transition);
font-size: 0.95em; font-size: 0.9rem;
font-family: inherit;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
box-shadow: var(--shadow-sm);
white-space: nowrap;
min-height: 44px;
} }
.btn:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.btn-primary { .btn-primary {
background: #667eea; background: var(--primary);
color: white; color: white;
} }
.btn-primary:hover { .btn-primary:hover:not(:disabled) {
background: #5568d3; background: var(--primary-dark);
transform: translateY(-2px); transform: translateY(-1px);
box-shadow: var(--shadow-md);
} }
.btn-success { .btn-success {
background: #10b981; background: var(--success);
color: white; color: white;
} }
.btn-success:hover { .btn-success:hover:not(:disabled) {
background: #059669; background: var(--success-dark);
transform: translateY(-1px);
box-shadow: var(--shadow-md);
} }
.btn-danger { .btn-danger {
background: #ef4444; background: var(--danger);
color: white; color: white;
} }
.btn-danger:hover { .btn-danger:hover:not(:disabled) {
background: #dc2626; background: var(--danger-dark);
transform: translateY(-1px);
box-shadow: var(--shadow-md);
} }
.btn-secondary { .btn-secondary {
background: #6b7280; background: var(--gray-500);
color: white; color: white;
} }
.btn-secondary:hover { .btn-secondary:hover:not(:disabled) {
background: #4b5563; background: var(--gray-600);
transform: translateY(-1px);
box-shadow: var(--shadow-md);
}
.btn:active:not(:disabled) {
transform: translateY(0);
} }
.recordings-grid { .recordings-grid {
display: grid; display: grid;
gap: 15px; gap: 1rem;
} }
.recording-item { .recording-item {
display: flex; display: flex;
align-items: center; flex-direction: column;
justify-content: space-between; gap: 1rem;
padding: 15px; padding: 1.25rem;
background: #f8f9fa; background: var(--gray-50);
border-radius: 10px; border-radius: var(--radius-md);
transition: all 0.3s; transition: var(--transition);
border: 1px solid var(--gray-200);
} }
@media (min-width: 768px) {
.recording-item {
flex-direction: row;
align-items: center;
justify-content: space-between;
}
}
.recording-item:hover { .recording-item:hover {
background: #e9ecef; background: white;
transform: translateX(5px); transform: translateX(3px);
box-shadow: var(--shadow-md);
border-color: var(--primary);
} }
.recording-info { .recording-info {
flex-grow: 1; flex-grow: 1;
min-width: 0;
} }
.recording-info h3 { .recording-info h3 {
color: #333; color: var(--gray-900);
font-size: 1em; font-size: 1rem;
margin-bottom: 5px; margin-bottom: 0.5rem;
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
} }
.recording-meta { .recording-meta {
color: #6b7280; color: var(--gray-500);
font-size: 0.85em; font-size: 0.85rem;
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
} }
.recording-actions { .recording-actions {
display: flex; display: flex;
gap: 10px; flex-wrap: wrap;
gap: 0.5rem;
justify-content: flex-start;
}
@media (min-width: 768px) {
.recording-actions {
justify-content: flex-end;
}
}
@media (max-width: 767px) {
.recording-actions .btn {
flex: 1 1 calc(50% - 0.25rem);
font-size: 0.85rem;
padding: 0.625rem 1rem;
}
} }
.no-recordings { .no-recordings {
text-align: center; text-align: center;
padding: 40px; padding: 3rem 1.5rem;
color: #6b7280; color: var(--gray-500);
} }
.alert { .alert {
padding: 15px; padding: 1rem 1.25rem;
border-radius: 8px; border-radius: var(--radius-md);
margin-bottom: 20px; margin-bottom: 1.5rem;
font-size: 0.95rem;
box-shadow: var(--shadow-sm);
animation: slideIn 0.3s ease-out;
} }
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.alert-success { .alert-success {
background: #d1fae5; background: #d1fae5;
color: #065f46; color: #065f46;
border-left: 4px solid #10b981; border-left: 4px solid var(--success);
} }
.alert-error { .alert-error {
background: #fee2e2; background: #fee2e2;
color: #991b1b; color: #991b1b;
border-left: 4px solid #ef4444; border-left: 4px solid var(--danger);
} }
.alert-warning {
background: #fef3c7;
color: #92400e;
border-left: 4px solid var(--warning);
}
.alert-info { .alert-info {
background: #dbeafe; background: #dbeafe;
color: #1e40af; color: #1e40af;
border-left: 4px solid #3b82f6; border-left: 4px solid #3b82f6;
} }
.filename-display { .filename-display {
font-family: 'Courier New', monospace; font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;
background: #e9ecef; background: var(--gray-100);
padding: 5px 10px; padding: 0.625rem 1rem;
border-radius: 5px; border-radius: var(--radius-sm);
margin-top: 10px; margin-top: 1rem;
font-size: 0.9em; font-size: 0.875rem;
word-break: break-all;
} }
.stats { .stats {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
gap: 15px; gap: 1rem;
margin-top: 20px; margin-top: 1.5rem;
} }
@media (min-width: 640px) {
.stats {
grid-template-columns: repeat(3, 1fr);
}
}
.stat-box { .stat-box {
background: #667eea; background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
color: white; color: white;
padding: 20px; padding: 1.5rem;
border-radius: 10px; border-radius: var(--radius-md);
text-align: center; text-align: center;
box-shadow: var(--shadow-lg);
transition: var(--transition);
} }
.stat-box:hover {
transform: translateY(-3px) scale(1.02);
box-shadow: var(--shadow-xl);
}
.stat-value { .stat-value {
font-size: 2em; font-size: clamp(1.75rem, 4vw, 2.25rem);
font-weight: bold; font-weight: 800;
margin-bottom: 5px; margin-bottom: 0.25rem;
letter-spacing: -0.02em;
} }
.stat-label { .stat-label {
font-size: 0.9em; font-size: 0.875rem;
opacity: 0.9; opacity: 0.95;
font-weight: 500;
} }
.button-group { .button-group {
display: flex; display: flex;
gap: 10px; flex-wrap: wrap;
margin-top: 15px; gap: 0.75rem;
margin-top: 1.25rem;
}
@media (max-width: 640px) {
.button-group {
flex-direction: column;
}
.button-group .btn {
width: 100%;
}
} }
.active-greeting { .active-greeting {
border: 2px solid #667eea; border: 2px solid var(--primary);
background: #f0f4ff !important; background: #f0f4ff !important;
} }
@@ -1663,51 +1892,80 @@ def main():
top: 0; top: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: rgba(0, 0, 0, 0.7); background: rgba(0, 0, 0, 0.75);
align-items: center; align-items: center;
justify-content: center; justify-content: center;
backdrop-filter: blur(4px);
padding: 1rem;
} }
.audio-modal.show { .audio-modal.show {
display: flex; display: flex;
animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
} }
.audio-modal-content { .audio-modal-content {
background: white; background: white;
padding: 30px; padding: 2rem;
border-radius: 15px; border-radius: var(--radius-lg);
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
max-width: 500px; max-width: 500px;
width: 90%; width: 100%;
animation: scaleIn 0.3s ease-out;
}
@keyframes scaleIn {
from {
opacity: 0;
transform: scale(0.9);
}
to {
opacity: 1;
transform: scale(1);
}
} }
.audio-modal-header { .audio-modal-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 20px; margin-bottom: 1.5rem;
} }
.audio-modal-header h3 { .audio-modal-header h3 {
margin: 0; margin: 0;
color: #333; color: var(--gray-900);
font-size: 1.25rem;
font-weight: 700;
} }
.close-modal { .close-modal {
font-size: 28px; font-size: 1.75rem;
font-weight: bold; font-weight: bold;
color: #6b7280; color: var(--gray-400);
cursor: pointer; cursor: pointer;
border: none; border: none;
background: none; background: none;
padding: 0; padding: 0.25rem;
width: 30px; width: 36px;
height: 30px; height: 36px;
line-height: 1; line-height: 1;
border-radius: var(--radius-sm);
transition: var(--transition);
} }
.close-modal:hover { .close-modal:hover {
color: #333; color: var(--gray-900);
background: var(--gray-100);
} }
.audio-player-container { .audio-player-container {
@@ -1716,16 +1974,19 @@ def main():
.audio-player-container audio { .audio-player-container audio {
width: 100%; width: 100%;
margin-top: 20px; margin-top: 1.25rem;
border-radius: var(--radius-sm);
} }
.audio-filename { .audio-filename {
font-family: 'Courier New', monospace; font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;
background: #f8f9fa; background: var(--gray-50);
padding: 10px; padding: 0.75rem 1rem;
border-radius: 5px; border-radius: var(--radius-sm);
margin-bottom: 10px; margin-bottom: 0.75rem;
word-break: break-all; word-break: break-all;
font-size: 0.875rem;
color: var(--gray-700);
} }
/* Volume slider */ /* Volume slider */
@@ -1733,6 +1994,17 @@ def main():
-webkit-appearance: none; -webkit-appearance: none;
appearance: none; appearance: none;
cursor: pointer; cursor: pointer;
width: 100%;
}
input[type="range"]::-webkit-slider-track {
height: 6px;
border-radius: 3px;
}
input[type="range"]::-moz-range-track {
height: 6px;
border-radius: 3px;
} }
input[type="range"]::-webkit-slider-thumb { input[type="range"]::-webkit-slider-thumb {
@@ -1741,31 +2013,53 @@ def main():
width: 20px; width: 20px;
height: 20px; height: 20px;
border-radius: 50%; border-radius: 50%;
background: #667eea; background: var(--primary);
cursor: pointer; cursor: pointer;
box-shadow: 0 2px 5px rgba(0,0,0,0.2); box-shadow: 0 2px 6px rgba(0,0,0,0.2);
transition: all 0.2s; transition: var(--transition);
margin-top: -7px;
} }
input[type="range"]::-webkit-slider-thumb:hover { input[type="range"]::-webkit-slider-thumb:hover {
background: #5568d3; background: var(--primary-dark);
transform: scale(1.2); transform: scale(1.15);
box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}
input[type="range"]::-webkit-slider-thumb:active {
transform: scale(1.05);
} }
input[type="range"]::-moz-range-thumb { input[type="range"]::-moz-range-thumb {
width: 20px; width: 20px;
height: 20px; height: 20px;
border-radius: 50%; border-radius: 50%;
background: #667eea; background: var(--primary);
cursor: pointer; cursor: pointer;
border: none; border: none;
box-shadow: 0 2px 5px rgba(0,0,0,0.2); box-shadow: 0 2px 6px rgba(0,0,0,0.2);
transition: all 0.2s; transition: var(--transition);
} }
input[type="range"]::-moz-range-thumb:hover { input[type="range"]::-moz-range-thumb:hover {
background: #5568d3; background: var(--primary-dark);
transform: scale(1.2); transform: scale(1.15);
box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}
input[type="range"]::-moz-range-thumb:active {
transform: scale(1.05);
}
/* Responsive utilities */
@media (max-width: 640px) {
.card h2 {
font-size: 1.15rem;
}
h3 {
font-size: 1rem;
}
} }
</style> </style>
</head> </head>