mirror of
https://gitlab.com/upRootNutrition/website.git
synced 2025-06-16 04:25:11 -05:00
feat: worked on some stuff
This commit is contained in:
parent
f898d204d0
commit
cb51b17c08
1 changed files with 28 additions and 5 deletions
|
@ -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
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue