mirror of
https://gitlab.com/upRootNutrition/website.git
synced 2025-06-16 04:25:11 -05:00
feat: push for isaac
This commit is contained in:
parent
cee67d1262
commit
ed73490d69
2 changed files with 20 additions and 45 deletions
|
@ -97,7 +97,7 @@ homeContainer device =
|
|||
|
||||
|
||||
homeList : Device -> Element msg
|
||||
homeList device =
|
||||
homeList device = Debug.log(toString) <|
|
||||
column pageListDesktop
|
||||
[ case device.class of
|
||||
Desktop ->
|
||||
|
|
|
@ -3,47 +3,21 @@
|
|||
// 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) => {
|
||||
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 {
|
||||
|
@ -53,5 +27,6 @@ export const onReady = ({ app, env }) => {
|
|||
}
|
||||
|
||||
app.ports.gotArgHeight.send(heights);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue