diff --git a/app.js b/app.js
index 27bd43e..200373c 100644
--- a/app.js
+++ b/app.js
@@ -1501,21 +1501,63 @@ function setupHoverEvents(sunburstData) {
${name}
+
${value.toLocaleString()} ₽
`;
+ // Add click handler to header eye button
+ const headerEyeBtn = detailsHeader.querySelector('.header-eye-btn');
+ if (headerEyeBtn && data) {
+ headerEyeBtn.addEventListener('click', (e) => {
+ e.stopPropagation();
+ openTransactionModal(data);
+ });
+ }
}
// Show the default view with top categories
function showDefaultView() {
- currentHoveredData = null;
+ // Use month name instead of "Total"
+ const selectedMonth = document.getElementById('month-select').value;
+ const monthName = getRussianMonthName(selectedMonth);
+
+ // Create a virtual "data" object for the total view that contains all transactions
+ const allTransactions = [];
+ sunburstData.data.forEach(category => {
+ if (category.transactions) {
+ allTransactions.push(...category.transactions);
+ }
+ });
+ const totalData = { name: monthName, transactions: allTransactions };
+ currentHoveredData = totalData;
+
detailsHeader.innerHTML = `
-
- Total
+
+ ${monthName}
+
${sunburstData.total.toLocaleString()} ₽
`;
+ // Add click handler to header eye button
+ const headerEyeBtn = detailsHeader.querySelector('.header-eye-btn');
+ if (headerEyeBtn) {
+ headerEyeBtn.addEventListener('click', (e) => {
+ e.stopPropagation();
+ openTransactionModal(totalData);
+ });
+ }
+
// Show top categories as default items
displayDetailsItems(sunburstData.data, sunburstData.total);
}
diff --git a/styles.css b/styles.css
index fcad025..46fd9fd 100644
--- a/styles.css
+++ b/styles.css
@@ -341,6 +341,11 @@ body {
color: #333;
}
+/* Header eye button - always visible */
+.header-eye-btn {
+ opacity: 0.5;
+}
+
/* Floating eye button on chart (shown when hovering over sunburst sector) */
.chart-eye-btn {
position: absolute;