From ed73490d69fbd116ceeb3a974446fbb089abef1d Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 7 Dec 2024 17:07:35 -0600 Subject: [PATCH] feat: push for isaac --- frontend/src/Pages/Home_.elm | 2 +- frontend/src/interop.js | 63 +++++++++++------------------------- 2 files changed, 20 insertions(+), 45 deletions(-) diff --git a/frontend/src/Pages/Home_.elm b/frontend/src/Pages/Home_.elm index 84c5b75..d2e02a7 100755 --- a/frontend/src/Pages/Home_.elm +++ b/frontend/src/Pages/Home_.elm @@ -97,7 +97,7 @@ homeContainer device = homeList : Device -> Element msg -homeList device = +homeList device = Debug.log(toString) <| column pageListDesktop [ case device.class of Desktop -> diff --git a/frontend/src/interop.js b/frontend/src/interop.js index 3114e99..f2bf88f 100755 --- a/frontend/src/interop.js +++ b/frontend/src/interop.js @@ -3,55 +3,30 @@ // The value returned here will be passed as flags // into your `Shared.init` function. export const flags = ({ env }) => { - // Log the environment parameter - console.log('Environment:', env); - - // Log the window's inner height and width - console.log('Window Height:', window.innerHeight); - console.log('Window Width:', window.innerWidth); - - // Determine the device type based on the user agent - const userAgent = navigator.userAgent.toLowerCase(); - let deviceType = 'Unknown Device'; - - if (/mobile|android|iphone|ipad|ipod|windows phone/i.test(userAgent)) { - deviceType = 'Mobile Device'; - } else if (/tablet|ipad/i.test(userAgent)) { - deviceType = 'Tablet'; - } else if (/desktop|laptop|windows|mac|linux/i.test(userAgent)) { - deviceType = 'Desktop or Laptop'; - } - - // Log the detected device type - console.log('Device Type:', deviceType); - - return { - height: window.innerHeight, - width: window.innerWidth - }; - }; - - +return { +height: window.innerHeight, +width: window.innerWidth +} +} // This is called AFTER your Elm app starts up // // Here you can work with `app.ports` to send messages // to your Elm application, or subscribe to incoming // messages from Elm export const onReady = ({ app, env }) => { - app.ports.getArgHeight.subscribe((numArgs) => { - const heights = []; - - for (let i = 0; i < numArgs; i++) { - const element = document.getElementById(`arg${i}`); - - if (element) { - heights.push(element.offsetHeight); - } else { - console.error(`Element with ID 'arg${i}' not found.`); - heights.push(null); // Add null or any placeholder for missing elements - } +app.ports.getArgHeight.subscribe((numArgs) => { + const heights = []; + for (let i = 0; i < numArgs; i++) { + const element = document.getElementById(`arg${i}`); + if (element) { + heights.push(element.offsetHeight); + } else { + console.error(`Element with ID 'arg${i}' not found.`); + heights.push(null); // Add null or any placeholder for missing elements } - - app.ports.gotArgHeight.send(heights); - }); + } + + app.ports.gotArgHeight.send(heights); +}); }; +