Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add faucet pages to handlebars #47

Merged
merged 3 commits into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading