1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul-website synced 2024-11-21 21:22:21 +00:00

add download link

This commit is contained in:
Ash Keel 2023-02-19 21:17:13 +01:00
parent 0a0fe02f18
commit 5d240a2390
No known key found for this signature in database
GPG key ID: BAD8D93E7314ED3E
5 changed files with 113 additions and 11 deletions

View file

@ -2,14 +2,86 @@
<main class="landing"> <main class="landing">
<section class="hero maxw"> <section class="hero maxw">
<div class="hero-copy"> <div class="hero-copy">
<h1>HEY PUT TEXT HERE!</h1> <h1>The streaming companion for power users</h1>
<div class="download-button"> <p>
<a href="https://github.com/strimertul/strimertul/releases/latest"> strimertül is a free and open source companion to your tech stack for
Download creating powerful overlays and power up the viewer interaction in your
</a> Twitch streams!
</p>
<div id="download">
<noscript>
<a href="https://github.com/strimertul/strimertul/releases/latest">
Check out the latest version on GitHub
</a>
</noscript>
<div class="hidden" id="download-template">
<h2>
Latest release:
<a href="https://github.com/strimertul/strimertul/releases/latest"
><span data-field="name"></span> (<time data-field="date"></time
>)</a
>
</h2>
<div class="download-list"><b>Downloads:</b></div>
</div>
</div> </div>
<script>
const platforms = [
{
filter: ".exe",
name: "Windows 64-bit",
},
{
filter: ".dmg",
name: "macOS Universal",
},
{
filter: "linux",
name: "Linux AMD64",
},
];
(async function () {
const releaseblock = document.getElementById("download-template");
const latest = await (
await fetch(
"https://api.github.com/repos/strimertul/strimertul/releases/latest"
)
).json();
// Poor's man angularjs
const data = {
...latest,
date: new Date(latest.published_at).toLocaleDateString(),
};
releaseblock.querySelectorAll("*[data-field]").forEach((el) => {
const { field } = el.dataset;
if (field in data) {
el.innerHTML = data[field];
}
});
// Make those links
const downloadLinks = releaseblock.querySelector(".download-list");
latest.assets
.map((asset) => [
platforms.findIndex(({ filter }) =>
asset.name.includes(filter)
),
asset.browser_download_url,
])
.filter(([index]) => index >= 0)
.sort(([a], [b]) => a - b)
.forEach(([index, url]) => {
const link = document.createElement("a");
link.classList.add("download-link");
link.href = url;
link.appendChild(
document.createTextNode(platforms[index].name)
);
downloadLinks.appendChild(link);
});
releaseblock.classList.remove("hidden");
})();
</script>
</div> </div>
<div class="screenshots"></div>
</section> </section>
<section class="features"> <section class="features">
<article> <article>

View file

@ -1,8 +1,7 @@
<header class="site-nav"> <header class="site-nav">
<div class="appname"> <a href="/" class="appname">
<img src="/brand/icon-logo.svg" height="30" /> <img src="/brand/icon-logo.svg" height="30" /> strimertül
strimertül </a>
</div>
<nav> <nav>
<a <a
href="{{ relURL "" }}" href="{{ relURL "" }}"

View file

@ -7,6 +7,9 @@
& > nav { & > nav {
display: none; display: none;
} }
& > div.doc {
padding: 1rem;
}
} }
& > nav, & > nav,
& > .doc { & > .doc {
@ -14,6 +17,7 @@
padding: 1rem; padding: 1rem;
} }
& > nav { & > nav {
background-color: $gray2;
padding: 0; padding: 0;
grid-column: 1; grid-column: 1;
ul { ul {
@ -44,6 +48,7 @@
} }
& > .doc { & > .doc {
grid-column: 2; grid-column: 2;
padding: 1rem 2rem;
} }
.monotitle { .monotitle {
font-family: "Iosevka Web", monospace; font-family: "Iosevka Web", monospace;

View file

@ -41,4 +41,24 @@
} }
} }
} }
.download-list {
display: flex;
gap: 0.5rem;
align-items: center;
a {
color: $teal12;
background-color: $teal8;
text-decoration: none;
display: block;
padding: 5px 8px;
border-radius: 5px;
transition: all 100ms;
&:hover {
color: white;
background-color: $teal9;
}
}
}
} }

View file

@ -72,8 +72,10 @@ p {
} }
} }
.appname { a.appname {
padding: 10px; padding: 10px;
text-decoration: none;
color: white;
} }
.container { .container {
@ -81,3 +83,7 @@ p {
width: 100%; width: 100%;
margin: 0 auto; margin: 0 auto;
} }
.hidden {
display: none;
}