diff --git a/frontend/src/interop.js b/frontend/src/interop.js index 36e9cc9..7a3ab0f 100755 --- a/frontend/src/interop.js +++ b/frontend/src/interop.js @@ -3,11 +3,34 @@ // The value returned here will be passed as flags // into your `Shared.init` function. export const flags = ({ env }) => { - return { - height: window.innerHeight, - width: window.innerWidth - } -} + // 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 + }; + }; + // This is called AFTER your Elm app starts up //