Skip to content

Commit

Permalink
Rename and remove files
Browse files Browse the repository at this point in the history
  • Loading branch information
pomber committed Feb 4, 2019
1 parent a26d2d6 commit f9f2bab
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 193 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<div id="root">Loading...</div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
4 changes: 2 additions & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "Github History",
"name": "Github History",
"icons": [
{
"src": "favicon.ico",
Expand Down
File renamed without changes.
32 changes: 0 additions & 32 deletions src/App.css

This file was deleted.

9 changes: 0 additions & 9 deletions src/App.test.js

This file was deleted.

1 change: 0 additions & 1 deletion src/App.js → src/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";
import "./App.css";

function App({ commits }) {
return <pre>{JSON.stringify(commits, null, 2)}</pre>;
Expand Down
11 changes: 6 additions & 5 deletions src/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ async function getContent(repo, sha, path) {
);
const contentJson = await contentResponse.json();
const content = window.atob(contentJson.content);
return content;
return { content, url: contentJson.html_url };
}

export async function getHistory(repo, sha, path, top = 10) {
Expand All @@ -14,19 +14,20 @@ export async function getHistory(repo, sha, path, top = 10) {
const commitsJson = await commitsResponse.json();
const commits = commitsJson.map(commit => ({
sha: commit.sha,
date: commit.author.date,
date: new Date(commit.commit.author.date),
author: {
// or commiter?
login: commit.author.login,
avatar: commit.author.avatar_url
},
url: commit.html_url,
commitUrl: commit.html_url,
message: commit.commit.message
}));

await Promise.all(
commits.slice(0, top).map(async commit => {
commit.content = await getContent(repo, commit.sha, path);
const info = await getContent(repo, commit.sha, path);
commit.content = info.content;
commit.fileUrl = info.url;
})
);

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import App from "./app";
import { getHistory } from "./github";

const repo = "pomber/didact";
Expand Down
7 changes: 0 additions & 7 deletions src/logo.svg

This file was deleted.

135 changes: 0 additions & 135 deletions src/serviceWorker.js

This file was deleted.

0 comments on commit f9f2bab

Please sign in to comment.