Skip to content

Commit

Permalink
Merge pull request #47 from Muzikie/46-add-faucet-page
Browse files Browse the repository at this point in the history
Add faucet pages to handlebars
  • Loading branch information
reyraa authored Nov 18, 2023
2 parents 039aa13 + d713c7a commit ed638bf
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = function (grunt) {
build: {
files: {
'build/js/vendors.min.js': ['./node_modules/jquery/dist/jquery.min.js'],
'build/js/bundle.min.js': ['./src/js/menu.js', './src/js/accordion.js', './src/js/mailChimp.js', './src/js/scroll.js']
'build/js/bundle.min.js': ['./src/js/faucet.js','./src/js/menu.js', './src/js/accordion.js', './src/js/mailChimp.js', './src/js/faucet.js', './src/js/scroll.js']
}
}
},
Expand Down
6 changes: 6 additions & 0 deletions sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
<lastmod>2023-08-24</lastmod>
<changefreq>quarterly</changefreq>
<priority>1.1.0</priority>
</url>
<url>
<loc>https://muzikie.com/faucet</loc>
<lastmod>2023-08-24</lastmod>
<changefreq>quarterly</changefreq>
<priority>1.1.0</priority>
</url>
<url>
<loc>https://muzikie.com/privacy</loc>
Expand Down
22 changes: 22 additions & 0 deletions src/js/faucet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
async function sendTokens (e) {
e.preventDefault();
const formBody = JSON.stringify(Object.fromEntries(new FormData(this)));
try {
const response = await fetch(this.action, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: formBody, // Send the data as JSON
});
const data = await response.json();
document.getElementById('faucet-feedback').textContent = data.success ? 'Sent. Check your wallet!' : 'Something went wrong. Try again later.';
} catch (error) {
document.getElementById('faucet-feedback').textContent = error.message;
}
};

document.addEventListener('DOMContentLoaded', () => {
const form = document.getElementById('faucet-form');
form.addEventListener('submit', sendTokens);
});
48 changes: 48 additions & 0 deletions src/pages/faucet.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{> head title="faucet" }}
<section class="light-mode space_section_last">
<div class="container is--stage">
<div class="container__text is--stage">
<div class="container__16">
<div class="div-block artist form">
<div class="container__16 max">
<h2 class="h2">All tokens are for testing purposes only</h2>
<p class="is--small is--accordion">
Please enter your address to receive 10 MZK tokens for free
</p>
</div>
<form
action="http://localhost:9902/faucet"
id="faucet-form"
class="form artist pioneer"
>
<div class="scrollpane">
<div class="container__16 is--form">
<div class="text-field__container is--vertical">
<div class="field">
<div class="text-input custom">
<div class="html-field w-embed">
<input class="custom-input" placeholder="Address*" type="text" name="address" id="mce-ADDRESS" maxlength="42" required>
<label class="floating-label" for="mce-ADDRESS">Address*</label>
</div>
</div>
</div>
</div>
<div class="text-field__container is--button">
<button type="submit" class="button is--small is--submit w-button">Submit</button>
</div>
<div class="text-field__container is--button">
<div class="label" id="faucet-feedback"></div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
{{> footer}}
{{> desktopNavigation}}
{{> mobileNavigation}}
{{> backToTop}}
{{> closing}}
3 changes: 3 additions & 0 deletions src/templates/footer.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<div class="footer__text">
<a href="/terms" class="menu__link is--imprint">Terms of Use</a>
</div>
<div class="footer__text">
<a href="/faucet" class="menu__link is--imprint">Faucet</a>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit ed638bf

Please sign in to comment.