diff --git a/dashboard-client/app/app/src/App.js b/dashboard-client/app/app/src/App.js
index ecde1d1341..1592c57f08 100644
--- a/dashboard-client/app/app/src/App.js
+++ b/dashboard-client/app/app/src/App.js
@@ -2,8 +2,7 @@ import React, { Component } from 'react';
import styled from 'styled-components';
import Tabs from './components/Tabs';
-import Input from './components/Input';
-import Results from './components/Results';
+import Search from './components/Search';
import Pareto from './components/Pareto';
const Container = styled.div`
@@ -11,79 +10,34 @@ const Container = styled.div`
flex-direction: column;
justify-content: center;
align-items: center;
+ max-width: 960px;
+ width: 90vw;
padding: 15px;
border-radius: 4px;
box-shadow: 0 0 4px 0 #777;
-
`;
class App extends Component {
state = {
- number: '',
- foundPRs: [],
- pareto: [],
view: 'search'
};
- clearObj = { number: '', foundPRs: [] };
-
- inputRef = React.createRef();
-
- handleInputEvent = (event) => {
- const { type, key, target: { value } } = event;
-
- if (type === 'change') {
- if (Number(value) || value === '') {
- this.setState((prevState) => ({ number: value, foundPRs: [] }));
- }
- }
- else if (type === 'keypress' && key === 'Enter') {
- this.searchPRs(value);
- }
- }
-
- handleButtonClick = () => {
- const { number } = this.state;
- this.searchPRs(number);
- }
-
- searchPRs = (number) => {
- fetch(`https://pr-relations.glitch.me/pr/${number}`)
- .then((response) => response.json())
- .then(({ ok, foundPRs }) => {
- if (ok) {
- if (!foundPRs.length) {
- foundPRs.push({ number: 'No PRs with matching files', filenames: [] });
- }
- this.setState((prevState) => ({ foundPRs }));
- }
- else {
- this.inputRef.current.focus();
- }
- })
- .catch(() => {
- this.setState((prevState) => (this.clearObj));
- });
- }
-
handleViewChange = ( { target: { id } }) => {
const view = id.replace('tabs-', '');
this.setState((prevState) => ({ ...this.clearObj, view }));
}
render() {
- const { handleButtonClick, handleViewChange, handleInputEvent, inputRef, state } = this;
- const { number, foundPRs, view } = state;
+ const { handleViewChange, state: { view } } = this;
return (
-
+ <>
-
-
- { view === 'search' && }
- { view === 'reports' && }
-
+
+ { view === 'search' && }
+ { view === 'reports' && }
+
+ >
);
}
}
-
export default App;
diff --git a/dashboard-client/app/app/src/components/Input.js b/dashboard-client/app/app/src/components/Input.js
index a72712e38f..ae1b45cbfa 100644
--- a/dashboard-client/app/app/src/components/Input.js
+++ b/dashboard-client/app/app/src/components/Input.js
@@ -1,7 +1,12 @@
import React from 'react';
+import styled from 'styled-components';
+
+const Container = styled.input`
+ margin-bottom: 10px;
+`;
const Input = React.forwardRef((props, ref) => (
-
- {elements}
+ {data.length ? elements : 'Report Loading...'}
);
}
diff --git a/dashboard-client/app/app/src/components/Results.js b/dashboard-client/app/app/src/components/Results.js
index 9bfb980c53..8ec3191703 100644
--- a/dashboard-client/app/app/src/components/Results.js
+++ b/dashboard-client/app/app/src/components/Results.js
@@ -1,4 +1,9 @@
import React from 'react';
+import styled from 'styled-components';
+
+const List = styled.ul`
+ margin: 5px;
+`;
const Results = ({ foundPRs }) => {
const elements = foundPRs.map((foundPR) => {
@@ -10,18 +15,16 @@ const Results = ({ foundPRs }) => {
return (
-
- {!Number(number)
- ? number
- : <>
- {number}
- {username}
- >
- }
-
-
+ {!Number(number)
+ ? number
+ : <>
+ {number}
+ {username}
+ >
+ }
+
{files}
-
+
);
});
diff --git a/dashboard-client/app/app/src/components/Search.js b/dashboard-client/app/app/src/components/Search.js
new file mode 100644
index 0000000000..6b4a8b54ed
--- /dev/null
+++ b/dashboard-client/app/app/src/components/Search.js
@@ -0,0 +1,66 @@
+import React, { Component } from 'react';
+
+import Input from './Input';
+import Results from './Results';
+
+class Search extends Component {
+ state = {
+ number: '',
+ foundPRs: [],
+ };
+
+ clearObj = { number: '', foundPRs: [] };
+
+ inputRef = React.createRef();
+
+ handleInputEvent = (event) => {
+ const { type, key, target: { value } } = event;
+
+ if (type === 'change') {
+ if (Number(value) || value === '') {
+ this.setState((prevState) => ({ number: value, foundPRs: [] }));
+ }
+ }
+ else if (type === 'keypress' && key === 'Enter') {
+ this.searchPRs(value);
+ }
+ }
+
+ handleButtonClick = () => {
+ const { number } = this.state;
+ this.searchPRs(number);
+ }
+
+ searchPRs = (number) => {
+ fetch(`https://pr-relations.glitch.me/pr/${number}`)
+ .then((response) => response.json())
+ .then(({ ok, foundPRs }) => {
+ if (ok) {
+ if (!foundPRs.length) {
+ foundPRs.push({ number: 'No PRs with matching files', filenames: [] });
+ }
+ this.setState((prevState) => ({ foundPRs }));
+ }
+ else {
+ this.inputRef.current.focus();
+ }
+ })
+ .catch(() => {
+ this.setState((prevState) => (this.clearObj));
+ });
+ }
+
+ render() {
+ const { handleButtonClick, handleInputEvent, inputRef, state } = this;
+ const { number, foundPRs } = state;
+ return (
+ <>
+
+
+
+ >
+ );
+ }
+}
+
+export default Search;
diff --git a/dashboard-client/app/app/src/components/Tabs.js b/dashboard-client/app/app/src/components/Tabs.js
index 6ee0a47b33..84433bca7a 100644
--- a/dashboard-client/app/app/src/components/Tabs.js
+++ b/dashboard-client/app/app/src/components/Tabs.js
@@ -5,6 +5,7 @@ const Container = styled.div`
display: flex;
justify-content: center;
height: 40px;
+ margin: 10px;
`;
const Tab = styled.div`
@@ -14,10 +15,12 @@ const Tab = styled.div`
padding: 5px;
border: 2px solid ${({ theme }) => theme.primary};
border-left: none;
+ flex-basis: 200px;
+ text-align: center;
&:hover {
cursor: pointer;
- background: ${({ theme }) => theme.primary};
+ background: rgba(0, 0, 255, 0.8);
color: white;
}
@@ -30,7 +33,7 @@ const Tabs = ({ view, onViewChange }) => {
return (
Search
- Reports
+ Pareto
);
};
diff --git a/dashboard-client/app/app/src/index.css b/dashboard-client/app/app/src/index.css
index a7fd5cf0ab..685ac3c8b1 100644
--- a/dashboard-client/app/app/src/index.css
+++ b/dashboard-client/app/app/src/index.css
@@ -6,7 +6,7 @@ body {
display: flex;
justify-content: center;
align-items: center;
- /* height: 100vh; */
+ min-height: 100vh;
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",