feat: push for isaac

This commit is contained in:
Nick 2024-12-07 17:07:35 -06:00
parent cee67d1262
commit ed73490d69
2 changed files with 20 additions and 45 deletions

View file

@ -97,7 +97,7 @@ homeContainer device =
homeList : Device -> Element msg homeList : Device -> Element msg
homeList device = homeList device = Debug.log(toString) <|
column pageListDesktop column pageListDesktop
[ case device.class of [ case device.class of
Desktop -> Desktop ->

View file

@ -3,47 +3,21 @@
// The value returned here will be passed as flags // The value returned here will be passed as flags
// into your `Shared.init` function. // into your `Shared.init` function.
export const flags = ({ env }) => { export const flags = ({ env }) => {
// Log the environment parameter return {
console.log('Environment:', env); height: window.innerHeight,
width: window.innerWidth
// 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 // This is called AFTER your Elm app starts up
// //
// Here you can work with `app.ports` to send messages // Here you can work with `app.ports` to send messages
// to your Elm application, or subscribe to incoming // to your Elm application, or subscribe to incoming
// messages from Elm // messages from Elm
export const onReady = ({ app, env }) => { export const onReady = ({ app, env }) => {
app.ports.getArgHeight.subscribe((numArgs) => { app.ports.getArgHeight.subscribe((numArgs) => {
const heights = []; const heights = [];
for (let i = 0; i < numArgs; i++) { for (let i = 0; i < numArgs; i++) {
const element = document.getElementById(`arg${i}`); const element = document.getElementById(`arg${i}`);
if (element) { if (element) {
heights.push(element.offsetHeight); heights.push(element.offsetHeight);
} else { } else {
@ -53,5 +27,6 @@ export const onReady = ({ app, env }) => {
} }
app.ports.gotArgHeight.send(heights); app.ports.gotArgHeight.send(heights);
}); });
}; };