All checks were successful
CI / lint-and-test (push) Successful in 14s
- Introduced a new `i18n.js` module for handling translations and language detection, supporting both Russian and English. - Updated various components to utilize the new translation functions, enhancing user experience by providing localized messages for errors, hints, and UI elements. - Refactored existing code in `api.js`, `calendar.js`, `dutyList.js`, `hints.js`, and `ui.js` to replace hardcoded strings with translated messages, improving maintainability and accessibility. - Enhanced the initialization process in `main.js` to set the document language and update UI elements based on the user's language preference.
46 lines
1.3 KiB
JavaScript
46 lines
1.3 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");
|
|
|
|
/** 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"
|
|
};
|