Skip to content

Commit cce0dbc

Browse files
committed
fix: move download page components to home
1 parent 57d2915 commit cce0dbc

File tree

4 files changed

+59
-159
lines changed

4 files changed

+59
-159
lines changed

src/layout/Footer/FooterHost.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
<section class="links-container">
4848
<FooterSection title="Pages">
4949
<li><a href="/">Home</a></li>
50-
<li><a href="/download">Download</a></li>
5150
<li><a href="/patches">Patches</a></li>
5251
<li><a href="/contributors">Contributors</a></li>
5352
<li><a href="/donate">Donate</a></li>

src/layout/Hero/HeroSection.svelte

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,71 @@
1-
<script>
2-
import Button from '$lib/components/Button.svelte';
1+
<script lang="ts">
2+
import Button from "$lib/components/Button.svelte";
3+
import { queries } from "$data/api";
4+
import { onMount } from "svelte";
5+
import { createQuery } from "@tanstack/svelte-query";
6+
import Query from "$lib/components/Query.svelte";
7+
import Dialogue from "$lib/components/Dialogue.svelte";
8+
9+
const query = createQuery(["manager"], queries.manager);
10+
11+
let warning: string;
12+
let warningDialogue = false;
13+
14+
let userAgent: string;
15+
let isAndroid: boolean;
16+
let androidVersionMatch: RegExpExecArray | null;
17+
let androidVersion: number;
18+
let managerUrl: string;
19+
20+
onMount(() => {
21+
userAgent = navigator.userAgent;
22+
androidVersionMatch = /Android\s([\d.]+)/i.exec(userAgent);
23+
androidVersion = androidVersionMatch ? parseInt(androidVersionMatch[1]) : 0;
24+
isAndroid = !!androidVersion;
25+
});
26+
27+
query.subscribe((val) => {
28+
if (val.data) managerUrl = val.data.assets[0].browser_download_url;
29+
});
30+
31+
function handleClick() {
32+
if (!isAndroid) {
33+
warning = "Your device is not running Android.";
34+
warningDialogue = true;
35+
} else if (androidVersion < 8) {
36+
warning = `Your device is running ${androidVersion}. ReVanced Manager only supports Android versions 8 and above.`;
37+
warningDialogue = true;
38+
}
39+
}
340
</script>
441

42+
<Dialogue bind:modalOpen={warningDialogue}>
43+
<svelte:fragment slot="title">Device unsupported</svelte:fragment>
44+
<svelte:fragment slot="description">{warning} Do you still want to download ReVanced Manager?</svelte:fragment>
45+
<svelte:fragment slot="buttons">
46+
<Button
47+
type="text"
48+
href={managerUrl}
49+
on:click={() => (warningDialogue = false)}>Download</Button
50+
>
51+
<Button type="text" on:click={() => (warningDialogue = false)}>Cancel</Button>
52+
</svelte:fragment>
53+
</Dialogue>
54+
555
<section class="hero">
656
<div class="hero-text">
757
<h1>Continuing the <br />legacy of <span>Vanced.</span></h1>
858
<p>
959
Customize your mobile experience through ReVanced <br /> by applying patches to your applications.
1060
</p>
1161
<div class="hero-buttons">
12-
<Button icon="download" type="filled" href="download">Download</Button>
62+
<Button
63+
on:click={handleClick}
64+
type="filled"
65+
icon="download"
66+
>
67+
Download Manager
68+
</Button>
1369
<Button icon="docs" type="tonal" href="patches">View patches</Button>
1470
</div>
1571
</div>

src/layout/Navbar/NavHost.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
<div id="main-navigation">
7373
<ul class="nav-buttons">
7474
<Navigation href="/" label="Home">Home</Navigation>
75-
<Navigation queryKey="manager" href="/download" label="Download">Download</Navigation>
7675
<Navigation queryKey="patches" href="/patches" label="Patches">Patches</Navigation>
7776
<Navigation queryKey="repositories" href="/contributors" label="Contributors">
7877
Contributors

src/routes/download/+page.svelte

Lines changed: 0 additions & 154 deletions
This file was deleted.

0 commit comments

Comments
 (0)