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) {
const { email, last_date, olx_url } = req.body;
console.log(email, last_date, olx_url);
res.json({ message: "Market Alert Created!" });
// sequelize.sync().then(() =>
// MarketAlert.create({
// olx_url,
// last_date,
// email
// })
// );
// res.json({ message: "Market Alert Created!" });
sequelize.sync().then(() => {
MarketAlert.create({
olx_url,
last_date,
email
})
.then(() => {
res.json({ message: "Market Alert Created!" });
})
.catch(e => console.error(e));
});
});
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}!`));

View File

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

View File

@@ -84,9 +84,8 @@ class App extends React.Component {
return (
<div className={classes.wrapper}>
<Sidebar logoText={"Market Alarm"} logo={logo} image={image} />
<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}
</div>
</div>

View File

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