2018-07-12 17:21:42 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-30 00:29:14 +01:00
|
|
|
// I M P O R T
|
2018-07-12 17:21:42 +02:00
|
|
|
|
2018-08-29 01:57:18 +02:00
|
|
|
import html from "choo/html";
|
2018-07-12 17:21:42 +02:00
|
|
|
|
2018-10-10 19:56:35 +02:00
|
|
|
// U T I L
|
2018-07-12 17:21:42 +02:00
|
|
|
|
2019-04-12 22:17:39 +02:00
|
|
|
import config from "~root/config";
|
2018-07-12 17:21:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-13 23:58:24 +02:00
|
|
|
// E X P O R T
|
2018-07-12 17:21:42 +02:00
|
|
|
|
2018-10-03 22:27:13 +02:00
|
|
|
export default pagePath => {
|
2018-07-13 20:22:46 +02:00
|
|
|
let githubUrl = `https://github.com/${config.github.repo}/edit/${config.github.branch}`;
|
2018-07-12 17:21:42 +02:00
|
|
|
|
2018-07-13 20:22:46 +02:00
|
|
|
switch(pagePath) {
|
|
|
|
case "":
|
2018-09-24 20:46:01 +02:00
|
|
|
githubUrl = `${githubUrl}/app/views/home.js`;
|
2018-07-13 20:22:46 +02:00
|
|
|
break;
|
|
|
|
|
2018-10-03 22:27:13 +02:00
|
|
|
case "/api":
|
|
|
|
githubUrl = `${githubUrl}/app/views/api.js`;
|
2018-07-13 20:22:46 +02:00
|
|
|
break;
|
|
|
|
|
2018-10-03 22:27:13 +02:00
|
|
|
case "/api/blockchain":
|
|
|
|
githubUrl = "https://github.com/lbryio/lbrycrd/blob/add_api_docs_scripts/contrib/devtools/generated/api_v1.json";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "/api/sdk":
|
2019-06-21 05:43:42 +02:00
|
|
|
githubUrl = "https://github.com/lbryio/lbry-sdk/blob/master/lbry/docs/api.json";
|
2018-07-26 00:04:21 +02:00
|
|
|
break;
|
|
|
|
|
2018-07-13 20:22:46 +02:00
|
|
|
default:
|
|
|
|
githubUrl = `${githubUrl}/documents${pagePath}.md`;
|
|
|
|
break;
|
|
|
|
}
|
2018-07-12 17:21:42 +02:00
|
|
|
|
|
|
|
return html`
|
2018-08-29 01:57:18 +02:00
|
|
|
<a
|
|
|
|
href="${githubUrl}"
|
|
|
|
rel="noopener noreferrer"
|
2018-10-03 22:27:13 +02:00
|
|
|
target="_blank"
|
2018-08-29 01:57:18 +02:00
|
|
|
title="${config.github.linkText}"
|
|
|
|
>${config.github.linkText}</a>
|
2018-07-12 17:21:42 +02:00
|
|
|
`;
|
2018-10-03 22:27:13 +02:00
|
|
|
};
|