From a02eae32a1520f8acfce8eb4acfbabc0b1d21ebe3da8bed5d0be558de0d46dd3 Mon Sep 17 00:00:00 2001 From: Terrence Ezrol Date: Sun, 13 Jul 2025 12:13:59 -0400 Subject: [PATCH] fix hide/show graph window --- src/roast.html | 2 +- src/roast.ts | 10 ++++++++++ src/tempgraph.ts | 7 ------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/roast.html b/src/roast.html index 4361649..00d4066 100644 --- a/src/roast.html +++ b/src/roast.html @@ -41,7 +41,7 @@ diff --git a/src/roast.ts b/src/roast.ts index e79faa1..c245219 100644 --- a/src/roast.ts +++ b/src/roast.ts @@ -18,6 +18,7 @@ interface Window { logTemp?: Function; //function to log a temputure event exportCSV?: Function; //function to export the events to CSV showGraph?: Function; // function to render or display graphs using libraries like Chart.js for visual representation of logged events + hideGraph?: Function; //function to hind the graph popup } @@ -168,6 +169,14 @@ function showGraph(): void { } } +function hideGraph(): void { + const graphContainer = document.getElementById("graph-container"); + if (graphContainer) { + graphContainer.classList.add("hidden"); + graphContainer.classList.remove("graph-display-flex"); + } +} + // Expose functions to the global scope (allowing html direct access) if (typeof window !== 'undefined') { window.startTimer = startTimer; @@ -179,4 +188,5 @@ if (typeof window !== 'undefined') { window.logTemp = logTemp; window.exportCSV = exportCSV; window.showGraph = showGraph; + window.hideGraph = hideGraph; } \ No newline at end of file diff --git a/src/tempgraph.ts b/src/tempgraph.ts index 917e88a..0c2e0c1 100644 --- a/src/tempgraph.ts +++ b/src/tempgraph.ts @@ -105,10 +105,3 @@ new Chart(ctx, { } } }); - -document.getElementById('close-btn')?.addEventListener('click', () => { - const container = document.getElementById('graph-container'); - if (container) { - container.style.display = container.style.display === 'none' ? 'flex' : 'none'; - } -}); \ No newline at end of file