Skip to content

Commit

Permalink
improve landing mobile detect
Browse files Browse the repository at this point in the history
  • Loading branch information
thewh1teagle committed Jun 5, 2024
1 parent ad5cfe2 commit 71adbe9
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions landing/src/components/Cta.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import GithubIcon from '~/icons/Github.svelte'
import ChipIcon from '~/icons/Chip.svelte'
import latestRelease from '$lib/latest_release.json'
import Logo from '~/icons/Logo.svelte'
let asset = latestRelease.assets.find((a) => a.platform.toLowerCase() === 'macos') // default to macos
let ctaClicked = false
Expand All @@ -18,8 +17,10 @@
const macSiliconAsset = latestRelease.assets.find((a) => a.platform.toLowerCase() === 'macos' && a.arch === 'darwin-aarch64')
let mobileModalOpen = false
let isMobile = false
function ctaClick() {
if (window.navigator.maxTouchPoints > 0) {
if (isMobile) {
// is mobile
mobileModalOpen = true
} else {
Expand Down Expand Up @@ -58,6 +59,19 @@
currentURL = location.href
})
onMount(() => {
function checkIsMobile() {
var match = window.matchMedia || (window as any).msMatchMedia
if (match) {
var mq = match('(pointer:coarse)')
return mq.matches
}
return false
}
isMobile = checkIsMobile()
})
const t = $i18n.t
</script>

Expand Down

0 comments on commit 71adbe9

Please sign in to comment.