Add a per-widget text-size picker for calendar/tasks legibility
Build and push server image / test (push) Successful in 42s
Build and push server image / build-and-push (push) Successful in 3m33s
Build and push server image / deploy (push) Failing after 1m24s

Calendar and tasks pack the most body text at the smallest default
sizes, so those two gear-icon dialogs get a "Text size" card (Normal/
Large/X-Large) alongside the existing Border card -- a new Widget-level
font_scale column with its own POST .../font-scale endpoint, same
Widget-property-not-config-field shape as border_style. Threaded through
every classic (calendar_render.py) and modern (html_render.py/
calendar_html_render.py) size calc via one shared panel_style.
scaled_size() so row heights/max_rows already derived from font size
re-fit around the bigger text automatically.
This commit is contained in:
2026-08-02 03:23:27 +00:00
parent 09119e775f
commit 2868087467
22 changed files with 426 additions and 60 deletions
@@ -199,6 +199,7 @@ function initCalendarDialog() {
document.getElementById('calendar-preview-refresh').addEventListener('click', loadCalendarPreview);
loadCalendarPreview();
initBorderFields();
initFontScaleFields();
initButtonActionFields();
}
@@ -0,0 +1,32 @@
// Shared "Text size" card (models.Widget.font_scale,
// _widget_font_scale_fields.html) -- only present on the calendar/tasks
// dialogs (see frame_pages.py's widget_dialog), same "one shared init
// function" shape as initBorderFields, just not included on every
// dialog since it isn't relevant to every widget type.
function initFontScaleFields() {
const select = document.getElementById('widget_font_scale');
if (!select) return; // dialog fragment didn't render the font-scale card -- shouldn't happen
document.getElementById('font-scale-config-form').addEventListener('submit', async (e) => {
e.preventDefault();
try {
const resp = await fetch(`${window.FRAME_API}/font-scale`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ font_scale: Number(select.value) }),
});
if (!resp.ok) throw new Error(await apiError(resp));
showStatus(true, 'Text size saved.');
// Whichever dialog is actually open -- both loadCalendarPreview and
// loadTasksPreview are always defined (plain script tags, not
// module-scoped), so checking the function's existence isn't
// enough; check for the <img> it actually targets instead (calling
// the wrong one throws setting .src on a null element).
if (document.getElementById('calendar-preview')) loadCalendarPreview();
if (document.getElementById('tasks-preview')) loadTasksPreview();
} catch (err) {
showStatus(false, err.message);
}
});
}
+1
View File
@@ -90,6 +90,7 @@ function initTasksDialog() {
document.getElementById('tasks-preview-refresh').addEventListener('click', loadTasksPreview);
loadTasksPreview();
initBorderFields();
initFontScaleFields();
initButtonActionFields();
}