lbry.tech/app/components/playground.js

81 lines
2.9 KiB
JavaScript
Raw Permalink Normal View History

2018-09-27 18:11:26 +02:00
"use strict";
2018-11-30 21:46:22 +01:00
// I M P O R T S
2018-09-27 18:11:26 +02:00
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">
2018-12-05 00:12:39 +01:00
<ul class="playground-navigation">
2018-10-03 22:27:13 +02:00
${raw(navigation())}
</ul>
<p class="playground__description" id="playground-example-description"></p>
2018-12-05 00:12:39 +01:00
<section class="playground-content">${raw(example1())}</section>
2018-10-03 22:27:13 +02:00
</section>
`;
2018-09-27 18:11:26 +02:00
// H E L P E R S
function example1() {
return html`
<input-submit 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>
</input-submit>
2018-09-27 18:11:26 +02:00
2018-12-05 00:12:39 +01:00
<div class="playground-content__trends" id="playground-loader"></div>
2018-10-03 22:27:13 +02:00
<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>
`;
}
2019-02-21 20:28:09 +01:00
function navigation() {
2018-09-27 18:11:26 +02:00
return dedent`
<li
2018-12-05 00:12:39 +01:00
class="playground-navigation__example"
2018-10-03 22:27:13 +02:00
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-12-05 00:12:39 +01:00
class="playground-navigation__example"
2018-10-03 22:27:13 +02:00
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-12-05 00:12:39 +01:00
class="playground-navigation__example"
2018-10-03 22:27:13 +02:00
data-action="playground, example 3"
data-description="In the LBRY app, you can financially support your favorite creators by donating LBRY Credits (LBC). In this example, we are donating LBC in your stead."
2018-09-27 18:11:26 +02:00
data-example="3"
data-success="<strong>Kudos</strong> You've just supported a creator with LBC (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>
`;
}