Files
duty-teller/webapp/js/dom.js
Nikolay Tatarinov e3240d0981 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.
2026-03-02 16:09:08 +03:00

57 lines
1.8 KiB
JavaScript

/**
* DOM references and shared application state.
*/
/** @type {HTMLDivElement|null} */
export const calendarEl = document.getElementById("calendar");
/** @type {HTMLElement|null} */
export const monthTitleEl = document.getElementById("monthTitle");
/** @type {HTMLDivElement|null} */
export const dutyListEl = document.getElementById("dutyList");
/** @type {HTMLElement|null} */
export const loadingEl = document.getElementById("loading");
/** @type {HTMLElement|null} */
export const errorEl = document.getElementById("error");
/** @type {HTMLElement|null} */
export const accessDeniedEl = document.getElementById("accessDenied");
/** @type {HTMLElement|null} */
export const headerEl = document.querySelector(".header");
/** @type {HTMLElement|null} */
export const weekdaysEl = document.querySelector(".weekdays");
/** @type {HTMLButtonElement|null} */
export const prevBtn = document.getElementById("prevMonth");
/** @type {HTMLButtonElement|null} */
export const nextBtn = document.getElementById("nextMonth");
/** @type {HTMLDivElement|null} */
export const currentDutyViewEl = document.getElementById("currentDutyView");
/** Currently viewed month (mutable). */
export const state = {
/** @type {Date} */
current: new Date(),
/** @type {object[]} */
lastDutiesForList: [],
/** @type {ReturnType<typeof setInterval>|null} */
todayRefreshInterval: null,
/** @type {'ru'|'en'} */
lang: "ru",
/** One-time bind flag for sticky scroll shadow listener. */
stickyScrollBound: false,
/** One-time bind flag for calendar (info button) hint document listeners. */
calendarHintBound: false,
/** One-time bind flag for duty marker hint document listeners. */
dutyMarkerHintBound: false,
/** Whether initData retry after ACCESS_DENIED has been attempted. */
initDataRetried: false
};