Commit Graph

18 Commits

Author SHA1 Message Date
Dandelion Mané de359dbaa4
Frontend visual cleanup (#21)
* Use font roboto

* Change title.

* Add grid gap

* Restyle app; blue header, and css->inline.

* Further visual cleanup.

- Apply consistent formatting to the two plugin panes.
- Add scroll to the User Explorer.
- Both have white backgrounds with centered titles.
2018-02-18 02:00:11 -08:00
Dandelion Mané 167289a75a
Set up prettier as an autoformatter (#18)
Setup prettier precommit, with yarn prettify to reformat.

- Prettier runs as a precommit hook and fails if code is improperly formatted.
- Run `yarn prettify` to reformat the project.
2018-02-18 01:59:28 -08:00
William Chargin 5744d3c860
Autogenerate PropTypes from Flow types (#20)
Summary:
Closes #17; see discussion there.

This commit uses the `babel-plugin-flow-react-proptypes` package to
automatically create PropType definitions from components that are typed
with Flow. It simultaneously updates all of our existing components to
be typed with Flow. As a result, we have both static and dynamic type
checking.

Test Plan:
Note that `yarn test` and `yarn flow` report no errors, and that there
are no prop validation errors at runtime with `yarn start`.

Then, apply the following patch:
```diff
diff --git a/explorer/src/UserExplorer.js b/explorer/src/UserExplorer.js
index bb574cd..636a10d 100644
--- a/explorer/src/UserExplorer.js
+++ b/explorer/src/UserExplorer.js
@@ -18,7 +18,7 @@ export class UserExplorer extends Component<{
         .sort((a,b) => b[1] - a[1]);
     const entries = sortedUserWeightTuples.map(authorWeight => {
       const [author, weight] = authorWeight;
-      return <UserEntry userId={author} weight={weight} key={author}/>
+      return <UserEntry userId={55} weight={weight} key={author}/>
     });
     return <div className="user-explorer">
       <h3> User Explorer </h3>
```
Note that `yarn test` fails (the `App.test.js` E2E rendering test),
`yarn flow` fails, and there is a runtime prop validation error.

wchargin-branch: autogenerate-proptypes
2018-02-17 13:30:16 -08:00
William Chargin ee59eb9b30
Eject from create-react-app (#19)
Summary:
This commit was created by performing the following steps:
  - `rm -r node_modules`
  - `yarn install`
  - `yarn eject`
  - `rm -r node_modules`
  - `yarn install`
on an environment wit Node v6.11.1.

The final `rm -r node_modules && yarn install` ensures that the
`yarn.lock` file is updated accordingly.

Test Plan:
`yarn test`, `yarn flow`, and `yarn start` all still do the right thing.

wchargin-branch: eject
2018-02-17 13:28:47 -08:00
William Chargin c1b37fa729 Add an end-to-end component test for App
Summary:
This should ensure that there aren’t any runtime PropTypes errors.

The change to reimplement `Object.entries` is due to the fact that my
local Node environment (v6.11.1) does not yet support that ESnext
function.

Test Plan:
Apply the following diff (`git apply`):
```diff
diff --git a/explorer/src/UserExplorer.js b/explorer/src/UserExplorer.js
index 8da252d..cdc1370 100644
--- a/explorer/src/UserExplorer.js
+++ b/explorer/src/UserExplorer.js
@@ -10,7 +10,7 @@ export class UserExplorer extends Component {
   static propTypes = {
     selectedPath: PropTypes.string.isRequired,
     selectedUser: PropTypes.string,
-    onSelectUser: PropTypes.func.isRequired,
+    onSelectUser: PropTypes.number.isRequired,
     data: commitUtilsPropTypes.commitData.isRequired,
   }
```
Then, `yarn test` should fail. Revert the diff, and `yarn test` should
pass.

wchargin-branch: react-proptypes-test
2018-02-16 16:32:30 -08:00
William Chargin 1d0368411c Add PropTypes to existing React components
Test Plan:
Run `yarn start` and note that the app runs without any console
warnings, but that changing some of the PropTypes to introduce an error
actually does cause a warning. Upcoming: an automatic test for this.

wchargin-branch: add-proptypes
2018-02-16 16:32:30 -08:00
William Chargin 011e9a755b Remove console.log that alerts us of hacks (#15)
Summary:
It produces a lot of noise, and we know about it.

wchargin-branch: remove-spurious-log
2018-02-16 16:28:17 -08:00
Dandelion Mané 22ddd15d78
Initial prototype of the cred explorer (#14)
Sets up an initial cred explorer that looks at Git commit data

- uses git commit data as generated by `experiments/01_commit_graph_dump.ipynb`
- displays a file explorer, which lets you navigate the file tree by expanding/collapsing dirs, and select a path via double clicking (changes background color)
- displays a user explorer, which shows a sorted list of authors and cred amounts for the selected file path

The commit-wrangling logic is in commitUtils.js and has typechecking (via flow) and some basic testing.
The frontend is built with react; setup was bootstrapped via create-react-app.

Test plan:

```
cd explorer;
yarn install; # get dependencies
yarn flow; # check that types check out
yarn test; # check that tests pass, then `q`
yarn start; # go to localhost:3000 and click around
```

expected behavior: there's a file explorer that shows TensorBoard file structure on the left. you can click the buttons to explore directory, and you can click files to select that path. on the right, it shows you the users that contributed to that directory and their cred for those commits.

note: the ui is very crude.
2018-02-16 15:35:22 -08:00
Dandelion Mané 91bdce2e5e
Frontend setup (#13)
* Initial infrastructure for sourcecred-explorer.

Setup npm, yarn, flow, jest using scaffolding from
create-react-app.

- used create-react-app to get the basic pieces
- added support for flow via instructions in the
create-react-app user guide
- added flow-typed so that flow+jest will work well

* Add some additional resources

* Add index.css

* Remove .DS_STORE per @wchargin's suggestion
2018-02-16 14:32:24 -08:00
Dandelion Mané 5b3b345630
Tweak commit_graph_dump & store sample data. (#12)
commit_graph_dump is modified to use camelCase variables
in the output data.json. Saved the data for TensorBoard
in explorer/src/data.json, where it's useful for debugging
/ iterating on the frontend.
2018-02-15 22:16:37 -08:00
William Chargin 03198b0c86 Check in experimental commit graph traversal (#8)
Summary:
This is a minimal script that will crawl the file-reachable commits in a
repository and dump statistics to a JSON file that can be further
analyzed interactively on a frontend.

Requires PyPI `gitpython` (and `matplotlib`, but this can be excised).
Requires `jupyter` to run.

(Mostly paired with @dandelionmane on 2018-02-08.)

wchargin-branch: experiment-commit-traversal
2018-02-15 16:11:38 -08:00
Dandelion Mané 84ad9d57bf
Split out useful & ethical. (#7) 2018-02-07 15:04:23 -08:00
William Chargin 65d711022e Make design goals grammatically consistent
Summary:
This changes the titles of two design goals so that they are all
adjectival: “SourceCred will be…” and not “SourceCred will have…”.

wchargin-branch: design-goals-grammar-list-consistent
2018-02-07 14:56:53 -08:00
Dandelion Mané 6bcc275c2d
Add overview.md (#6) 2018-02-05 00:14:15 -08:00
Dandelion Mané c9b2fcd21a
Simplify README, link to new docs 2018-02-05 00:09:14 -08:00
Dandelion Mané 0874d89b31
Enumerate design goals for SourceCred (#5)
* Add design goals

* Fix formatting on design.md

* It's also a protocol

* Fix formatting
2018-02-05 00:03:18 -08:00
Dandelion Mané 7dd9155833
Initial draft of the README (#1)
* Initial commit of README

* Fix some typos, etc

* More tweaks.

* More iterations on markdown, etc

* Take Jay's suggestion
2018-02-04 12:04:40 -08:00
Dandelion Mané 9cba0e9e21 Add LICENSE 2018-02-03 17:58:49 -08:00