Skip to content

Commit

Permalink
Merge branch 'release/2020.12.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreMiras committed Dec 10, 2020
2 parents 7a858b2 + 9cb3bd4 commit c5f218e
Show file tree
Hide file tree
Showing 43 changed files with 1,837 additions and 169 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/reportWebVitals.jsx
11 changes: 11 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"extends": "airbnb"
"env": {
"browser": true,
"jest": true,
}
"rules": {
"allowShortCircuit": 0,
"allowTernary": 0,
"no-unused-expressions": "off",
"no-mixed-operators": "off"
}
23 changes: 23 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Deploy

on:
push:
branches:
- develop

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- name: git config
run: |
git config user.name github-pages-deploy-action
git config user.email github-pages-deploy-action@@users.noreply.github.com
git remote set-url origin https://${{github.actor}}:${{github.token}}@github.com/${{github.repository}}.git
- run: yarn install
- run: yarn build
env:
REACT_APP_GITHUB_PAT: ${{ secrets.REACT_APP_GITHUB_PAT }}
- run: yarn deploy
19 changes: 19 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Tests

on: [push]

jobs:
build:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- run: yarn install
- run: yarn test
env:
REACT_APP_GITHUB_PAT: ${{ secrets.REACT_APP_GITHUB_PAT }}
- run: yarn lint
- uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
.env

# dependencies
/node_modules
Expand All @@ -21,3 +21,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Optional eslint cache
.eslintcache
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Change Log

## [2020.12.10]
- Initial UI release
86 changes: 23 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,30 @@
# Getting Started with Create React App
# GitPop3

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
[![Tests](https://github.com/AndreMiras/gitpop3/workflows/Tests/badge.svg?branch=develop)](https://github.com/AndreMiras/gitpop3/actions?query=workflow%3ATests)
[![Coverage Status](https://coveralls.io/repos/github/AndreMiras/gitpop3/badge.svg?branch=develop)](https://coveralls.io/github/AndreMiras/gitpop3?branch=develop)
[![Deploy](https://github.com/AndreMiras/gitpop3/workflows/Deploy/badge.svg?branch=develop)](https://github.com/AndreMiras/gitpop3/actions?query=workflow%3ADeploy)

## Available Scripts
Find the most popular fork on GitHub.

In the project directory, you can run:
<https://andremiras.github.io/gitpop3/>

### `yarn start`
This is a rewrite of [GitPop2](https://github.com/AndreMiras/gitpop2) using only frontend tech.

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
## Run
```sh
yarn start
```

The page will reload if you make edits.\
You will also see any lint errors in the console.
## Test
```sh
yarn lint
yarn test
```

### `yarn test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)

### Analyzing the Bundle Size

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `yarn build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
## Deployment
The app can be deployed on GitHub pages when releasing via:
```sh
yarn deploy
```
Note a [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) should be generated and set to its base64 form to the `REACT_APP_GITHUB_PAT` environment variable.
This is required for [Authenticating with GraphQL](https://docs.github.com/en/free-pro-team@latest/graphql/guides/forming-calls-with-graphql#authenticating-with-graphql).
35 changes: 32 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,50 @@
{
"name": "gitpop3",
"version": "0.1.0",
"homepage": "https://andremiras.github.io/gitpop3/",
"version": "2020.12.10",
"private": true,
"dependencies": {
"@apollo/client": "^3.2.7",
"@fortawesome/fontawesome-free": "^5.15.1",
"@fortawesome/fontawesome-svg-core": "^1.2.32",
"@fortawesome/free-brands-svg-icons": "^5.15.1",
"@fortawesome/free-solid-svg-icons": "^5.15.1",
"@fortawesome/react-fontawesome": "^0.1.12",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"bootstrap": "^4.5.3",
"font-awesome": "^4.7.0",
"graphql": "^15.4.0",
"prop-types": "^15.7.2",
"react": "^17.0.1",
"react-bootstrap": "^1.4.0",
"react-dom": "^17.0.1",
"react-js-pagination": "^3.0.3",
"react-scripts": "4.0.1",
"web-vitals": "^0.2.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"test": "react-scripts test --coverage",
"eject": "react-scripts eject",
"lint": "eslint -c .eslintrc 'src/**/*.{js,jsx}'",
"format": "eslint -c .eslintrc 'src/**/*.{js,jsx}' --fix",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}",
"!src/reportWebVitals.jsx"
]
},
"browserslist": {
"production": [
">0.2%",
Expand All @@ -34,5 +56,12 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"coveralls": "^3.1.0",
"eslint-config-airbnb": "^18.2.1",
"gh-pages": "^3.1.0",
"moment": "^2.29.1",
"react-test-renderer": "^17.0.1"
}
}
Binary file modified public/favicon.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
content="Find the most popular fork on GitHub"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
Expand All @@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>GitPop3: Find the most popular fork on GitHub</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
38 changes: 0 additions & 38 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,38 +0,0 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #61dafb;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
25 changes: 0 additions & 25 deletions src/App.js

This file was deleted.

23 changes: 23 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';
import { library } from '@fortawesome/fontawesome-svg-core';
import { fab } from '@fortawesome/free-brands-svg-icons';
import { fas } from '@fortawesome/free-solid-svg-icons';
import Container from './components/Container';
import Footer from './components/Footer';
import Navigation from './components/Navigation';

library.add(fab, fas);

function App() {
return (
<div className="App">
<Navigation />
<Container />
<Footer />
</div>
);
}

export default App;
5 changes: 3 additions & 2 deletions src/App.test.js → src/App.test.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
test('renders title', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
const linkElement = screen.getByText(/GitPop3/);
expect(linkElement).toBeInTheDocument();
});
39 changes: 39 additions & 0 deletions src/components/Container.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { useState } from 'react';
import { Container as ReactContainer } from 'react-bootstrap';
import PopForm from './PopForm';
import ResultTable from './ResultTable';
import searchPopularForks from '../utils/search';

const Container = () => {
const [forks, setForks] = useState();
const [activePage, setActivePage] = useState(1);
const [loading, setLoading] = useState(false);
const onResult = (result) => {
setForks(result.data.repository.forks.nodes);
setLoading(false);
};
const onSubmit = (url) => {
setLoading(true);
searchPopularForks(url, onResult);
};
const resultTable = (
forks
? (
<ResultTable
forks={forks}
activePage={activePage}
itemsCountPerPage={10}
onPageChange={setActivePage}
/>
)
: null
);
return (
<ReactContainer>
<PopForm onSubmit={onSubmit} loading={loading} />
{resultTable}
</ReactContainer>
);
};

export default Container;
Loading

0 comments on commit c5f218e

Please sign in to comment.