Skip to content

Commit

Permalink
improve mobile detection
Browse files Browse the repository at this point in the history
  • Loading branch information
thewh1teagle committed Feb 5, 2024
1 parent ed8951b commit 87e2c09
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 33 deletions.
12 changes: 2 additions & 10 deletions landing/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion landing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
},
"type": "module",
"dependencies": {
"svelte-device-info": "^1.0.4",
"svelte-persisted-store": "^0.9.0"
}
}
25 changes: 10 additions & 15 deletions landing/src/components/Cta.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import WindowsIcon from './WindowsIcon.svelte';
import MacIcon from './MacIcon.svelte';
import GithubIcon from './GithubIcon.svelte';
let isMobile: undefined | boolean = false;
let asset = latestRelease.assets.find((a) => a.platform.toLowerCase() === 'macos'); // default to macos
let ctaClicked = false;
Expand Down Expand Up @@ -49,26 +48,22 @@
}
onMount(async () => {
const Device: Device = (await import('svelte-device-info')) as any;
isMobile = Device?.isMobile;
const currentOs = getOs();
asset = latestRelease.assets.find((a) => a.platform.toLowerCase() === currentOs); // default to macos
});
</script>

<div class="flex gap-3 flex-col lg:flex-row">
{#if !isMobile}
<button on:click={ctaClick} class="btn btn-primary">
{#if asset?.platform.toLowerCase() === 'linux'}
<LinuxIcon />
{:else if asset?.platform.toLowerCase() === 'windows'}
<WindowsIcon />
{:else}
<MacIcon />
{/if}
Download For {asset?.platform}
</button>
{/if}
<button on:click={ctaClick} class="btn btn-primary hidden md:flex">
{#if asset?.platform.toLowerCase() === 'linux'}
<LinuxIcon />
{:else if asset?.platform.toLowerCase() === 'windows'}
<WindowsIcon />
{:else}
<MacIcon />
{/if}
Download For {asset?.platform}
</button>
<a class="btn" href="https://github.com/thewh1teagle/vibe" target="_blank">
<GithubIcon />
Star On Github
Expand Down
7 changes: 0 additions & 7 deletions landing/src/lib/svelteDeviceInfo.d.ts

This file was deleted.

0 comments on commit 87e2c09

Please sign in to comment.