Compare commits

...

7 Commits

Author SHA1 Message Date
Senad Uka
7fc24add1f Package json 2019-03-13 05:43:48 +01:00
Senad Uka
b1a08a7a57 Started porting to heroku 2019-03-12 05:12:02 +01:00
=
1f7063f94e Assume email when creating notifications 2019-03-08 07:33:19 -08:00
=
8a1e406f43 Don't show actual results just the counts 2019-03-07 12:49:19 -08:00
Edin
01b864d75b Merge branch 'remove-payment-step' into 'master'
Remove payment step

See merge request saburly/marketalarm/web!1
2019-03-06 19:32:34 +00:00
=
b7cb61b53b Don't contact TCO api 2019-03-06 11:31:10 -08:00
=
a957293029 Removed card info inputs
Left to do:
  - Remove TCO integration calls
  - Actually save notification
  - Display a nice message
2019-03-05 09:31:04 -08:00
8 changed files with 1224 additions and 102 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules/

1
Procfile Normal file
View File

@@ -0,0 +1 @@
web: node ./backend/index.js

View File

@@ -49,15 +49,17 @@ app.get("/items/:url", async (req, res) => {
app.post("/marketalerts", function(req, res) { app.post("/marketalerts", function(req, res) {
const { email, last_date, olx_url } = req.body; const { email, last_date, olx_url } = req.body;
console.log(email, last_date, olx_url); console.log(email, last_date, olx_url);
res.json({ message: "Market Alert Created!" }); sequelize.sync().then(() => {
// sequelize.sync().then(() => MarketAlert.create({
// MarketAlert.create({ olx_url,
// olx_url, last_date,
// last_date, email
// email })
// }) .then(() => {
// ); res.json({ message: "Market Alert Created!" });
// res.json({ message: "Market Alert Created!" }); })
.catch(e => console.error(e));
});
}); });
app.post("/payforalert", function(request, response) { app.post("/payforalert", function(request, response) {
@@ -93,4 +95,10 @@ app.post("/payforalert", function(request, response) {
}); });
}); });
// Anything that doesn't match the above, send back index.html
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname + '/../frontend-react/build/index.html'))
})
app.listen(port, () => console.log(`Example app listening on port ${port}!`)); app.listen(port, () => console.log(`Example app listening on port ${port}!`));

View File

@@ -20,6 +20,10 @@ const appStyle = theme => ({
zIndex: "1", zIndex: "1",
backgroundColor: "#272727", backgroundColor: "#272727",
backgroundImage: "linear-gradient(180deg,#272727, #21525f)" backgroundImage: "linear-gradient(180deg,#272727, #21525f)"
},
itemsCountTitle: {
textAlign: 'center',
color: 'white'
} }
}); });

View File

@@ -84,9 +84,8 @@ class App extends React.Component {
return ( return (
<div className={classes.wrapper}> <div className={classes.wrapper}>
<Sidebar logoText={"Market Alarm"} logo={logo} image={image} /> <Sidebar logoText={"Market Alarm"} logo={logo} image={image} />
<div className={classes.mainPanel}> <div className={classes.mainPanel}>
<ItemsContainer /> {items.length && <h3 className={classes.itemsCountTitle}>Pronađeno {items.length} nekretnina. Napravite notifikaciju i primite vise detalja na vas emailu adresu.</h3>}
{items.length ? <NotificationModal /> : null} {items.length ? <NotificationModal /> : null}
</div> </div>
</div> </div>

View File

@@ -62,7 +62,7 @@ class NotificationModal extends React.Component {
}; };
successCallback = data => { successCallback = data => {
token = data.response.token.token; //token = data.response.token.token;
const { const {
userdata: { email, last_date, olx_url } userdata: { email, last_date, olx_url }
} = this.props; } = this.props;
@@ -73,18 +73,10 @@ class NotificationModal extends React.Component {
last_date, last_date,
olx_url olx_url
}) })
.then(response => .then(response => {
axios this.handleClose();
.post("/payforalert", { alert("Market Alert Created");
email, })
token
})
.then(response => {
this.handleClose();
alert("Market Alert Created");
})
.catch(error => console.log(error))
)
.catch(error => console.log(error)); .catch(error => console.log(error));
}; };
@@ -114,7 +106,8 @@ class NotificationModal extends React.Component {
}; };
handleSaveMarketAlert = () => { handleSaveMarketAlert = () => {
this.tokenRequest(); this.successCallback();
//this.tokenRequest();
}; };
render() { render() {
@@ -161,82 +154,22 @@ class NotificationModal extends React.Component {
id="classic-modal-slide-description" id="classic-modal-slide-description"
className={classes.modalBody} className={classes.modalBody}
> >
<FormControlLabel <div>
className={classes.whiteText} <Input
control={ className={classes.inputStyle}
<Checkbox placeholder="Email"
className={classes.checkBoxStyle} inputProps={{
checked={this.isChecked("emailChecked")} "aria-label": "Email"
type={"checkbox"} }}
value={""} type="email"
onChange={() => this.optionChange("emailChecked")} onChange={this.handleEmail}
/> />
} <Input
label={<Typography style={{ color: "white" }}>Email</Typography>} className={classes.inputStyle}
/> type="hidden"
value={token}
{this.isChecked("emailChecked") ? ( />
<div> </div>
<Input
className={classes.inputStyle}
placeholder="Email"
inputProps={{
"aria-label": "Email"
}}
type="email"
onChange={this.handleEmail}
/>
<Input
className={classes.inputStyle}
type="hidden"
value={token}
/>
<Input
className={classes.inputStyle}
placeholder="Card Number"
inputProps={{
"aria-label": "Card Number"
}}
required
autoComplete="off"
type="number"
onChange={e => this.handleInput(e, "ccNo")}
/>
<Input
className={classes.inputStyle}
placeholder="Expiration Year"
inputProps={{
"aria-label": "Expiration Year"
}}
required
autoComplete="off"
type="number"
onChange={e => this.handleInput(e, "expYear")}
/>
<Input
className={classes.inputStyle}
placeholder="Expiration Month"
inputProps={{
"aria-label": "Expiration Month"
}}
required
autoComplete="off"
type="number"
onChange={e => this.handleInput(e, "expMonth")}
/>
<Input
className={classes.inputStyle}
placeholder="CVV"
inputProps={{
"aria-label": "CVV"
}}
required
autoComplete="off"
type="number"
onChange={e => this.handleInput(e, "cvv")}
/>
</div>
) : null}
</DialogContent> </DialogContent>
<DialogActions className={classes.modalFooter}> <DialogActions className={classes.modalFooter}>
{validEmail ? ( {validEmail ? (

1153
package-lock.json generated

File diff suppressed because it is too large Load Diff

25
package.json Normal file
View File

@@ -0,0 +1,25 @@
{
"name": "marketalarm",
"version": "1.0.0",
"description": "Market Alarm",
"main": "./backend/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git@gitlab.com:saburly/marketalarm/web.git"
},
"author": "Saburlije",
"license": "ISC",
"engines": {
"node": "11.10.x"
},
"dependencies": {
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node ./backend/index.js",
"heroku-postbuild": "cd frontend-react && npm install && npm run build && cd .. && cd backend && npm install"
}
}