mirror of
https://github.com/pomber/git-history.git
synced 2024-11-22 23:13:20 +03:00
commit
e137aac9fa
@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<link rel="preconnect" href="https://api.github.com/" crossorigin />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
||||
|
@ -1,8 +1,11 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import History from "./history";
|
||||
|
||||
function App({ commits }) {
|
||||
return <History commits={commits} />;
|
||||
}
|
||||
|
||||
export default App;
|
||||
export function render(commits, root) {
|
||||
ReactDOM.render(<App commits={commits} />, root);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
color: rgb(214, 222, 235, 0.8);
|
||||
padding: 6px;
|
||||
min-width: 500px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.comment-box:after,
|
||||
.comment-box:before {
|
||||
|
11
src/index.js
11
src/index.js
@ -1,6 +1,3 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import App from "./app";
|
||||
import { getHistory } from "./github";
|
||||
|
||||
function getParams() {
|
||||
@ -24,18 +21,18 @@ const [repo, sha, path] = getParams();
|
||||
|
||||
const root = document.getElementById("root");
|
||||
const message = document.getElementById("message");
|
||||
|
||||
if (!repo) {
|
||||
// show docs
|
||||
message.innerHTML = `<p>URL should be something like https://github-history.netlify.com/user/repo/commits/master/path/to/file.js</p>`;
|
||||
} else {
|
||||
// show loading
|
||||
|
||||
message.innerHTML = `<p>Loading <strong>${repo}</strong> <strong>${path}</strong> history...</p>`;
|
||||
document.title = `GitHub History - ${path.split("/").pop()}`;
|
||||
|
||||
getHistory(repo, sha, path)
|
||||
.then(commits => {
|
||||
ReactDOM.render(<App commits={commits} />, root);
|
||||
Promise.all([getHistory(repo, sha, path), import("./app")])
|
||||
.then(([commits, app]) => {
|
||||
app.render(commits, root);
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.status === 403) {
|
||||
|
Loading…
Reference in New Issue
Block a user