-
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
37 changed files
with
1,190 additions
and
104 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
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var express = require('express'); | ||
var router = express.Router(); | ||
var listingDb = require('../data/listings'); | ||
|
||
|
||
/* GET home page. */ | ||
router.get('/', function(req, res, next) { | ||
var constraints = { | ||
page : parseInt(req.query.pg), | ||
limit : parseInt(req.query.lim) | ||
}; | ||
constraints.restrictions = {}; | ||
var sort ={}; | ||
sort[req.query.srt] = parseInt(req.query.ord); | ||
constraints.sort = sort; | ||
listingDb.getSearchResults(constraints, | ||
function(error, listings, addresses) { | ||
if (error) { | ||
next(error); | ||
} else { | ||
res.json({ | ||
listings: listings, | ||
addresses: addresses | ||
}); | ||
} | ||
} | ||
); | ||
}); | ||
|
||
module.exports = router; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import React from 'react'; | ||
|
||
export default class Preview extends React.Component { | ||
constructor() { | ||
super(); | ||
this.onPreviewClick = this.onPreviewClick.bind(this); | ||
} | ||
|
||
onPreviewClick() { | ||
console.log('preview clicked'); | ||
} | ||
|
||
render() { | ||
let addressTitle = this.props.address.streetNumber + ' ' + | ||
this.props.address.street; | ||
if (this.props.address.unit) { | ||
addressTitle = addressTitle + this.props.address.unit; | ||
} | ||
//TODO: Determine whether this needs to be changed when | ||
// going to production -- understand how react is communicating | ||
// with the server better | ||
let imgSource = null; | ||
if (this.props.photos) { | ||
imgSource = "/images/?id=" + this.props.photos[0]; | ||
} | ||
let viewLink = "/view/" + this.props.id; | ||
let availability =""; | ||
for (let i = 0; i < this.props.availability.length; i++) { | ||
availability = availability + this.props.availability[i]; | ||
if (i < this.props.availability.length - 1) { | ||
availability = availability + ', '; | ||
} | ||
} | ||
let price = "$" + this.props.price; | ||
let location = (this.props.buildingName) ? this.props.buildingName : | ||
(this.props.housingType === 'House') ? 'House' : 'Apartment'; | ||
return ( | ||
<a href = {viewLink}> | ||
<div className="panel panel-default container" | ||
onClick = {(e) => this.onPreviewClick(e)}> | ||
<div className="panel-heading"> | ||
<h3 className="panel-title">{addressTitle}</h3> | ||
</div> | ||
<div className="panel-body"> | ||
<div className='container'> | ||
<div className="row"> | ||
<div className="col-xs-4"> | ||
|
||
{ this.props.photos | ||
? <img src={imgSource} className = "img-fluid | ||
img-thumbnail" | ||
alt='preview of property'> | ||
</img> | ||
: null | ||
} | ||
</div> | ||
<div className="col-xs-8"> | ||
<dl className="row"> | ||
<dt className="col-xs-3">Availability</dt> | ||
<dd className="col-xs-9">{availability}</dd> | ||
|
||
<dt className="col-xs-3">Price</dt> | ||
<dd className="col-xs-9">{price}</dd> | ||
|
||
<dt className="col-xs-3">Location</dt> | ||
<dd className="col-xs-9">{location}</dd> | ||
</dl> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</a>); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
import Preview from './Preview'; | ||
import 'bootstrap/dist/css/bootstrap.css'; | ||
import 'bootstrap/dist/css/bootstrap-theme.css'; | ||
import * as initialState from '../initialState'; | ||
|
||
window.jQuery = window.$ = require('jquery'); | ||
|
||
|
||
export default class ResultsContainer extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
console.log(this.props.store.getState()); | ||
this.state = this.props.store.getState(); | ||
} | ||
|
||
|
||
componentDidMount() { | ||
this.props.store.subscribe(function () { | ||
this.setState(this.props.store.getState()); | ||
}.bind(this)); | ||
} | ||
|
||
render() { | ||
var resultsArray = Array(); | ||
for (var i = 0; i < this.state.listings.length; i++) { | ||
console.log(this.state.listings[i]); | ||
const currResult = (<Preview | ||
key = {i} | ||
housingType = {this.state.listings[i].housingType} | ||
address = {this.state.addresses[i]} | ||
photos = {this.state.listings[i].photos} | ||
availability = {this.state.listings[i].term} | ||
buildingName = {this.state.listings[i].buildingName} | ||
price = {this.state.listings[i].price} | ||
id = {this.state.listings[i]._id}> | ||
</Preview>); | ||
resultsArray.push(currResult); | ||
} | ||
return ( | ||
<div className='results-container container'> | ||
<div className='results'> | ||
{resultsArray} | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Oops, something went wrong.