Skip to content

Commit

Permalink
feat: add launchpad downloads (#200)
Browse files Browse the repository at this point in the history
* feat: add launchpad downloads

* feat: downloads updates

* feat: replace testnet with stagenet

* fix: remove testnet
  • Loading branch information
NovaT82 committed Jan 25, 2024
1 parent d86b6a5 commit 784cfa2
Show file tree
Hide file tree
Showing 15 changed files with 118 additions and 113 deletions.
21 changes: 8 additions & 13 deletions _data/launchpad_downloads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@
checksumDivID: linuxCSID
version: Ubuntu 18.04 and higher
source: https://github.com/Minotari-project/Minotari-launchpad
background-image: /assets/img/downloads/ubuntu.mp4
background-image: /assets/img/downloads/launchpad-ubuntu.mp4
video-poster: /assets/img/downloads/ubuntu.png
tutorial-video: /dibbler-install-guides/
logo: /img/downloads/ubuntu-logo.svg
logo-active: /img/downloads/ubuntu-logo-active.svg
defaultActive: active
ctaText: Download for Ubuntu
filter_spec: ubuntu
archOptions:
[{ value: arm64, label: arm64 }, { value: x86_64, label: x86_64 }]
networkOptions:
[{ value: nextnet, label: Nextnet }, { value: stagenet, label: Stagenet }]
archOptions: [{ value: x86_64, label: x86_64 }]
networkOptions: [{ value: nextnet, label: Nextnet }]
- type: Mac
elementID: mac
binaryDivID: osxBinID
Expand All @@ -36,17 +34,15 @@
checksumDivID: osxCSID
version: MacOS 10.15.0 (Catalina) and higher
source: https://github.com/Minotari-project/Minotari
background-image: /assets/img/downloads/mac.mp4
background-image: /assets/img/downloads/launchpad-mac.mp4
video-poster: /assets/img/downloads/mac.png
tutorial-video: /dibbler-install-guides/
logo: /img/downloads/apple-logo.svg
logo-active: /img/downloads/apple-logo-active.svg
ctaText: Download for Mac
filter_spec: osx-10.15
archOptions:
[{ value: arm64, label: arm64 }, { value: x86_64, label: x86_64 }]
networkOptions:
[{ value: nextnet, label: Nextnet }, { value: stagenet, label: Stagenet }]
archOptions: [{ value: x86_64, label: x86_64 }]
networkOptions: [{ value: nextnet, label: Nextnet }]
- type: Windows
elementID: windows
binaryDivID: windowsBinID
Expand All @@ -60,16 +56,15 @@
checksumDivID: windowsCSID
version: Windows 10 and higher
source: https://github.com/Minotari-project/Minotari
background-image: /assets/img/downloads/windows.mp4
background-image: /assets/img/downloads/launchpad-windows.mp4
video-poster: /assets/img/downloads/windows.png
tutorial-video: /dibbler-install-guides/
logo: /img/downloads/windows-logo.svg
logo-active: /img/downloads/windows-logo-active.svg
ctaText: Download for Windows
filter_spec: windows
archOptions: [{ value: x64, label: x64 }]
networkOptions:
[{ value: nextnet, label: Nextnet }, { value: stagenet, label: Stagenet }]
networkOptions: [{ value: nextnet, label: Nextnet }]
- type: Libraries
elementID: support
binaryDivID: libWalletBinID
Expand Down
6 changes: 3 additions & 3 deletions _data/suite_downloads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
archOptions:
[{ value: arm64, label: arm64 }, { value: x86_64, label: x86_64 }]
networkOptions:
[{ value: nextnet, label: Nextnet }, { value: stagenet, label: Stagenet }]
[{ value: nextnet, label: Nextnet }, { value: mainnet, label: Stagenet }]
- type: Mac
elementID: mac
binaryDivID: osxBinID
Expand All @@ -46,7 +46,7 @@
archOptions:
[{ value: arm64, label: arm64 }, { value: x86_64, label: x86_64 }]
networkOptions:
[{ value: nextnet, label: Nextnet }, { value: stagenet, label: Stagenet }]
[{ value: nextnet, label: Nextnet }, { value: mainnet, label: Stagenet }]
- type: Windows
elementID: windows
binaryDivID: windowsBinID
Expand All @@ -69,7 +69,7 @@
filter_spec: windows
archOptions: [{ value: x64, label: x64 }]
networkOptions:
[{ value: nextnet, label: Nextnet }, { value: stagenet, label: Stagenet }]
[{ value: nextnet, label: Nextnet }, { value: mainnet, label: Stagenet }]
- type: Libraries
elementID: support
binaryDivID: libWalletBinID
Expand Down
9 changes: 4 additions & 5 deletions _includes/download_launchpad.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ <h2 class="dl-title">{{ os.title }}</h2>
<h2>Past Versions</h2>
{% if os.downloadBtnID %}
<div class="past">
<p class="select-network">Filter by Network: </p>
<!-- <button id="mainnet" class="chip">Stagenet</button> -->
<button id="nextnet" class="chip">Nextnet</button>
<button id="testnet" class="chip">Testnet</button>
<p class="select-network">Filter by Network: </p>
{% for network in os.networkOptions %}
<button id="{{ network.value }}" class="chip">{{ network.label }}</button>
{% endfor %}
<button id="all-networks" class="chip">All</button>
</div>
{% endif %}
Expand All @@ -129,7 +129,6 @@ <h2>Past Versions</h2>
</div>
</div>
</div>

</div>

{% endfor %}
Expand Down
14 changes: 6 additions & 8 deletions _includes/download_suite.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
</div>

{% for os in site.data.suite_downloads %}

<div class="download-content" id="{{ os.elementID }}">
<div class="dl-card">
<div class="dl-info-holder col-lg-7 col-md-7 col-sm-12">
Expand Down Expand Up @@ -108,10 +109,10 @@ <h2 class="dl-title">{{ os.title }}</h2>
<h2>Past Versions</h2>
{% if os.downloadBtnID %}
<div class="past">
<p class="select-network">Filter by Network: </p>
<!-- <button id="mainnet" class="chip">Stagenet</button> -->
<button id="nextnet" class="chip">Nextnet</button>
<button id="testnet" class="chip">Testnet</button>
<p class="select-network">Filter by Network: </p>
{% for network in os.networkOptions %}
<button id="{{ network.value }}" class="chip">{{ network.label }}</button>
{% endfor %}
<button id="all-networks" class="chip">All</button>
</div>
{% endif %}
Expand All @@ -129,10 +130,7 @@ <h2>Past Versions</h2>
</div>
</div>
</div>

</div>

{% endfor %}

</div>

</div>
2 changes: 1 addition & 1 deletion _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
dataKey: "tari-project/wallet-ios",
elementPrefix: "wallet",
}
]
],
}
</script>

Expand Down
4 changes: 2 additions & 2 deletions assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2215,8 +2215,8 @@ body.page- #call-to-action {
box-shadow: 0 30px 60px 0 rgba(78,19,126,0.06);
border-radius: 10px;
padding: 60px;
margin-top: 100px;
margin-bottom: 200px;
margin-top: 60px;
margin-bottom: 50px;
position: relative;
min-height: 360px;
max-height: 400px;
Expand Down
Binary file added assets/img/downloads/launchpad-mac.mp4
Binary file not shown.
Binary file added assets/img/downloads/launchpad-mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/downloads/launchpad-ubuntu.mp4
Binary file not shown.
Binary file added assets/img/downloads/launchpad-ubuntu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/downloads/launchpad-window.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/downloads/launchpad-windows.mp4
Binary file not shown.
Binary file added assets/img/downloads/launchpad-windows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 64 additions & 53 deletions assets/js/downloads.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,59 @@
let OS = "";
const networks = ["nextnet", "testnet"]
const networks = []
let options = [{
os: "linux",
arch: ['arm64', 'x86_64'],
arch: [],
network: [],
},{
os: "osx",
arch: ['arm64', 'x86_64'],
network: [],
},{
},
{
os: "windows",
arch: ['x64'],
arch: [],
network: [],
}];
},
{
os: "osx",
arch: [],
network: [],
}
];
let currentNetwork = networks[0];
let pastNetwork = networks[0];
let networkUrlData = {};
let currentOS = "";
let currentArch = "";
const pageLocation = window.location.href.split("/")[3];
const fileLocation = pageLocation === "launchpad" ? "launchpad/current" : "current";

// function getArchValues() {
// options.forEach(({os, arch}) => {
// let selectElement = document.getElementById(`${os}ArchID`) || "";

// if (selectElement !== "") {
// for (let i = 0; i < selectElement.options.length; i++) {
// let optionValue = selectElement.options[i].value;
// arch.push(optionValue);
// }
// currentArch = arch[0];
// }
// });
// }
// getArchValues();

// function getNetworkValues() {
// options.forEach(({os, network}) => {
// let selectElement = document.getElementById(`${os}NetworkID`) || "";

// if (selectElement !== "") {
// for (let i = 0; i < selectElement.options.length; i++) {
// let optionValue = selectElement.options[i].value;
// network.push(optionValue);
// }
// }
// });
// }
// getNetworkValues();
function getArchValues() {
options.forEach(({os, arch}) => {
let selectElement = document.getElementById(`${os}ArchID`) || "";

if (selectElement !== "") {
for (let i = 0; i < selectElement.options.length; i++) {
let optionValue = selectElement.options[i].value;
arch.push(optionValue);
}
currentArch = arch[0];
}
});
}
getArchValues();

function getNetworkValues() {
options.forEach(({os, network}) => {
let selectElement = document.getElementById(`${os}NetworkID`) || "";

if (selectElement !== "") {
for (let i = 0; i < selectElement.options.length; i++) {
let optionValue = selectElement.options[i].value;
network.push(optionValue);
}
}
});
networks.push(...options[0].network);
pastNetwork = networks[0];
}
getNetworkValues();

function ignoreFolders(data, foldersToIgnore) {
return Object.entries(data).reduce((acc, [os, binaries]) => {
Expand Down Expand Up @@ -166,24 +173,29 @@ jQuery(document).ready(function ($) {
url: Tari.s3BucketURL,
headers: { "Access-Control-Allow-Origin": "*" },
success: function (res) {
console.log("res", res)
const foldersToIgnore = ["diag-utils"];
const data = ignoreFolders(res, foldersToIgnore);
groupDataByOs(data);
setLatest(data);
const filteredKeys = Object.keys(data).filter(key => key.startsWith(fileLocation));
const filteredData = {};
filteredKeys.forEach(key => {
filteredData[key] = data[key];
});
groupDataByOs(filteredData);
setLatest(filteredData);
setDownloadLink(currentOS, networks[0], options.find(option => option.os === currentOS).arch[0]);
},
});
}

function groupDataByOs(data) {
renderBinaries(data["current/linux"], "linux");
renderBinaries(data["current/windows"], "windows");
renderBinaries(data["current/osx"], "osx");
renderBinaries(data["current/libwallet"], "libWallet");
renderBinaries(data[`${fileLocation}/linux`], "linux");
renderBinaries(data[`${fileLocation}/windows`], "windows");
renderBinaries(data[`${fileLocation}/osx`], "osx");
}

function renderBinaries(data, os) {
let rawOs = os.replace("current/", "");
let rawOs = os.replace(`${fileLocation}/`, "");
let binContainer = document.getElementById(`${rawOs}BinID`);
const dateOptions = { weekday: "long", month: "short", day: "numeric" };

Expand All @@ -206,14 +218,10 @@ jQuery(document).ready(function ($) {
const path = binary.path.split("/").pop();

let networkClass = "";
if (binary.path.includes("stagenet")) {
networkClass = "stagenet";
} else if (binary.path.includes("mainnet")) {
networkClass = "mainnet";
} else if (binary.path.includes("testnet")) {
networkClass = "testnet";
} else if (binary.path.includes("nextnet")) {
networkClass = "nextnet";
for (let i = 0; i < networks.length; i++) {
if (binary.path.includes(networks[i])) {
networkClass = networks[i];
}
}

return `<div class="bin-row ${altClass} ${networkClass} all-networks hide">
Expand All @@ -232,7 +240,7 @@ jQuery(document).ready(function ($) {
function setLatest(data) {
// filter by os
Object.keys(data).forEach((os) => {
let rawOs = os.replace("current/", "");
let rawOs = os.replace(`${fileLocation}/`, "");
if (rawOs === os) {
return;
}
Expand Down Expand Up @@ -288,6 +296,8 @@ jQuery(document).ready(function ($) {

networkUrlData[rawOs][network][arch] = latest;

console.log("latest", latest)

});
}
});
Expand Down Expand Up @@ -326,4 +336,5 @@ jQuery(document).ready(function ($) {

// get values from select elements
downloadSelection();
console.log("options", options)
});
Loading

0 comments on commit 784cfa2

Please sign in to comment.