diff --git a/background.js b/background.js
index a571f9c..5ff62a3 100644
--- a/background.js
+++ b/background.js
@@ -966,9 +966,14 @@ async function executeComcipFetch(tabId, requestUrl, method, payload, headers, r
headers: requestHeaders,
};
- if (normalizedMethod !== "GET" && normalizedMethod !== "HEAD") {
+ if (
+ normalizedMethod !== "GET" &&
+ normalizedMethod !== "HEAD" &&
+ requestPayload !== undefined &&
+ requestPayload !== null
+ ) {
requestHeaders["content-type"] = "application/json";
- fetchOptions.body = JSON.stringify(requestPayload || {});
+ fetchOptions.body = JSON.stringify(requestPayload);
}
const response = await fetch(requestUrl, {
@@ -1130,9 +1135,14 @@ async function executeComcipFetchFromFrame(
headers: requestHeaders,
};
- if (normalizedMethod !== "GET" && normalizedMethod !== "HEAD") {
+ if (
+ normalizedMethod !== "GET" &&
+ normalizedMethod !== "HEAD" &&
+ requestPayload !== undefined &&
+ requestPayload !== null
+ ) {
requestHeaders["content-type"] = "application/json";
- fetchOptions.body = JSON.stringify(requestPayload || {});
+ fetchOptions.body = JSON.stringify(requestPayload);
}
const response = await fetch(requestUrl, fetchOptions);
@@ -1264,9 +1274,14 @@ async function executeComcipDirectFetch(
headers: requestHeaders,
};
- if (normalizedMethod !== "GET" && normalizedMethod !== "HEAD") {
+ if (
+ normalizedMethod !== "GET" &&
+ normalizedMethod !== "HEAD" &&
+ payload !== undefined &&
+ payload !== null
+ ) {
requestHeaders["content-type"] = "application/json";
- fetchOptions.body = JSON.stringify(payload || {});
+ fetchOptions.body = JSON.stringify(payload);
}
const response = await fetch(requestUrl, fetchOptions);
diff --git a/content-script.js b/content-script.js
index f27c296..99538d2 100644
--- a/content-script.js
+++ b/content-script.js
@@ -39,6 +39,7 @@
theme: "arch-panel-extension-theme",
sidebarCollapsed: "arch-panel-extension-sidebar-collapsed",
calendarView: "arch-panel-extension-calendar-view",
+ timeManagementSelectedDate: "arch-panel-extension-time-management-selected-date",
};
const CACHE = {
@@ -222,6 +223,8 @@
taskTypeCache: {
promise: null,
},
+ timeManagementActivityCache: new Map(),
+ pendingTimeManagementHighlightRowId: "",
timeManagementDatePicker: {
isOpen: false,
year: new Date().getFullYear(),
@@ -725,6 +728,11 @@
return;
}
+ if (action === "time-management-save") {
+ void saveTimeManagementChanges();
+ return;
+ }
+
if (action === "time-management-remove-row") {
removeTimeManagementEntryRow(actionElement.getAttribute("data-row-id"));
return;
@@ -1061,9 +1069,31 @@
}
appState.pendingFocusSelector = "";
+ scrollPendingTimeManagementHighlightIntoView(overlay);
});
}
+ function scrollPendingTimeManagementHighlightIntoView(overlay) {
+ const rowId = cleanString(appState.pendingTimeManagementHighlightRowId);
+
+ if (!rowId) {
+ return;
+ }
+
+ appState.pendingTimeManagementHighlightRowId = "";
+ const row = overlay.querySelector(
+ `.arch-panel-extension-time-management-entry-row[data-row-id="${cssEscape(rowId)}"]`
+ );
+
+ if (row instanceof HTMLElement) {
+ row.scrollIntoView({
+ behavior: "smooth",
+ block: "center",
+ inline: "nearest",
+ });
+ }
+ }
+
function captureModalScrollState(overlay) {
const mainShell = overlay.querySelector(".arch-panel-extension-main-shell");
const shellBody = overlay.querySelector(".arch-panel-extension-shell-body");
@@ -2396,6 +2426,9 @@
}
const selectedDate = modal.selectedDate || getDateInputValue(new Date());
+ const selectedDateLabel = formatDateInputDisplay(selectedDate);
+ const canSaveTimeManagement = isTimeManagementSaveEnabled(modal);
+ const isSavingTimeManagement = Boolean(modal.isSaving);
return `
@@ -2434,7 +2467,7 @@
@@ -2452,6 +2485,7 @@
+ ${renderTimeManagementHourIndicators(modal)}
${renderTimeManagementBody(modal)}
@@ -2472,7 +2506,20 @@
>
Add (Non-service)
+
+ ${
+ modal.saveErrorMessage
+ ? `${escapeHtml(modal.saveErrorMessage)}
`
+ : ""
+ }