Files
duty-teller/webapp/css/states.css
Nikolay Tatarinov 0d28123d0b
All checks were successful
CI / lint-and-test (push) Successful in 35s
Docker Build and Release / build-and-push (push) Successful in 51s
Docker Build and Release / release (push) Successful in 8s
feat: enhance current duty display with remaining time and improved contact links
- Added a new message key for displaying remaining time until the end of the shift in both English and Russian.
- Updated the current duty card to show remaining time with a formatted string.
- Enhanced the contact links to support block layout with icons for phone and Telegram, improving visual presentation.
- Implemented a new utility function to calculate remaining time until the end of the shift.
- Added unit tests for the new functionality, ensuring accurate time calculations and proper rendering of contact links.
2026-03-02 19:04:30 +03:00

307 lines
5.3 KiB
CSS

/* === Loading / error / access denied / current duty view */
.loading {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
padding: 12px;
color: var(--muted);
text-align: center;
}
.loading__spinner {
display: block;
width: 20px;
height: 20px;
border: 2px solid transparent;
border-top-color: var(--accent);
border-radius: 50%;
animation: loading-spin 0.8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
.loading__spinner {
animation: none;
border-top-color: var(--accent);
border-right-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
}
@keyframes loading-spin {
to {
transform: rotate(360deg);
}
}
.loading, .error {
text-align: center;
padding: 12px;
color: var(--muted);
}
.error,
.access-denied {
transition: opacity 0.2s ease-out;
}
.error {
color: var(--error);
}
.error[hidden], .loading.hidden,
.current-duty-view.hidden {
display: none !important;
}
/* Current duty view (Mini App deep link startapp=duty) */
[data-view="currentDuty"] .calendar-sticky,
[data-view="currentDuty"] .duty-list {
display: none !important;
}
.current-duty-view {
padding: 24px 16px;
min-height: 60vh;
display: flex;
align-items: center;
justify-content: center;
}
.current-duty-card {
background: var(--surface);
border-radius: 12px;
border-top: 3px solid var(--duty);
padding: 24px;
max-width: 360px;
width: 100%;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
animation: card-appear 0.3s ease-out;
}
@keyframes card-appear {
from {
opacity: 0;
transform: translateY(16px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.current-duty-title {
margin: 0 0 16px 0;
font-size: 1.25rem;
font-weight: 600;
color: var(--text);
}
.current-duty-live-dot {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--duty);
margin-right: 8px;
animation: pulse-dot 1.5s ease-in-out infinite;
vertical-align: middle;
}
@keyframes pulse-dot {
0%,
100% {
opacity: 1;
transform: scale(1);
}
50% {
opacity: 0.6;
transform: scale(1.15);
}
}
@media (prefers-reduced-motion: reduce) {
.current-duty-card {
animation: none;
}
.current-duty-live-dot {
animation: none;
opacity: 1;
}
}
.current-duty-name {
margin: 0 0 8px 0;
font-size: 1.5rem;
font-weight: 600;
color: var(--duty);
}
.current-duty-shift {
margin: 0 0 12px 0;
font-size: 0.95rem;
color: var(--muted);
}
.current-duty-remaining {
margin: 0 0 12px 0;
font-size: 0.95rem;
color: var(--muted);
}
/* No-duty state: icon + prominent text */
.current-duty-card--no-duty {
border-top-color: var(--muted);
}
.current-duty-no-duty-wrap {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
margin: 0 0 20px 0;
padding: 8px 0;
}
.current-duty-no-duty-icon {
display: block;
color: var(--muted);
margin-bottom: 16px;
line-height: 0;
}
.current-duty-no-duty-icon svg {
display: block;
opacity: 0.7;
}
.current-duty-no-duty {
margin: 0;
font-size: 1.15rem;
font-weight: 500;
color: var(--muted);
line-height: 1.4;
max-width: 20em;
}
.current-duty-error {
margin: 0 0 16px 0;
color: var(--error);
}
.current-duty-error {
color: var(--error);
}
.current-duty-contact-row {
margin: 12px 0 20px 0;
}
.current-duty-contact-row--blocks {
display: flex;
flex-direction: column;
gap: 8px;
}
.current-duty-contact-block {
display: flex;
align-items: center;
gap: 12px;
min-height: 48px;
padding: 12px 16px;
border-radius: 8px;
background: color-mix(in srgb, var(--accent) 12%, transparent);
color: var(--accent);
text-decoration: none;
font-size: 1rem;
font-weight: 500;
transition: background 0.2s ease;
}
.current-duty-contact-block:hover,
.current-duty-contact-block:focus-visible {
background: color-mix(in srgb, var(--accent) 20%, transparent);
text-decoration: none;
color: var(--accent);
}
.current-duty-contact-block:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.current-duty-contact-block svg {
flex-shrink: 0;
}
.current-duty-contact {
display: inline-block;
margin-right: 12px;
font-size: 0.95rem;
}
.current-duty-contact-link,
.current-duty-contact-phone,
.current-duty-contact-username {
color: var(--accent);
text-decoration: none;
}
.current-duty-contact-link:hover,
.current-duty-contact-phone:hover,
.current-duty-contact-username:hover {
text-decoration: underline;
}
.current-duty-back-btn {
display: block;
width: 100%;
padding: 12px 16px;
margin-top: 8px;
font-size: 1rem;
font-weight: 500;
color: var(--bg);
background: var(--accent);
border: none;
border-radius: 8px;
cursor: pointer;
}
.current-duty-back-btn:hover {
opacity: 0.9;
}
.current-duty-back-btn:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.current-duty-loading {
text-align: center;
color: var(--muted);
}
.access-denied {
text-align: center;
padding: 24px 12px;
color: var(--muted);
}
.access-denied p {
margin: 0 0 8px 0;
}
.access-denied p:first-child {
color: var(--error);
font-weight: 600;
}
.access-denied .access-denied-detail {
margin-top: 8px;
font-size: 0.9rem;
color: var(--muted);
}
.access-denied[hidden] {
display: none !important;
}