forked from echen831/MB_SJHackathon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
33 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[{"/Users/ericchen/Desktop/MB_projects/sj_project/src/index.js":"1","/Users/ericchen/Desktop/MB_projects/sj_project/src/App.js":"2","/Users/ericchen/Desktop/MB_projects/sj_project/src/components/input.jsx":"3","/Users/ericchen/Desktop/MB_projects/sj_project/src/components/states.js":"4","/Users/ericchen/Desktop/MB_projects/sj_project/src/components/buttons.jsx":"5","/Users/ericchen/Desktop/MB_projects/sj_project/src/components/today.jsx":"6","/Users/ericchen/Desktop/MB_projects/sj_project/src/components/history.jsx":"7"},{"size":199,"mtime":1607224861875,"results":"8","hashOfConfig":"9"},{"size":1095,"mtime":1607365764140,"results":"10","hashOfConfig":"9"},{"size":766,"mtime":1607227340486,"results":"11","hashOfConfig":"9"},{"size":5659,"mtime":1607320414068,"results":"12","hashOfConfig":"9"},{"size":777,"mtime":1607365843006,"results":"13","hashOfConfig":"9"},{"size":2131,"mtime":1607325725948,"results":"14","hashOfConfig":"9"},{"size":462,"mtime":1607365950746,"results":"15","hashOfConfig":"9"},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"18"},"150614y",{"filePath":"19","messages":"20","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"21","messages":"22","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"23","usedDeprecatedRules":"24"},{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"18"},{"filePath":"27","messages":"28","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"18"},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/ericchen/Desktop/MB_projects/sj_project/src/index.js",[],["33","34"],"/Users/ericchen/Desktop/MB_projects/sj_project/src/App.js",["35","36","37"],"/Users/ericchen/Desktop/MB_projects/sj_project/src/components/input.jsx",["38","39"],"import React, { useState, useRef } from 'react';\n\nexport const Input = ({ add }) => {\n const [name, setName] = useState('');\n\n const nameInput = useRef();\n const addressInput = useRef();\n\n const handleSubmit = (e) => {\n e.preventDefault();\n add({ name: nameInput.current.value, address: addressInput.current.value })\n nameInput.current.value = '';\n addressInput.current.value = '';\n }\n\n return (\n <div>\n <form action=\"\" onSubmit={handleSubmit}>\n <input type=\"text\" placeholder='Your name here...' ref={nameInput}/>\n <input type=\"text\" placeholder='Your address here...'ref={addressInput}/>\n <button>Submit</button>\n </form>\n </div>\n )\n}",["40","41"],"/Users/ericchen/Desktop/MB_projects/sj_project/src/components/states.js",[],"/Users/ericchen/Desktop/MB_projects/sj_project/src/components/buttons.jsx",["42","43"],"/Users/ericchen/Desktop/MB_projects/sj_project/src/components/today.jsx",[],"/Users/ericchen/Desktop/MB_projects/sj_project/src/components/history.jsx",[],{"ruleId":"44","replacedBy":"45"},{"ruleId":"46","replacedBy":"47"},{"ruleId":"48","severity":1,"message":"49","line":12,"column":10,"nodeType":"50","messageId":"51","endLine":12,"endColumn":18},{"ruleId":"48","severity":1,"message":"52","line":13,"column":10,"nodeType":"50","messageId":"51","endLine":13,"endColumn":15},{"ruleId":"53","severity":1,"message":"54","line":17,"column":48,"nodeType":"55","endLine":17,"endColumn":50,"suggestions":"56"},{"ruleId":"48","severity":1,"message":"57","line":4,"column":12,"nodeType":"50","messageId":"51","endLine":4,"endColumn":16},{"ruleId":"48","severity":1,"message":"58","line":4,"column":18,"nodeType":"50","messageId":"51","endLine":4,"endColumn":25},{"ruleId":"44","replacedBy":"59"},{"ruleId":"46","replacedBy":"60"},{"ruleId":"48","severity":1,"message":"61","line":1,"column":16,"nodeType":"50","messageId":"51","endLine":1,"endColumn":24},{"ruleId":"48","severity":1,"message":"62","line":1,"column":26,"nodeType":"50","messageId":"51","endLine":1,"endColumn":35},"no-native-reassign",["63"],"no-negated-in-lhs",["64"],"no-unused-vars","'isLoaded' is assigned a value but never used.","Identifier","unusedVar","'error' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'currState'. Either include it or remove the dependency array.","ArrayExpression",["65"],"'name' is assigned a value but never used.","'setName' is assigned a value but never used.",["63"],["64"],"'useState' is defined but never used.","'useEffect' is defined but never used.","no-global-assign","no-unsafe-negation",{"desc":"66","fix":"67"},"Update the dependencies array to be: [currState]",{"range":"68","text":"69"},[479,481],"[currState]"] | ||
[{"/Users/ericchen/Desktop/MB_projects/sj_project/src/index.js":"1","/Users/ericchen/Desktop/MB_projects/sj_project/src/App.js":"2","/Users/ericchen/Desktop/MB_projects/sj_project/src/components/input.jsx":"3","/Users/ericchen/Desktop/MB_projects/sj_project/src/components/states.js":"4","/Users/ericchen/Desktop/MB_projects/sj_project/src/components/buttons.jsx":"5","/Users/ericchen/Desktop/MB_projects/sj_project/src/components/today.jsx":"6","/Users/ericchen/Desktop/MB_projects/sj_project/src/components/history.jsx":"7"},{"size":199,"mtime":1607224861875,"results":"8","hashOfConfig":"9"},{"size":1193,"mtime":1607386750633,"results":"10","hashOfConfig":"9"},{"size":766,"mtime":1607227340486,"results":"11","hashOfConfig":"9"},{"size":5659,"mtime":1607320414068,"results":"12","hashOfConfig":"9"},{"size":816,"mtime":1607407453938,"results":"13","hashOfConfig":"9"},{"size":2131,"mtime":1607325725948,"results":"14","hashOfConfig":"9"},{"size":716,"mtime":1607406659266,"results":"15","hashOfConfig":"9"},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"18"},"150614y",{"filePath":"19","messages":"20","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"21","messages":"22","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"23","usedDeprecatedRules":"24"},{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"18"},{"filePath":"27","messages":"28","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"18"},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/ericchen/Desktop/MB_projects/sj_project/src/index.js",[],["33","34"],"/Users/ericchen/Desktop/MB_projects/sj_project/src/App.js",["35"],"/Users/ericchen/Desktop/MB_projects/sj_project/src/components/input.jsx",["36","37"],"import React, { useState, useRef } from 'react';\n\nexport const Input = ({ add }) => {\n const [name, setName] = useState('');\n\n const nameInput = useRef();\n const addressInput = useRef();\n\n const handleSubmit = (e) => {\n e.preventDefault();\n add({ name: nameInput.current.value, address: addressInput.current.value })\n nameInput.current.value = '';\n addressInput.current.value = '';\n }\n\n return (\n <div>\n <form action=\"\" onSubmit={handleSubmit}>\n <input type=\"text\" placeholder='Your name here...' ref={nameInput}/>\n <input type=\"text\" placeholder='Your address here...'ref={addressInput}/>\n <button>Submit</button>\n </form>\n </div>\n )\n}",["38","39"],"/Users/ericchen/Desktop/MB_projects/sj_project/src/components/states.js",[],"/Users/ericchen/Desktop/MB_projects/sj_project/src/components/buttons.jsx",["40","41"],"/Users/ericchen/Desktop/MB_projects/sj_project/src/components/today.jsx",[],"/Users/ericchen/Desktop/MB_projects/sj_project/src/components/history.jsx",[],{"ruleId":"42","replacedBy":"43"},{"ruleId":"44","replacedBy":"45"},{"ruleId":"46","severity":1,"message":"47","line":17,"column":48,"nodeType":"48","endLine":17,"endColumn":50,"suggestions":"49"},{"ruleId":"50","severity":1,"message":"51","line":4,"column":12,"nodeType":"52","messageId":"53","endLine":4,"endColumn":16},{"ruleId":"50","severity":1,"message":"54","line":4,"column":18,"nodeType":"52","messageId":"53","endLine":4,"endColumn":25},{"ruleId":"42","replacedBy":"55"},{"ruleId":"44","replacedBy":"56"},{"ruleId":"50","severity":1,"message":"57","line":1,"column":16,"nodeType":"52","messageId":"53","endLine":1,"endColumn":24},{"ruleId":"50","severity":1,"message":"58","line":1,"column":26,"nodeType":"52","messageId":"53","endLine":1,"endColumn":35},"no-native-reassign",["59"],"no-negated-in-lhs",["60"],"react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'currState'. Either include it or remove the dependency array.","ArrayExpression",["61"],"no-unused-vars","'name' is assigned a value but never used.","Identifier","unusedVar","'setName' is assigned a value but never used.",["59"],["60"],"'useState' is defined but never used.","'useEffect' is defined but never used.","no-global-assign","no-unsafe-negation",{"desc":"62","fix":"63"},"Update the dependencies array to be: [currState]",{"range":"64","text":"65"},[495,497],"[currState]"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
import React from 'react'; | ||
|
||
export const History = ({ data }) => { | ||
export const History = ({ data, isLoaded, error }) => { | ||
|
||
return ( | ||
<div> | ||
<ul> | ||
{data.map(day => { | ||
return ( | ||
<div> | ||
<li>Date: {day.date}</li> | ||
<li>Num Positive: {day.positive}</li> | ||
</div> | ||
|
||
) | ||
})} | ||
if (error) { | ||
return <div>Error: {error.message}</div> | ||
} else if (!isLoaded) { | ||
return <div>Loading...</div> | ||
} else { | ||
return ( | ||
<div> | ||
Historic data... | ||
<ul> | ||
{data.map(day => { | ||
return ( | ||
<div> | ||
<li>Date: {day.date}</li> | ||
<li>Num Positive: {day.positive}</li> | ||
</div> | ||
) | ||
})} | ||
|
||
</ul> | ||
</div> | ||
) | ||
|
||
</ul> | ||
</div> | ||
) | ||
} | ||
} |