Files
gravl/frontend/src/components/SwapWorkoutModal.css
T
clawd 6ad917c9b9 feat(06-01): Implement workout swap/rotation system - API, DB, frontend
- Add workout_swaps table migration (007_add_workout_swap_tracking.sql)
- Implement 4 API endpoints: POST /swap, DELETE /undo, GET /swaps, GET /available
- Add request validation, error handling, user isolation, muscle group checks
- Create SwapWorkoutModal React component with modal UI
- Integrate swap functionality into WorkoutPage
- Add proper styling for swap modal
- All endpoints require authentication
- Database migration includes performance indexes
2026-03-06 15:06:31 +01:00

375 lines
6.5 KiB
CSS

/* ============================================
SWAP WORKOUT MODAL
============================================ */
.swap-modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: flex-end;
justify-content: center;
z-index: 1000;
animation: fadeIn 0.2s ease-out;
padding: 0;
}
.swap-modal-content {
background: white;
border-radius: 12px 12px 0 0;
width: 100%;
max-width: 500px;
max-height: 80vh;
overflow-y: auto;
padding: 20px;
display: flex;
flex-direction: column;
gap: 16px;
box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}
.swap-modal-header {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
}
.swap-modal-header h3 {
margin: 0;
font-size: 18px;
font-weight: 600;
color: var(--text-primary);
}
.swap-modal-close {
background: none;
border: none;
font-size: 24px;
cursor: pointer;
color: #999;
padding: 0;
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6px;
transition: all 0.2s;
}
.swap-modal-close:hover {
background: #f0f0f0;
color: #333;
}
.swap-modal-close:active {
transform: scale(0.95);
}
/* ============================================
CURRENT EXERCISE
============================================ */
.swap-current-exercise {
background: #f5f5f5;
padding: 16px;
border-radius: 8px;
border-left: 4px solid var(--accent);
}
.swap-current-label {
font-size: 12px;
color: #999;
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 4px;
font-weight: 500;
}
.swap-current-name {
font-size: 16px;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 4px;
}
.swap-current-group {
font-size: 13px;
color: #666;
}
/* ============================================
ALTERNATIVES LIST
============================================ */
.swap-alternatives-list {
display: flex;
flex-direction: column;
gap: 8px;
}
.swap-alternatives-label {
font-size: 12px;
color: #999;
text-transform: uppercase;
letter-spacing: 0.5px;
font-weight: 500;
padding: 0 4px;
}
.swap-alternative-item {
display: flex;
align-items: center;
gap: 12px;
padding: 14px 12px;
border: 1px solid #ddd;
border-radius: 8px;
cursor: pointer;
transition: all 0.2s ease;
min-height: 48px;
}
.swap-alternative-item:hover {
background: #fafafa;
border-color: var(--accent);
box-shadow: 0 2px 8px rgba(255, 107, 74, 0.1);
}
.swap-alternative-item:active {
transform: scale(0.98);
}
.swap-alternative-info {
flex: 1;
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.swap-alternative-name {
font-size: 14px;
font-weight: 600;
color: var(--text-primary);
word-break: break-word;
}
.swap-alternative-group {
font-size: 12px;
color: #999;
}
.swap-alternative-desc {
font-size: 12px;
color: #666;
margin-top: 2px;
line-height: 1.3;
word-break: break-word;
}
.swap-alternative-icon {
color: #ccc;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
}
/* ============================================
LOADING STATE
============================================ */
.swap-loading-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px 20px;
gap: 12px;
}
.swap-spinner {
width: 32px;
height: 32px;
border: 3px solid #f0f0f0;
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.swap-loading-state p {
color: #999;
font-size: 13px;
margin: 0;
}
/* ============================================
EMPTY STATE
============================================ */
.swap-empty-state {
display: flex;
align-items: center;
justify-content: center;
padding: 32px 20px;
}
.swap-empty-state p {
color: #999;
font-size: 13px;
text-align: center;
margin: 0;
}
/* ============================================
ERROR MESSAGE
============================================ */
.swap-error-message {
display: flex;
align-items: flex-start;
gap: 8px;
background: #fff5f5;
border: 1px solid #fdd;
border-radius: 6px;
padding: 12px;
color: #c33;
font-size: 13px;
}
.swap-error-message svg {
flex-shrink: 0;
margin-top: 2px;
}
/* ============================================
ACTIONS
============================================ */
.swap-modal-actions {
display: flex;
gap: 8px;
padding-top: 8px;
border-top: 1px solid #eee;
}
.swap-cancel-btn {
flex: 1;
padding: 12px 16px;
background: #f5f5f5;
border: 1px solid #ddd;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
min-height: 44px;
}
.swap-cancel-btn:hover:not(:disabled) {
background: #e8e8e8;
border-color: #ccc;
}
.swap-cancel-btn:active:not(:disabled) {
transform: scale(0.98);
}
.swap-cancel-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* ============================================
ANIMATIONS
============================================ */
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
/* ============================================
MOBILE RESPONSIVE
============================================ */
@media (max-width: 600px) {
.swap-modal-content {
border-radius: 12px 12px 0 0;
max-height: 90vh;
padding: 16px;
}
.swap-modal-header h3 {
font-size: 16px;
}
.swap-alternative-item {
min-height: 56px;
padding: 12px;
}
.swap-alternative-name {
font-size: 15px;
}
.swap-current-exercise {
padding: 12px;
}
.swap-modal-actions {
flex-direction: column;
gap: 8px;
}
.swap-cancel-btn {
min-height: 48px;
}
}
/* Dark mode support (if app has dark mode) */
@media (prefers-color-scheme: dark) {
.swap-modal-content {
background: var(--bg-secondary);
}
.swap-modal-close {
color: #999;
}
.swap-modal-close:hover {
background: rgba(255, 255, 255, 0.1);
color: #fff;
}
.swap-current-exercise {
background: rgba(255, 255, 255, 0.05);
}
.swap-alternative-item {
border-color: #444;
}
.swap-alternative-item:hover {
background: rgba(255, 255, 255, 0.08);
}
.swap-cancel-btn {
background: rgba(255, 255, 255, 0.1);
border-color: #444;
}
.swap-cancel-btn:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.15);
}
}