Refactor in progress

This commit is contained in:
ポール ウェッブ committed 2018-08-28 18:57:18 -05:00
1 parent ce86c5b74e
commit b1a5c11ddf
125 files changed
+707 -555

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
{
"presets": [
"@babel/env"
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-export-namespace-from",
"@babel/proposal-function-sent",
"@babel/proposal-json-strings",
"@babel/proposal-numeric-separator",
"@babel/proposal-throw-expressions",
"@babel/syntax-dynamic-import",
"@babel/syntax-import-meta"
],
"ignore": [
"app/dist/*.js"
]
}
+1
View File
@@ -0,0 +1 @@
package-lock=false
Executable
+73
View File
@@ -0,0 +1,73 @@
"use strict";
// P A C K A G E S
import choo from "choo";
import html from "choo/html";
import devtools from "choo-devtools";
import ssr from "choo-ssr";
// V A R I A B L E S
import head from "./components/head";
import wrapper from "./components/wrapper";
// P R O G R A M
function main() {
const app = choo();
if (process.env.NODE_ENV !== "production") app.use(devtools());
const page = view => (
shell(
ssr.head(
head,
ssr.state()
),
ssr.body(wrapper(view))
)
);
app.use(ssr());
app.route("/", page(require("./views/home")));
app.route("/api", page(require("./views/api")));
app.route("/api/*", page(require("./views/api")));
app.route("/*", page(require("./views/redirect")));
return app;
}
if (typeof window !== "undefined") {
const app = main();
app.mount("html");
}
// E X P O R T
module.exports = exports = main;
// H E L P E R
function shell (head, body) {
return (state, emit) => {
const bodyRender = body(state, emit);
const headRender = head(state, emit);
return html`
<!DOCTYPE html>
<html lang="en">
${headRender}
${bodyRender}
</html>
`;
};
}
@@ -4,8 +4,8 @@
// P A C K A G E S
const html = require("choo-async/html");
const local = require("app-root-path").require;
import html from "choo/html";
import { require as local } from "app-root-path";
// V A R I A B L E
@@ -15,7 +15,7 @@ const config = local("/config");
// E X P O R T
module.exports = exports = pagePath => {
export default function (pagePath) {
let githubUrl = `https://github.com/${config.github.repo}/edit/${config.github.branch}`;
switch(pagePath) {
@@ -37,6 +37,11 @@ module.exports = exports = pagePath => {
}
return html`
<a href="${githubUrl}" target="_blank" rel="noopener noreferrer" title="${config.github.linkText}">${config.github.linkText}</a>
<a
href="${githubUrl}"
target="_blank"
rel="noopener noreferrer"
title="${config.github.linkText}"
>${config.github.linkText}</a>
`;
};
}
+26
View File
@@ -0,0 +1,26 @@
"use strict";
// P A C K A G E
import html from "choo/html";
// E X P O R T
export default function () {
return html`
<div id="emailSubscribe" class="newsletter-cta">
<h3 class="newsletter-cta__title">Don't miss a bit - Subscribe for LBRY technical updates</h3>
<div>
<input class="newsletter-cta__input" id="emailAddress" placeholder="you@domain.tld" type="text"/>
<button class="newsletter-cta__submit" data-action="subscribe to newsletter" title="Subscribe to our technical newsletter" type="button">Subscribe</a>
</div>
<p class="newsletter-cta__message" id="emailMessage"></p>
</div>
`;
}
+68
View File
@@ -0,0 +1,68 @@
"use strict";
// P A C K A G E S
import html from "choo/html";
import { require as local } from "app-root-path";
// V A R I A B L E S
import editLink from "./edit-link";
import emailSubscribe from "./email-subscribe";
const config = local("/config");
// E X P O R T
export default function (state) {
return html`
<section class="email-subscribe-container">
${emailSubscribe()}
</section>
<section class="alert" id="alert-beta">
<div class="inner-wrap">
<p><strong>This website is in beta and under heavy development.</strong><br/>All information should be considered incomplete and possibly incorrect and things may not work as expected.</p>
<br/><br/>
<p>Please do not share or link this site publicly while this message is here. This website is open source and you can <a href="https://github.com/lbryio/lbry.tech" target="_blank" rel="noopener noreferrer">contribute to it on Github</a>.</p>
<button id="close-alert">&times;</button>
</div>
</section>
<footer class="footer">
<div class="inner-wrap">
<ul>
<li>
<a href="//lbry.io" title="Rediscover content freedom">← LBRY.io</a> |
${editLink(state.href)}
</li>
<li><a href="/overview" title="LBRY overview">Overview</a></li>
<li><a href="/resources" title="View LBRY resources">Resources</a></li>
<li><a href="/contribute" title="Contribute to LBRY">Contribute</a></li>
<li><a href="/community" title="Interact with LBRY">Community</a></li>
<li><a href="/sitemap" title="">Sitemap</a></li>
</ul>
</div>
</footer>
<script src="/assets/scripts/app.js"></script>
<script>
(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,"script","https://www.google-analytics.com/analytics.js","ga");
ga("create", "${config.ga}", "auto");
ga("send", "pageview");
</script>
`;
}
+90
View File
@@ -0,0 +1,90 @@
"use strict";
// P A C K A G E
import html from "choo/html";
import { require as local } from "app-root-path";
// V A R I A B L E S
const config = local("/config");
let title = "";
// E X P O R T
module.exports = exports = (state, emit) => {
/*
let pageTitle = "";
if (state.route && state.route !== "/" && state.route !== "*") pageTitle = state.route.charAt(0).toUpperCase() + state.route.slice(1);
if (state.params.wildcard) pageTitle = state.params.wildcard.charAt(0).toUpperCase() + state.params.wildcard.slice(1);
if (pageTitle === "Api") pageTitle = "API";
<title>${pageTitle.length ? pageTitle + " | " : ""}${config.meta.title} &middot; ${config.meta.tagline}</title>
*/
if (state.route !== "/" && state.params.wildcard) title = `${state.params.wildcard.capitalize()} ∙ LBRY ∙ ${config.meta.tagline}`;
else title = `LBRY ∙ ${config.meta.tagline}`;
if (state.title !== title) emit(state.events.DOMTITLECHANGE, title);
state.page = state.page || { };
// TODO:
// - Support custom metadata (descriptions and whatnot)
// - Update og:url with current URL
return html`
<meta charset="utf-8"/>
<title>${title}</title>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="author" content="${config.meta.title}"/>
<meta name="description" content="${config.meta.description}"/>
<meta name="keywords" content=""/>
<meta name="title" content="${config.meta.title}"/>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
<!--/ Open Graph /-->
<meta property="og:type" content="website"/>
<meta property="og:title" content="${config.meta.title}"/>
<meta property="og:url" content=""/>
<meta property="og:site_name" content="${config.meta.title}"/>
<meta property="og:image" content="/assets/images/apple-touch-icon.png"/>
<meta property="og:locale" content="en_US"/>
<!--/ Social/App Stuff /-->
<meta name="apple-mobile-web-app-title" content="${config.meta.title}"/>
<meta name="application-name" content="${config.meta.title}"/>
<meta name="msapplication-TileColor" content="${config.meta.color}"/>
<meta name="msapplication-TileImage" content="/assets/images/apple-touch-icon.png"/>
<meta name="theme-color" content="${config.meta.color}"/>
<link rel="apple-touch-icon" href="/assets/images/apple-touch-icon.png"/>
<link rel="icon" href="/assets/images/favicon.svg" type="image/svg+xml"/>
<link rel="mask-icon" href="/assets/images/favicon.svg" color="${config.meta.color}"/>
<link rel="shortcut icon" href="/assets/favicon.ico"/>
<link href="/assets/bundle.css" rel="stylesheet"/>
<!--/ <script src="/assets/bundle.js"></script> /-->
<script src="/assets/scripts/vendor/zepto.js"></script>
<script>const ws = new WebSocket(location.origin.replace(/^http/, "ws"));</script>
<script src="/assets/scripts/sockets.js"></script>
`;
// state.route === "api" || state.route === "api/*" ? <script src="/assets/scripts/plugins/jets.js"></script> : ""
};
// H E L P E R
String.prototype.capitalize = function () {
return this.charAt(0).toUpperCase() + this.slice(1);
};
+88
View File
@@ -0,0 +1,88 @@
"use strict";
// P A C K A G E S
import html from "choo/html";
import Nanocomponent from "nanocomponent";
import xtend from "xtend";
// E X P O R T
export default class Navigation extends Nanocomponent {
constructor() {
super();
this.state = {
active: true,
links: [
{
name: "LBRY.io",
title: "Escape the techno scene",
url: "https://lbry.io"
},
{
name: "Overview",
title: "LBRY overview",
url: "/overview"
},
{
name: "Resources",
title: "View LBRY resources",
url: "/resources"
},
{
name: "Contribute",
title: "Contribute to LBRY",
url: "/contribute"
},
{
name: "Build",
title: "View LBRY resources",
url: "/build"
},
{
name: "Community",
title: "Interact with LBRY",
url: "/community"
}
]
};
this.renderLink = this.renderLink.bind(this);
}
createElement(props) {
this.state = xtend(this.state, props);
return html`
<nav class="navigation">
<div class="inner-wrap">
<a class="navigation__item logo" href="/" title="LBRY homepage">Home</a>
${this.state.links.map(this.renderLink)}
</div>
</nav>
`;
}
renderLink(props, i, arr) { // eslint-disable-line
let activeClass;
if (this.state.href === "/" && props.url === "/") {
activeClass = true;
} else if (props.url !== "/" && this.state.href.indexOf(props.url) >= 0) {
activeClass = true;
}
return html`
<a
class="navigation__item${activeClass ? " active" : ""}"
href="${props.url}"
title="${props.title}"
>${props.name}</a>
`;
}
}
+34
View File
@@ -0,0 +1,34 @@
"use strict";
// P A C K A G E
import html from "choo/html";
// V A R I A B L E S
import footer from "./footer";
import Navigation from "./navigation";
const navigation = new Navigation();
// E X P O R T
module.exports = exports = children => (state, emit) => {
return html`
<main>
<noscript>
<p>LBRY is quite fancy and relies on a bit of JavaScript to do these fancy things.</p>
<p>Please enable it, if you can.</p>
</noscript>
${navigation.render({ href: state.href || "/" })}
<aside class="flashes" id="flash-container"></aside>
${children(state, emit)}
${footer(state, emit)}
</main>
`;
};
File renamed without changes.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

+1
View File
@@ -0,0 +1 @@
html{box-sizing:border-box;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}*,*::before,*::after{margin:0;padding:0;box-sizing:inherit;outline:0 !important}a,area,button,[role=button],input,label,select,summary,textarea{touch-action:manipulation}a{color:currentColor;text-decoration:none}*[readonly]{cursor:not-allowed}textarea[disabled]{resize:none}textarea:not[disabled]{resize:vertical}button:not(:disabled){cursor:pointer}button,input,select,textarea{border:none;border-radius:0;font-family:inherit;font-size:inherit;-moz-appearance:none;-webkit-appearance:none}button:focus,input:focus,select:focus,textarea:focus{outline:none}input,select,textarea{background-color:transparent}[type=button],[type=submit]{cursor:pointer}.left{float:left}.right{float:right}iframe{border:0}img{font-size:0;max-width:100%}img::after{width:100%;height:100%;top:-100%;left:0;background-color:#fcfcfc;background-image:url("/assets/media/images/missing.png");background-size:cover;box-shadow:0 0 1px 0 rgba(34,34,34,.3);content:"";display:block;position:relative}@media print{pre,blockquote{border:1px solid #999 !important;page-break-inside:avoid !important}tr,img{page-break-inside:avoid !important}img{max-width:100% !important}@page{margin:.5cm !important}p,h2,h3{orphans:3 !important;widows:3 !important}h2,h3{page-break-after:avoid !important}thead{display:table-header-group !important}*{background:transparent !important;color:#000 !important;text-shadow:none !important;filter:none !important}p a[href]::after{content:" (" attr(href) ")" !important}p abbr[title]::after{content:" (" attr(title) ")" !important}p a[href^="javascript:"]::after,p a[href^="#"]::after{content:"" !important}p a,p abbr{word-wrap:break-word !important;text-decoration:underline !important}}input::-moz-focus-inner,button::-moz-focus-inner{display:none}input:-webkit-autofill{-webkit-box-shadow:0 0 0 1000px #fcfcfc inset !important}input:-webkit-autofill:focus{outline:none}.clear{clear:both;content:"";display:block}.hide-text{border:0;color:transparent;font:0/0 a;text-shadow:none}.__button-base,.__button-gray,.__button-white,.__button-black,.home .intro .cta,.home .docs .cta,.home .contribute .cta,.home .develop .cta,.home .community .cta,.home .features .home__feature__cta,.__button-plain,.__button-basic,.newsletter-cta__submit{border:1px solid;font-size:1rem;letter-spacing:.025rem;position:relative;transition:all .2s}.__button-plain{background-color:transparent;border-color:transparent}.__button-plain::after{width:100%;height:2px;bottom:2px;left:0;content:"";display:block;transition:background-color .2s}.__button-plain:not(:hover)::after{background-color:transparent}.__button-plain:hover::after{background-color:#222}.__button-black:not(:hover),.home .intro .cta:not(:hover),.home .docs .cta:not(:hover),.home .contribute .cta:not(:hover),.home .develop .cta:not(:hover),.home .community .cta:not(:hover),.home .features .home__feature__cta:not(:hover){background-color:#222;border-color:#fcfcfc;box-shadow:2px 2px 0 #fcfcfc;color:#fcfcfc}.__button-black:hover,.home .intro .cta:hover,.home .docs .cta:hover,.home .contribute .cta:hover,.home .develop .cta:hover,.home .community .cta:hover,.home .features .home__feature__cta:hover{background-color:#fcfcfc;border-color:#222;box-shadow:2px 2px 0 #222;color:inherit}.__button-white:not(:hover){background-color:#fcfcfc;border-color:transparent;box-shadow:2px 2px 0 #222;color:inherit}.__button-white:hover{background-color:#222;border-color:#fcfcfc;box-shadow:2px 2px 0 #fcfcfc;color:#fcfcfc}.__button-gray{background-color:#fcfcfc}.__button-gray:not(:hover){border-color:transparent;box-shadow:2px 2px 0 #222}.__button-gray:hover{border-color:#3abf7d;box-shadow:2px 2px 0 #3abf7d;color:#3abf7d}.__button-padding-horizontal,.newsletter-cta__input,.newsletter-cta__submit,.__button-black,.home .intro .cta,.home .docs .cta,.home .contribute .cta,.home .develop .cta,.home .community .cta,.home .features .home__feature__cta,.__button-white,.__button-gray{padding-right:1rem;padding-left:1rem}.__button-padding-vertical,.newsletter-cta__submit,.__button-black,.home .intro .cta,.home .docs .cta,.home .contribute .cta,.home .develop .cta,.home .community .cta,.home .features .home__feature__cta,.__button-white,.__button-gray{padding-top:.5rem;padding-bottom:.5rem}.__loading,.tour__content__trends:empty,.tour__content .loader{width:100%;height:10rem;position:relative}.__loading::before,.tour__content__trends:empty::before,.tour__content .loader::before{width:4rem;height:4rem;top:2rem;left:calc(50% - 2rem);animation:spin 2s linear infinite;border-radius:50%;border-style:solid;border-top-color:#3abf7d;border-width:6px;content:"";position:absolute}.__loading::after,.tour__content__trends:empty::after,.tour__content .loader::after{top:7rem;left:0;font-size:1rem;position:absolute;text-align:center;width:100%}@font-face{font-family:"Karla";font-style:normal;font-weight:400;src:local("Karla Regular"),Line truncated
+1
View File
@@ -0,0 +1 @@
{"version":3,"sourceRoot":"","sources":["../sass/init/_base.scss","../sass/init/_colors.scss","../sass/init/_mixins.scss","../sass/init/_extends.scss","../sass/type/_karla.scss","../sass/partials/_animation.scss","../sass/partials/_ecosystem.scss","../sass/partials/_email-subscribe.scss","../sass/partials/_feature-links.scss","../sass/partials/_flash.scss","../sass/partials/_footer.scss","../sass/partials/_github-feed.scss","../sass/partials/_glossary.scss","../sass/partials/_navigation.scss","../sass/partials/_mission-statement.scss","../sass/partials/_modal.scss","../sass/_layout.scss","../sass/pages/_api.scss","../sass/pages/_contributing.scss","../sass/pages/_documentation.scss","../sass/pages/_home.scss","../sass/pages/_page.scss","../sass/pages/_tour.scss","../sass/plugins/_prism.scss"],"names":[],"mappings":"AAAA,KACE,sBACA,kCAEA,kCACA,mCAGF,qBAGE,mBAEA,mBACA,qBAGF,gEAQE,0BAGF,EACE,mBACA,qBAGF,YACE,mBAIA,mBACE,YAGF,uBACE,gBAKF,sBACE,eAIJ,6BAIE,YACA,gBACA,oBACA,kBAEA,qBACA,wBAEA,qDACE,aAIJ,sBAGE,6BAGF,4BAEE,eAGF,MACE,WAGF,OACE,YAGF,OACE,SAGF,IACE,YACA,eAEA,WACE,uBACA,iBAEA,iBCrGM,QDsGN,yDACA,sBACA,uCACA,WACA,cACA,kBAMJ,aAEE,mFACA,0CACA,8BACA,6BACA,iDACA,wCACA,4CAGA,6GAGA,wDACA,6DACA,4EACA,iFAKF,iDAEE,aAIF,uBACE,yDAEA,6BACE,aE7DJ,OA7DE,WACA,WACA,cA+DF,WA3DE,SACA,kBACA,WACA,iBCTF,8PACE,iBACA,eACA,uBACA,kBACA,mBAOF,gBAEE,6BACA,yBAEA,uBACE,sBACA,kBAEA,WACA,cACA,gCAGF,mCACE,6BAGF,6BACE,iBFrDM,KE8DR,4OACE,iBF/DM,KEgEN,aFjEM,QEkEN,6BACA,MFnEM,QEsER,kMACE,iBFvEM,QEwEN,aFvEM,KEwEN,0BACA,cASF,4BACE,iBFpFM,QEqFN,yBACA,0BACA,cAGF,sBACE,iBF1FM,KE2FN,aF5FM,QE6FN,6BACA,MF9FM,QEkGV,eAKE,iBFvGQ,QEyGR,2BACE,yBACA,0BAGF,qBACE,aFxGM,QEyGN,6BACA,MF1GM,QE8GV,mQACE,mBACA,kBAGF,0OACE,kBACA,qBAaF,+DACE,wBACA,kBAEA,uFACE,uBACA,+BAEA,kCACA,kBACA,mBACA,iBF7IM,QE8IN,iBACA,WACA,kBAGF,oFACE,gBAEA,eACA,kBACA,kBACA,WC9JJ,WACE,oBACA,kBACA,gBACA,qGAGF,WACE,oBACA,kBACA,gBACA,qGAGF,WACE,oBACA,kBACA,gBACA,kGCpBF,gBACE,0BACA,4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qCV,qBACE,iBP7CQ,QO8CR,sCACA,yCACA,kBACA,2BACA,eACA,eACA,gBACA,qBACA,qBACA,kBAGF,0BACE,oCACA,mBAEA,iBPvDQ,QOwDR,4BACA,2BACA,sBACA,gBACA,kBACA,UAEA,8BACE,uBAEA,iBACA,uBC1EJ,SACE,iBAEA,kBACA,WACA,UAGF,OACE,iBACA,kBACA,eACA,iBACA,mBACA,kBACA,WAEA,4CACE,yBACA,aRZM,QQeR,oBACE,4BAGF,cACE,+BACA,4BAGF,aACE,yBACA,aRnBM,QQsBR,YACE,yBACA,aRnCM,QQsCR,eACE,yBACA,aRvCM,QSJV,QACE,sBACA,4BACA,eACA,yCACA,uCACA,kBAEA,yBACE,gBACE,uBACA,iBAEA,6EACA,WACA,kBACA,WAKF,yBADF,4BAEI,cACA,yBACA,mBACA,YAIJ,WACE,qBACA,iBACA,oBAEA,yBALF,WAMI,oBACA,aACA,oBAGF,cACE,oBACA,mBACA,sBAEA,yBALF,cAMI,qBACA,+BACA,sFAEA,2BACE,mBAIJ,4BACE,OAKN,UACE,qBAEA,sBACE,MTjEI,QSoEN,gBACE,MT9DI,QUPV,aACE,2CACA,yCACA,gBACA,iBACA,kBAEA,0BAPF,aAQI,oBAGF,iDAXF,aAYI,qBAGF,0BAfF,aAgBI,oBACA,kBACA,mBAGF,0BArBF,aAsBI,iBACA,qBAGF,gDA1BF,aA2BI,mBACA,mBAGF,yBA/BF,aAgCI,mBACA,mBAGF,yBApCF,aAqCI,gBACA,kBACA,oBLine truncated
View File
File renamed without changes.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File
File renamed without changes.

Before

Width:  |  Height:  |  Size: 414 B

After

Width:  |  Height:  |  Size: 414 B

View File
File renamed without changes.
File renamed without changes.

Before

Width:  |  Height:  |  Size: 445 KiB

After

Width:  |  Height:  |  Size: 445 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 91 B

After

Width:  |  Height:  |  Size: 91 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 562 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 288 B

After

Width:  |  Height:  |  Size: 288 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 389 B

After

Width:  |  Height:  |  Size: 389 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 154 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 745 B

After

Width:  |  Height:  |  Size: 745 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 411 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 426 B

After

Width:  |  Height:  |  Size: 426 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 983 B

After

Width:  |  Height:  |  Size: 983 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 934 B

After

Width:  |  Height:  |  Size: 934 B

View File
File renamed without changes.
File renamed without changes.
+2 -2
View File
@@ -1,8 +1,8 @@
/* global $, ws */ "use strict";
/* global $, log, ws */ "use strict";
const log = console.log; // eslint-disable-line
// const log = console.log; // eslint-disable-line
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -6,17 +6,17 @@
const local = require("app-root-path").require;
const prism = require("prismjs");
const raw = require("nanohtml/raw");
const raw = require("choo/html/raw");
const request = require("request-promise-native");
const stringifyObject = require("stringify-object");
// V A R I A B L E S
const randomString = local("/helpers/random-string");
const randomString = local("/app/helpers/random-string");
const loadLanguages = require("prismjs/components/");
const logSlackError = local("/helpers/slack");
const publishMeme = local("/helpers/publish-meme");
const uploadImage = local("/helpers/upload-image");
const logSlackError = local("/app/helpers/slack");
const publishMeme = local("/app/helpers/publish-meme");
const uploadImage = local("/app/helpers/upload-image");
loadLanguages(["json"]);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Executable
+4
View File
@@ -0,0 +1,4 @@
// "use strict"; require("make-promises-safe"); const app = require("./server.js"); // eslint-disable-line
"use strict"; require("@babel/register"); require("@babel/polyfill");
module.exports = exports = require("./client.js");
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -27,7 +27,8 @@
.hero {
align-items: center;
background-color: $black;
background-image: url("/assets/media/svg/text-logo--white.svg");
// background-image: url("/assets/media/svg/text-logo--white.svg");
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 800 300' xmlns='http://www.w3.org/2000/svg'%3E %3Cpath fill='%23fcfcfc' d='M567.328, 43.44l72.864, 130.464l0, 82.656l46.944, 0l0, -82.656l72.576, -130.464l-50.688, 0l-44.64, 84.672l-44.64, -84.672l-52.416, 0Z'/%3E %3Cpath fill='%23fcfcfc' d='M520.672, 173.616c22.464, -10.656 34.848, -31.968 34.848, -61.056c0, -44.64 -26.496, -68.832 -81.216, -69.12l-82.368, 0l0, 213.12l46.656, 0l0, -75.168l35.136, 0l31.392, 75.168l52.416, 0l-36.864, -82.944Zm-46.656, -32.544l-35.424, 0l0, -56.448l35.712, 0c23.904, 0 31.968, 12.96 31.968, 27.936c0, 15.264 -8.352, 28.512 -32.256, 28.512Z'/%3E %3Cpath fill='%23fcfcfc' d='M328.864, 150.576c15.552, -7.2 28.512, -23.04 28.512, -48.096c0, -34.848 -25.344, -58.464 -67.104, -58.464l-43.776, 0l-46.368, 0l0, 212.544l89.568, 0c42.048, 0 70.272, -19.584 70.272, -55.872c0, -26.784 -14.976, -42.048 -31.104, -50.112Zm-43.776, -67.104c19.008, 0 25.92, 14.112 25.92, 25.344c0, 11.808 -7.2, 24.768 -25.92, 24.768l-38.592, 0l0, -50.112l38.592, 0Zm2.592, 133.632l-41.184, 0l0, -49.248l41.184, 0c15.264, 0 26.208, 10.08 26.208, 25.056c0, 14.976 -10.656, 24.192 -26.208, 24.192Z'/%3E %3Cpath fill='%23fcfcfc' d='M87.52, 214.8l0, -171.36l-47.232, 0l0, 213.12l130.752, 0l0, -41.76l-83.52, 0Z'/%3E %3C/svg%3E");
background-position: center;
background-repeat: no-repeat;
display: flex;
@@ -345,7 +345,8 @@
.page__header {
background-image: url("/assets/media/images/background-a.jpg");
// background-image: url("/assets/media/images/background-a.jpg");
background-color: $black;
}
.page__content {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -24,7 +24,7 @@
padding-bottom: 2rem;
}
@media (min-width: 901px) {
@media (min-width: 901px) and (max-width: 1000px) {
padding-right: 1rem;
padding-left: 1rem;
}
File renamed without changes.
File renamed without changes.
@@ -56,7 +56,8 @@
@include hide-text;
width: 10rem; height: 3rem;
background-image: url("/assets/media/svg/logo.svg");
// background-image: url("/assets/media/svg/logo.svg");
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 320 250' xmlns='http://www.w3.org/2000/svg'%3E %3Cpath fill='%23222' d='M296.05, 85.9l0, 14.1l-138.8, 85.3l-104.6, -51.3l0.2, -7.9l104, 51.2l132.2, -81.2l0, -5.8l-124.8, -60.2l-139.2, 86.1l0, 38.5l131.8, 65.2l137.6, -84.4l3.9, 6l-141.1, 86.4l-139.2, -68.8l0, -46.8l145.8, -90.2l132.2, 63.8Z'/%3E %3Cpath d='M294.25, 150.9l2, -12.6l-12.2, -2.1l0.8, -4.9l17.1, 2.9l-2.8, 17.5l-4.9, -0.8Z'/%3E %3C/svg%3E");
background-repeat: no-repeat;
background-size: contain;
flex: 1;
File renamed without changes.
File renamed without changes.
+215
View File
@@ -0,0 +1,215 @@
"use strict";
// P A C K A G E S
import dedent from "dedent";
import fs from "graceful-fs";
import html from "choo/html";
import raw from "choo/html/raw";
const fetch = require("make-fetch-happen").defaults({ cacheManager: "./cache" });
// V A R I A B L E
const apiScripts = "<script>" + fs.readFileSync("./app/views/partials/api-scripts.js", "utf-8") + "</script>";
// E X P O R T
module.exports = exports = state => {
return generate(state.params.wildcard).then(response => {
// console.log(response);
return html`${response}`;
});
// generate(state.params.wildcard, response => html`${response}`);
};
/*
module.exports = exports = () => state => {
console.log(state);
parseApiFile(state.params.wildcard).then(response => {
return html`
<div class="__slate">
<aside class="api__toc">
<div class="api__toc__search">
<input class="api__toc__search__field" id="input-search" placeholder="Search" type="search"/>
<div class="api__toc__search__clear" id="clear-search" title="Clear search query">&times;</div>
<ul class="api__toc__search__results"></ul>
</div>
<ul class="api__toc__items" id="toc" role="navigation">${raw(createApiSidebar(response).join(""))}</ul>
</aside>
<section class="api__content" id="toc-content">${raw(createApiContent(response).join(""))}</section>
</div>
${raw(apiScripts)}
`;
});
};
*/
function generate(stuff, callback) {
/*
parseApiFile(stuff).then(response => {
const test = `
<div class="__slate">
<aside class="api__toc">
<div class="api__toc__search">
<input class="api__toc__search__field" id="input-search" placeholder="Search" type="search"/>
<div class="api__toc__search__clear" id="clear-search" title="Clear search query">&times;</div>
<ul class="api__toc__search__results"></ul>
</div>
<ul class="api__toc__items" id="toc" role="navigation">${raw(createApiSidebar(response).join(""))}</ul>
</aside>
<section class="api__content" id="toc-content">${raw(createApiContent(response).join(""))}</section>
</div>
${raw(apiScripts)}
`;
return callback(test);
});
*/
return new Promise((resolve, reject) => { // eslint-disable-line
parseApiFile(stuff).then(response => {
const test = `
<div class="__slate">
<aside class="api__toc">
<div class="api__toc__search">
<input class="api__toc__search__field" id="input-search" placeholder="Search" type="search"/>
<div class="api__toc__search__clear" id="clear-search" title="Clear search query">&times;</div>
<ul class="api__toc__search__results"></ul>
</div>
<ul class="api__toc__items" id="toc" role="navigation">${raw(createApiSidebar(response).join(""))}</ul>
</aside>
<section class="api__content" id="toc-content">${raw(createApiContent(response).join(""))}</section>
</div>
${raw(apiScripts)}
`;
return resolve(test);
});
});
/*
Promise.all([parseApiFile(stuff)]).then(response => {
response = response[0];
const test = `
<div class="__slate">
<aside class="api__toc">
<div class="api__toc__search">
<input class="api__toc__search__field" id="input-search" placeholder="Search" type="search"/>
<div class="api__toc__search__clear" id="clear-search" title="Clear search query">&times;</div>
<ul class="api__toc__search__results"></ul>
</div>
<ul class="api__toc__items" id="toc" role="navigation">${raw(createApiSidebar(response).join(""))}</ul>
</aside>
<section class="api__content" id="toc-content">${raw(createApiContent(response).join(""))}</section>
</div>
${raw(apiScripts)}
`;
return callback(test);
});
*/
}
// H E L P E R S
function createApiContent(apiDetails) {
const apiContent = [];
for (const apiDetail of apiDetails) {
let apiDetailsReturns = "";
if (apiDetail.returns) apiDetailsReturns = JSON.parse(JSON.stringify(apiDetail.returns));
apiContent.push(`
<div class="api__content__body">
<h2 id="${apiDetail.name}">${apiDetail.name}</h2>
<p>${apiDetail.description}</p>
${apiDetail.arguments.length ? `<h3>Arguments</h3><ul class="api__content__body__arguments">${renderArguments(apiDetail.arguments).join("")}</ul>` : ""}
<h3>Returns</h3>
<pre><code>${dedent(apiDetailsReturns)}</code></pre>
</div>
<div class="api__content__example">
<pre><code>// example(s) for ${apiDetail.name} to come later</code></pre>
</div>
`);
}
return apiContent;
}
function createApiSidebar(apiDetails) {
const apiSidebar = [];
for (const apiDetail of apiDetails) {
apiSidebar.push(`
<li class="api__toc__item">
<a href="#${apiDetail.name}" title="Go to ${apiDetail.name} section">
${apiDetail.name}
</a>
</li>
`);
}
return apiSidebar;
}
function parseApiFile(urlSlug) {
let apiFileLink;
if (!urlSlug || urlSlug === "api" || urlSlug === "protocol") apiFileLink = process.env.NODE_ENV === "development" ?
"https://rawgit.com/lbryio/lbry/master/docs/api.json" :
"https://cdn.rawgit.com/lbryio/lbry/5b3103e4/docs/api.json"
;
if (urlSlug === "blockchain") apiFileLink = process.env.NODE_ENV === "development" ?
"https://rawgit.com/lbryio/lbrycrd/add_api_docs_scripts/contrib/devtools/generated/api_v1.json" :
"https://cdn.rawgit.com/lbryio/lbrycrd/add_api_docs_scripts/contrib/devtools/generated/api_v1.json"
;
if (!apiFileLink) return; // TODO: Error handling
return fetch(apiFileLink).then(() => fetch(apiFileLink, {
cache: "no-cache" // forces a conditional request
})).then(res => res.json().then(body => body)); // res.status 304 = cache validated
}
function renderArguments(args) {
const argumentContent = [];
for (const arg of args) {
argumentContent.push(`
<li class="api__content__body__argument">
<div class="left">
<strong>${arg.name}</strong><br/>
${arg.is_required === true ? "" : "<span>optional</span>" }<span>${arg.type}</span>
</div>
<div class="right">${typeof arg.description === "string" ? arg.description.replace(/</g, "&lt;").replace(/>/g, "&gt;") : ""}</div>
</li>
`);
}
return argumentContent;
}
+2 -2
View File
@@ -4,13 +4,13 @@
// P A C K A G E
const html = require("choo/html");
import html from "choo/html";
// E X P O R T
module.exports = exports = () => async () => html`
module.exports = exports = () => html`
<div>
<section class="hero">
<div>
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 125 files, more files were not shown because too many files have changed in this diff. Show more