Skip to content

Commit

Permalink
search feature and conditional rendering of name on profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
jzolo22 committed Jan 5, 2021
1 parent 02e5b0a commit 523d0a9
Show file tree
Hide file tree
Showing 16 changed files with 214 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .eslintcache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/App.js":"1","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/NavBar.js":"2","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/redux/actions.js":"3","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/Profile.js":"4","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/index.js":"5","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/HomePage.js":"6","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/LoginForm.js":"7","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/TrailForm.js":"8","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/Trail.js":"9","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/containers/TrailsList.js":"10","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/NewUserForm.js":"11","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/TrailShow.js":"12","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/redux/reducer.js":"13","/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/reportWebVitals.js":"14"},{"size":1289,"mtime":1609795087202,"results":"15","hashOfConfig":"16"},{"size":1568,"mtime":1609795917724,"results":"17","hashOfConfig":"16"},{"size":3771,"mtime":1609798771117,"results":"18","hashOfConfig":"16"},{"size":4686,"mtime":1609800851231,"results":"19","hashOfConfig":"16"},{"size":866,"mtime":1609771189093,"results":"20","hashOfConfig":"16"},{"size":4413,"mtime":1609798301463,"results":"21","hashOfConfig":"16"},{"size":1214,"mtime":1609777686017,"results":"22","hashOfConfig":"16"},{"size":1979,"mtime":1609771189077,"results":"23","hashOfConfig":"16"},{"size":250,"mtime":1609448792409,"results":"24","hashOfConfig":"16"},{"size":1856,"mtime":1609636829707,"results":"25","hashOfConfig":"16"},{"size":2011,"mtime":1609287936084,"results":"26","hashOfConfig":"16"},{"size":1334,"mtime":1609798915834,"results":"27","hashOfConfig":"16"},{"size":1804,"mtime":1609795065663,"results":"28","hashOfConfig":"16"},{"size":362,"mtime":1608848917172,"results":"29","hashOfConfig":"16"},{"filePath":"30","messages":"31","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"15x815f",{"filePath":"32","messages":"33","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"34","messages":"35","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"36","messages":"37","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"38","messages":"39","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"40","messages":"41","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"42","messages":"43","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"44"},{"filePath":"45","messages":"46","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"47"},{"filePath":"48","messages":"49","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"50","messages":"51","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"52"},{"filePath":"53","messages":"54","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"55","messages":"56","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"52"},{"filePath":"57","messages":"58","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"59","messages":"60","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"52"},"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/App.js",[],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/NavBar.js",[],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/redux/actions.js",[],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/Profile.js",[],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/index.js",[],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/HomePage.js",[],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/LoginForm.js",[],["61","62"],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/TrailForm.js",[],["63","64"],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/Trail.js",[],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/containers/TrailsList.js",[],["65","66"],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/NewUserForm.js",[],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/components/TrailShow.js",[],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/redux/reducer.js",[],"/Users/jonathanhakimian/Desktop/Flatiron/Trails_With_Friends/trails-with-friends-frontend/src/reportWebVitals.js",[],{"ruleId":"67","replacedBy":"68"},{"ruleId":"69","replacedBy":"70"},{"ruleId":"67","replacedBy":"71"},{"ruleId":"69","replacedBy":"72"},{"ruleId":"67","replacedBy":"73"},{"ruleId":"69","replacedBy":"74"},"no-native-reassign",["75"],"no-negated-in-lhs",["76"],["75"],["76"],["75"],["76"],"no-global-assign","no-unsafe-negation"]
[{"/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/index.js":"1","/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/components/HomePage.js":"2","/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/redux/actions.js":"3","/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/components/NewUserForm.js":"4","/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/App.js":"5","/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/containers/TrailsList.js":"6","/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/components/NavBar.js":"7","/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/components/Profile.js":"8","/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/redux/reducer.js":"9","/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/components/SearchForm.js":"10","/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/components/TrailShow.js":"11"},{"size":866,"mtime":1609710790530,"results":"12","hashOfConfig":"13"},{"size":4416,"mtime":1609865165192,"results":"14","hashOfConfig":"13"},{"size":4338,"mtime":1609881471830,"results":"15","hashOfConfig":"13"},{"size":1913,"mtime":1609861392379,"results":"16","hashOfConfig":"13"},{"size":1141,"mtime":1609875525820,"results":"17","hashOfConfig":"13"},{"size":2406,"mtime":1609881691878,"results":"18","hashOfConfig":"13"},{"size":1588,"mtime":1609878847677,"results":"19","hashOfConfig":"13"},{"size":6085,"mtime":1609881965848,"results":"20","hashOfConfig":"13"},{"size":1857,"mtime":1609881466957,"results":"21","hashOfConfig":"13"},{"size":673,"mtime":1609881298316,"results":"22","hashOfConfig":"13"},{"size":2413,"mtime":1609879261006,"results":"23","hashOfConfig":"13"},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},"6dmgbn",{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"37","messages":"38","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"39","messages":"40","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"41","messages":"42","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"43","messages":"44","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"45"},{"filePath":"46","messages":"47","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/index.js",[],["48","49"],"/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/components/HomePage.js",[],"/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/redux/actions.js",[],"/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/components/NewUserForm.js",[],"/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/App.js",[],"/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/containers/TrailsList.js",[],"/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/components/NavBar.js",[],"/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/components/Profile.js",[],"/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/redux/reducer.js",[],"/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/components/SearchForm.js",["50"],"import React from 'react'\nimport {connect} from 'react-redux'\n// import {search} from '../redux/actions'\n\nclass SearchForm extends React.Component {\n\n localOnChange = (e) => {\n this.props.changeHandler(e)\n }\n \n\n render() {\n console.log(this.props.search)\n return (\n <form>\n <input \n type=\"text\" \n value={this.props.search} placeholder=\"search by title\" \n onChange={this.props.changeHandler} />\n </form>\n )\n }\n}\n\n// const mapDispatchToProps = (dispatch) => {\n// return {search: (searchValue) => dispatch(search(searchValue))}\n// }\n\nexport default SearchForm","/Users/juliazolotarev/Documents/Flatiron/assignments/Mod-4/trails-with-friends/trails-with-friends-frontend/src/components/TrailShow.js",["51","52"],{"ruleId":"53","replacedBy":"54"},{"ruleId":"55","replacedBy":"56"},{"ruleId":"57","severity":1,"message":"58","line":2,"column":9,"nodeType":"59","messageId":"60","endLine":2,"endColumn":16},{"ruleId":"61","severity":1,"message":"62","line":38,"column":17,"nodeType":"63","endLine":38,"endColumn":229},{"ruleId":"61","severity":1,"message":"62","line":42,"column":21,"nodeType":"63","endLine":42,"endColumn":297},"no-native-reassign",["64"],"no-negated-in-lhs",["65"],"no-unused-vars","'connect' is defined but never used.","Identifier","unusedVar","jsx-a11y/iframe-has-title","<iframe> elements must have a unique title property.","JSXOpeningElement","no-global-assign","no-unsafe-negation"]
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
#API key
.env

# dependencies
/node_modules
Expand All @@ -18,6 +20,8 @@
.env.test.local
.env.production.local



npm-debug.log*
yarn-debug.log*
yarn-error.log*
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"react-redux": "^7.2.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"reactjs-popup": "^2.0.4",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"web-vitals": "^0.2.4"
Expand Down
6 changes: 6 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
html, #root {
height: 100%;
padding-top: 0%;
margin-top: 0%;
}

.App {
Expand All @@ -20,6 +22,8 @@ html, #root {
body {
min-height: 100%;
padding: 10px;
padding-top: 0%;
margin-top: 0%;
margin: 10px;
font-family: Rockwell, serif;
-webkit-font-smoothing: antialiased;
Expand All @@ -40,6 +44,8 @@ nav {
grid-area: nav;
display: flex;
justify-content: space-around;
/* background-color: lightgray; */
padding: 15px;
}

#feed {
Expand Down
7 changes: 2 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import HomePage from './components/HomePage'
import NavBar from './components/NavBar'
import {checkLogin} from './redux/actions'



class App extends React.Component {

// state = {
Expand All @@ -23,11 +25,6 @@ class App extends React.Component {
}
}

// logout = () => {
// localStorage.removeItem("token")
// this.props.history.push('/')
// // this.setState({currentUser: null})
// }

render() {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class HomePage extends React.Component {


render() {
console.log(this.props)
// console.log(this.props)
return (
<>
<Switch>
Expand Down
13 changes: 7 additions & 6 deletions src/components/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,27 @@ class Navbar extends Component {
console.log(this.props)
return (
<nav id="nav">
<NavLink to="/trails">
<span>Trails</span>
</NavLink>
<NavLink to="/">
<span>Home</span>
</NavLink>
<NavLink to="/trails">
<span>Trails</span>
</NavLink>

{this.props.user ?
<>
<NavLink to={`/users/${this.props.user.user.id}`}>
<span>Hello {this.props.user.user.name}</span>
</NavLink>
<span onClick={this.localLogout}>Logout</span>
<span onClick={this.localLogout}>Log Out</span>
</>
:
<>
<NavLink to={'/users/new'}>
Signup
Sign Up
</NavLink>
<NavLink to={'/'}>
Login
Log In
</NavLink>
</>
}
Expand Down
13 changes: 3 additions & 10 deletions src/components/NewUserForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React, { Component } from 'react'
import {connect} from 'react-redux'
import {newUser} from '../redux/actions'
import {withRouter} from 'react-router-dom'


class NewUserForm extends Component {
Expand All @@ -22,15 +23,7 @@ class NewUserForm extends Component {
submitHandler = (e) => {
e.preventDefault()
this.props.submitHandler({user: this.state})

// this.setState({
// name: "",
// length: "",
// location: "",
// duration: "",
// difficulty: ""
// })

this.props.history.push('/')
}

render() {
Expand Down Expand Up @@ -61,5 +54,5 @@ const msp = (state) => {
}


export default connect(msp, mdp)(NewUserForm)
export default withRouter(connect(msp, mdp)(NewUserForm))

Loading

0 comments on commit 523d0a9

Please sign in to comment.