feat: enhance duty information handling with contact details and current duty view
- Added `bot_username` to settings for dynamic retrieval of the bot's username. - Implemented `_resolve_bot_username` function to fetch the bot's username if not set, improving user experience in group chats. - Updated `DutyWithUser` schema to include optional `phone` and `username` fields for enhanced duty information. - Enhanced API responses to include contact details for users, ensuring better communication. - Introduced a new current duty view in the web app, displaying active duty information along with contact options. - Updated CSS styles for better presentation of contact information in duty cards. - Added unit tests to verify the inclusion of contact details in API responses and the functionality of the current duty view.
This commit is contained in:
248
webapp/style.css
248
webapp/style.css
@@ -416,6 +416,48 @@ body.day-detail-sheet-open {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
/* Contact info: phone (tel:) and Telegram username links in day detail */
|
||||
.day-detail-contact-row {
|
||||
margin-top: 4px;
|
||||
font-size: 0.85rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.day-detail-contact {
|
||||
display: inline-block;
|
||||
margin-right: 0.75em;
|
||||
}
|
||||
|
||||
.day-detail-contact:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.day-detail-contact-link,
|
||||
.day-detail-contact-phone,
|
||||
.day-detail-contact-username {
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.day-detail-contact-link:hover,
|
||||
.day-detail-contact-phone:hover,
|
||||
.day-detail-contact-username:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.day-detail-contact-link:focus,
|
||||
.day-detail-contact-phone:focus,
|
||||
.day-detail-contact-username:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.day-detail-contact-link:focus-visible,
|
||||
.day-detail-contact-phone:focus-visible,
|
||||
.day-detail-contact-username:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.info-btn {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
@@ -746,6 +788,70 @@ body.day-detail-sheet-open {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* Flip-card: front = duty info + button, back = contacts */
|
||||
.duty-flip-card {
|
||||
perspective: 600px;
|
||||
position: relative;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.duty-flip-inner {
|
||||
transition: transform 0.4s;
|
||||
transform-style: preserve-3d;
|
||||
position: relative;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.duty-flip-card[data-flipped="true"] .duty-flip-inner {
|
||||
transform: rotateY(180deg);
|
||||
}
|
||||
|
||||
.duty-flip-front {
|
||||
position: relative;
|
||||
backface-visibility: hidden;
|
||||
-webkit-backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.duty-flip-back {
|
||||
backface-visibility: hidden;
|
||||
-webkit-backface-visibility: hidden;
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
transform: rotateY(180deg);
|
||||
}
|
||||
|
||||
.duty-flip-btn {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
background: var(--surface);
|
||||
color: var(--accent);
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background var(--transition-fast), color var(--transition-fast);
|
||||
}
|
||||
|
||||
.duty-flip-btn:hover {
|
||||
background: color-mix(in srgb, var(--accent) 20%, var(--surface));
|
||||
}
|
||||
|
||||
.duty-flip-btn:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.duty-flip-btn:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.duty-timeline-card.duty-item,
|
||||
.duty-list .duty-item {
|
||||
display: grid;
|
||||
@@ -793,6 +899,41 @@ body.day-detail-sheet-open {
|
||||
.duty-timeline-card .name { grid-column: 1; grid-row: 2; min-width: 0; }
|
||||
.duty-timeline-card .time { grid-column: 1; grid-row: 3; }
|
||||
|
||||
/* Contact info: phone and Telegram username links in duty timeline cards */
|
||||
.duty-contact-row {
|
||||
grid-column: 1;
|
||||
grid-row: 4;
|
||||
font-size: 0.8rem;
|
||||
color: var(--muted);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.duty-contact-link,
|
||||
.duty-contact-phone,
|
||||
.duty-contact-username {
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.duty-contact-link:hover,
|
||||
.duty-contact-phone:hover,
|
||||
.duty-contact-username:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.duty-contact-link:focus,
|
||||
.duty-contact-phone:focus,
|
||||
.duty-contact-username:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.duty-contact-link:focus-visible,
|
||||
.duty-contact-phone:focus-visible,
|
||||
.duty-contact-username:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.duty-item--current {
|
||||
border-left-color: var(--today);
|
||||
background: color-mix(in srgb, var(--today) 12%, var(--surface));
|
||||
@@ -848,10 +989,115 @@ body.day-detail-sheet-open {
|
||||
color: var(--error);
|
||||
}
|
||||
|
||||
.error[hidden], .loading.hidden {
|
||||
.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;
|
||||
padding: 24px;
|
||||
max-width: 360px;
|
||||
width: 100%;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.current-duty-title {
|
||||
margin: 0 0 16px 0;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.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-no-duty,
|
||||
.current-duty-error {
|
||||
margin: 0 0 16px 0;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.current-duty-error {
|
||||
color: var(--error);
|
||||
}
|
||||
|
||||
.current-duty-contact-row {
|
||||
margin: 12px 0 20px 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;
|
||||
|
||||
Reference in New Issue
Block a user