diff --git a/assets/css/frontend.css b/assets/css/frontend.css index 99a6b5a..e305d00 100644 --- a/assets/css/frontend.css +++ b/assets/css/frontend.css @@ -34,47 +34,72 @@ margin-top: 8px; } -.us-my-lessons { +/* + * The upcoming-lessons panel. Every rule here is scoped under #us-booking-app — + * the same id-level specificity .us-slot above uses — because these rows sit in + * whatever layout the theme provides and carry more content than a calendar + * cell. Bare class selectors lost to theme rules on div/span/strong, which + * collapsed the flex layout and piled the details on top of the actions. + */ +#us-booking-app .us-my-lessons { margin-bottom: 24px; } -.us-my-lesson { +#us-booking-app .us-my-lesson { + box-sizing: border-box; + max-width: 100%; border: 1px solid #ddd; border-radius: 4px; padding: 12px 16px; margin-bottom: 8px; display: flex; + flex-wrap: wrap; justify-content: space-between; align-items: center; - gap: 12px; + gap: 8px 12px; } -.us-my-lesson-info { +/* + * `min-width: 0` lets the title column shrink below its content width — without + * it a long offering title cannot compress and shoves the status pill and + * Cancel button out of the row. The flex-basis keeps the details and the + * actions on one line while there is room, and wraps them once there is not. + */ +#us-booking-app .us-my-lesson-info { display: flex; flex-direction: column; gap: 2px; + flex: 1 1 14em; + min-width: 0; } -.us-my-lesson-title { +#us-booking-app .us-my-lesson-title, +#us-booking-app .us-my-lesson-when { + overflow-wrap: break-word; + word-break: break-word; +} + +#us-booking-app .us-my-lesson-title { font-size: 1.05em; } -.us-my-lesson-duration { +#us-booking-app .us-my-lesson-duration { font-weight: normal; color: #666; } -.us-my-lesson-when { +#us-booking-app .us-my-lesson-when { color: #555; } -.us-my-lesson-actions { +#us-booking-app .us-my-lesson-actions { display: flex; - gap: 12px; + flex-wrap: wrap; + gap: 8px 12px; align-items: center; } -.us-show-all-lessons { +#us-booking-app .us-show-all-lessons { background: transparent; border: 1px solid #ccc; border-radius: 4px; @@ -82,11 +107,11 @@ cursor: pointer; } -.us-show-all-lessons:hover { +#us-booking-app .us-show-all-lessons:hover { border-color: #888; } -.us-cancel-lesson { +#us-booking-app .us-cancel-lesson { background: transparent; border: 1px solid #ccc; border-radius: 4px; @@ -95,24 +120,26 @@ color: #c00; } -.us-cancel-lesson:hover { +#us-booking-app .us-cancel-lesson:hover { border-color: #c00; } -.us-lesson-status { +#us-booking-app .us-lesson-status { + display: inline-block; font-size: 0.85em; font-weight: 600; padding: 2px 10px; border-radius: 10px; background: #eee; + white-space: nowrap; } -.us-lesson-status-confirmed { +#us-booking-app .us-lesson-status-confirmed { background: #e2f5e5; color: #1a7d2e; } -.us-lesson-status-pending { +#us-booking-app .us-lesson-status-pending { background: #fdf3d7; color: #8a6d1a; } @@ -345,6 +372,20 @@ .us-week-day { min-height: 0; } + + /* + * A lesson row carries a title, a date/time, a status pill and a button — + * more than fits one narrow line, so stack the details above the actions + * rather than letting them wrap into each other. + */ + #us-booking-app .us-my-lesson { + flex-direction: column; + align-items: stretch; + } + + #us-booking-app .us-my-lesson-info { + flex: 0 0 auto; + } } /* Shown only in block-editor previews (see BlockPreview). */ diff --git a/assets/js/booking.js b/assets/js/booking.js index 11261a9..aa51ff7 100644 --- a/assets/js/booking.js +++ b/assets/js/booking.js @@ -582,16 +582,19 @@ function lessonRowHtml(l) { const title = l.offering_title ? escHtml(String(l.offering_title)) : 'Lesson'; const duration = l.duration_minutes ? ` (${escHtml(String(l.duration_minutes))} min)` : ''; + // The two columns are divs, not spans: as spans the layout only held up + // while the stylesheet's display:flex won, and a theme rule on span + // collapsed the row onto itself. return `