lbry.tech/app/components/playground.js

81 lines
3 KiB
JavaScript
Raw Normal View History

2018-09-27 18:11:26 +02:00
"use strict";
// P A C K A G E S
import dedent from "dedent";
import html from "choo/html";
import raw from "choo/html/raw";
// E X P O R T
2018-10-03 22:27:13 +02:00
export default () => dedent`
<section class="playground">
<ul class="playground__navigation">
${raw(navigation())}
</ul>
<p class="playground__description" id="playground-example-description"></p>
<section class="playground__content">${raw(example1())}</section>
</section>
`;
2018-09-27 18:11:26 +02:00
// H E L P E R S
function example1() {
return html`
2018-10-03 22:27:13 +02:00
<div class="playground__content__urlbar" id="playground-url">
2018-09-27 18:11:26 +02:00
<span>lbry://</span><input id="fetch-claim-uri" placeholder="&thinsp;Enter a LBRY address or select a video below" type="text"/>
<button class="button" data-action="execute claim" type="button">Resolve</button>
</div>
2018-10-03 22:27:13 +02:00
<div class="playground__content__trends" id="playground-loader"></div>
<div id="playground-results"></div>
2018-09-27 18:11:26 +02:00
<script>
2018-10-03 22:27:13 +02:00
document.getElementById("playground-example-description").textContent = document.querySelector("[data-action='playground, example 1']").dataset.description
2018-09-27 18:11:26 +02:00
</script>
`;
}
function navigation() { // TODO: Save tutorial position to localStorage
return dedent`
<li
2018-10-03 22:27:13 +02:00
class="playground__navigation__example"
data-action="playground, example 1"
2018-09-27 18:11:26 +02:00
data-description="In this example, you can see what runs under the hood when selecting content to view in the LBRY app."
data-example="1"
2018-09-27 20:00:34 +02:00
data-success="<strong>Success</strong> You resolved a claim, which is a <em>fancy</em> way of saying you searched for a piece of content and got back all the metadata associated with it (if it exists)."
2018-09-27 18:11:26 +02:00
>
<button type="button">Resolve</button>
<span>Get details of media (aka, "claim" metadata)</span>
</li>
<li
2018-10-03 22:27:13 +02:00
class="playground__navigation__example"
data-action="playground, example 2"
2018-09-27 18:11:26 +02:00
data-description="Sometimes you want to create content, not just consume it. In this example, you can create a meme and upload it to LBRY!"
data-example="2"
2018-09-27 20:00:34 +02:00
data-success="<strong>Meme-a-riffic</strong> You've just contributed to the growing expanse that is the meme industry. Where will your meme go next? YOU DECIDE!"
2018-09-27 18:11:26 +02:00
>
<button type="button">Publish</button>
<span>Create a meme and upload it to the LBRY blockchain</span>
</li>
<li
2018-10-03 22:27:13 +02:00
class="playground__navigation__example"
data-action="playground, example 3"
2018-09-27 18:11:26 +02:00
data-description="In the LBRY app, you can financially support your favorite creators by donating LBRY Coin (LBC). In this example, we are donating LBC in your stead."
data-example="3"
data-success="<strong>Kudos</strong> You've just supported a creator with LBC (or, LBRY credits) with our own stash of LBC (you'd use your own IRL). You're basically saying, 'thanks for this great content, please continue!' and that's awesome. You're awesome."
2018-09-27 18:11:26 +02:00
>
<button type="button">Support</button>
<span>Support creators on LBRY with a tip, on us!</span>
</li>
`;
}