pydici icon indicating copy to clipboard operation
pydici copied to clipboard

Timesheet default view mode wrong depending on screen

Open er-vin opened this issue 1 year ago • 0 comments

For some reason it looks like window.screen.width and window.screen.height aren't trustworthy enough to pick the default value for the timesheet view mode.

Typically right now it reports for me 1280x720 on a screen which is in fact 2560x1440. Due to this it thinks the height is less than 768 and wrongly picks the split weeks mode. Another solution probably needs to be use to decide which default to pick.

My proposal would be to use the orientation media query. Indeed, if you are in landscape you probably want to favor horizontal layout and have the month mode, if you are in portrait you probably want to favor vertical layout and have the split weeks mode.

This could be achieved using something like the following:

let isPortrait = window.matchMedia("(orientation: portrait)").matches 

er-vin avatar Oct 09 '24 09:10 er-vin