diff --git a/frontend-react/src/components/App.js b/frontend-react/src/components/App.js index 2ed62b7..b5b0be7 100644 --- a/frontend-react/src/components/App.js +++ b/frontend-react/src/components/App.js @@ -2,19 +2,19 @@ import React from "react"; import PropTypes from "prop-types"; import withStyles from "@material-ui/core/styles/withStyles"; import { connect } from "react-redux"; -import { ITEMS_CHANGED, USER_DATA_CHANGED } from "constants/actionTypes"; -import { areObjectEqual } from "utils/helpers"; -import { createOlxLink } from "utils/createOlxLink"; +import { ITEMS_CHANGED, USER_DATA_CHANGED } from "../constants/actionTypes"; +import { areObjectEqual } from "../utils/helpers"; +import { createOlxLink } from "../utils/createOlxLink"; import axios from "axios"; -import image from "assets/img/sidebar-1.jpg"; -import logo from "assets/img/reactlogo.png"; +import image from "../assets/img/sidebar-1.jpg"; +import logo from "../assets/img/reactlogo.png"; -import Sidebar from "components/Sidebar.js"; +import Sidebar from "../components/Sidebar.js"; import ItemsContainer from "./items/itemscontainer/ItemsContainer"; import NotificationModal from "./NotificationModal"; -import dashboardStyle from "assets/dashboardStyle.js"; +import dashboardStyle from "../assets/dashboardStyle.js"; const mapStateToProps = state => { return { diff --git a/frontend-react/src/components/NotificationModal.js b/frontend-react/src/components/NotificationModal.js index 52ac829..05cec41 100644 --- a/frontend-react/src/components/NotificationModal.js +++ b/frontend-react/src/components/NotificationModal.js @@ -5,8 +5,8 @@ import DialogContent from "@material-ui/core/DialogContent"; import DialogActions from "@material-ui/core/DialogActions"; import Slide from "@material-ui/core/Slide"; import withStyles from "@material-ui/core/styles/withStyles"; -import { notificationmodalwrapper } from "utils/notificationmodalwrapper"; -import modalStyle from "assets/modalStyle.js"; +import { notificationmodalwrapper } from "../utils/notificationmodalwrapper"; +import modalStyle from "../assets/modalStyle.js"; import Button from "@material-ui/core/Button"; import IconButton from "@material-ui/core/IconButton"; import Close from "@material-ui/icons/Close"; diff --git a/frontend-react/src/components/Sidebar.js b/frontend-react/src/components/Sidebar.js index bacd332..bba72f8 100644 --- a/frontend-react/src/components/Sidebar.js +++ b/frontend-react/src/components/Sidebar.js @@ -12,16 +12,15 @@ import ExpandMore from "@material-ui/icons/ExpandMore"; import Collapse from "@material-ui/core/Collapse"; import StarBorder from "@material-ui/icons/StarBorder"; -import sidebarStyle from "assets/sidebarStyle.js"; -import CollapseWrapperStyled from "components/widgets/CollapseWrapperStyled"; +import sidebarStyle from "../assets/sidebarStyle.js"; +import CollapseWrapperStyled from "../components/widgets/CollapseWrapperStyled"; import DeepCategoryWrapper from "./widgets/DeepCategoryWrapper"; -import { hoc } from "utils/helpers"; +import { hoc } from "../utils/helpers"; -import * as Vozila from "./categories/Vozila"; import * as Nekretnine from "./categories/Nekretnine"; import { connect } from "react-redux"; -import { CATEGORY_SELECT } from "constants/actionTypes"; +import { CATEGORY_SELECT } from "../constants/actionTypes"; const options = [ { value: "Nekretnine", label: "Nekretnine" } diff --git a/frontend-react/src/components/categories/Vozila.js b/frontend-react/src/components/categories/Vozila.js deleted file mode 100644 index 60a1c12..0000000 --- a/frontend-react/src/components/categories/Vozila.js +++ /dev/null @@ -1,20 +0,0 @@ -import React from "react"; - -import Automobili from "../subcategories/vozila/Automobili"; -import Motocikli from "../subcategories/vozila/Motocikli"; - -const options = [ - { value: 18, label: "Automobili" }, - { value: 21, label: "Motocikli" } -]; -const depth = 0; -const childrenComponents = { - 18: , - 21: -}; - -export const properties = { - options, - depth, - childrenComponents -}; diff --git a/frontend-react/src/components/filters/NekretnineFilter/index.js b/frontend-react/src/components/filters/NekretnineFilter/index.js index d130f98..bf80832 100644 --- a/frontend-react/src/components/filters/NekretnineFilter/index.js +++ b/frontend-react/src/components/filters/NekretnineFilter/index.js @@ -1,9 +1,9 @@ import React from "react"; import * as Filters from "./AllFiltersDefined"; -import CheckboxAndRadioWrapper from "components/widgets/CheckboxAndRadioWrapper"; -import SelectDisplayCheckboxWrapper from "components/widgets/SelectDisplayCheckboxWrapper"; -import RangeWrapper from "components/widgets/RangeWrapper"; -import DropDownWrapper from "components/widgets/DropDownWrapper"; +import CheckboxAndRadioWrapper from "../../widgets/CheckboxAndRadioWrapper"; +import SelectDisplayCheckboxWrapper from "../../widgets/SelectDisplayCheckboxWrapper"; +import RangeWrapper from "../../widgets/RangeWrapper"; +import DropDownWrapper from "../../widgets/DropDownWrapper"; const Kanton = ( diff --git a/frontend-react/src/components/subcategories/nekretnine/Kuce.js b/frontend-react/src/components/subcategories/nekretnine/Kuce.js index d517524..37571b2 100644 --- a/frontend-react/src/components/subcategories/nekretnine/Kuce.js +++ b/frontend-react/src/components/subcategories/nekretnine/Kuce.js @@ -1,4 +1,4 @@ -import { WrapAll } from "components/widgets/CollapseWrapperAll"; +import { WrapAll } from "../../widgets/CollapseWrapperAll"; import { Kanton, Grad, @@ -7,7 +7,7 @@ import { Vrsta, Kvadratura, DodatnoZaKucu -} from "components/filters/NekretnineFilter/index"; +} from "../../filters/NekretnineFilter/index"; const KuceFilters = [ Kanton, diff --git a/frontend-react/src/components/subcategories/nekretnine/Stanovi.js b/frontend-react/src/components/subcategories/nekretnine/Stanovi.js index 9b904b8..6899131 100644 --- a/frontend-react/src/components/subcategories/nekretnine/Stanovi.js +++ b/frontend-react/src/components/subcategories/nekretnine/Stanovi.js @@ -1,4 +1,4 @@ -import { WrapAll } from "components/widgets/CollapseWrapperAll"; +import { WrapAll } from "../../widgets/CollapseWrapperAll"; import { Kanton, Grad, @@ -7,7 +7,7 @@ import { Vrsta, Kvadratura, DodatnoZaStan -} from "components/filters/NekretnineFilter/index"; +} from "../../filters/NekretnineFilter/index"; const StanFilters = [ Kanton, diff --git a/frontend-react/src/components/subcategories/vozila/Automobili.js b/frontend-react/src/components/subcategories/vozila/Automobili.js deleted file mode 100644 index 4e067bb..0000000 --- a/frontend-react/src/components/subcategories/vozila/Automobili.js +++ /dev/null @@ -1,29 +0,0 @@ -import { WrapAll } from "components/widgets/CollapseWrapperAll"; -import { - Proizvodac, - Kanton, - Grad, - Cijena, - Stanje, - Vrsta, - Godiste, - KilometraMin, - KilometraMax, - Gorivo -} from "components/filters/VozilaFilter/index"; - -const AutomobiliFilters = [ - Proizvodac, - Kanton, - Grad, - Cijena, - Stanje, - Vrsta, - Godiste, - KilometraMin, - KilometraMax, - Gorivo -]; -const Automobili = () => WrapAll(AutomobiliFilters); - -export default Automobili; diff --git a/frontend-react/src/components/widgets/CheckboxAndRadioWrapper.js b/frontend-react/src/components/widgets/CheckboxAndRadioWrapper.js index 90decfe..f51e247 100644 --- a/frontend-react/src/components/widgets/CheckboxAndRadioWrapper.js +++ b/frontend-react/src/components/widgets/CheckboxAndRadioWrapper.js @@ -1,8 +1,8 @@ import React from "react"; -import { optionchangewrapper } from "utils/optionchangewrapper"; +import { optionchangewrapper } from "../../utils/optionchangewrapper"; import Checkbox from "@material-ui/core/Checkbox"; import Radio from "@material-ui/core/Radio"; -import "assets/checkboxAndRadioStyle.css"; +import "../../assets/checkboxAndRadioStyle.css"; class CheckboxAndRadioWrapper extends React.Component { optionChange = (option, optionName, type) => { diff --git a/frontend-react/src/components/widgets/CollapseWrapperStyled.js b/frontend-react/src/components/widgets/CollapseWrapperStyled.js index 0adb30a..39bc132 100644 --- a/frontend-react/src/components/widgets/CollapseWrapperStyled.js +++ b/frontend-react/src/components/widgets/CollapseWrapperStyled.js @@ -1,9 +1,9 @@ import React from "react"; import { connect } from "react-redux"; -import { OPTION_EXPAND_CHANGE } from "constants/actionTypes"; +import { OPTION_EXPAND_CHANGE } from "../../constants/actionTypes"; import withStyles from "@material-ui/core/styles/withStyles"; -import sidebarStyle from "assets/sidebarStyle.js"; +import sidebarStyle from "../../assets/sidebarStyle.js"; import Collapse from "@material-ui/core/Collapse"; import ListItem from "@material-ui/core/ListItem"; import ListItemIcon from "@material-ui/core/ListItemIcon"; diff --git a/frontend-react/src/components/widgets/DeepCategoryWrapper.js b/frontend-react/src/components/widgets/DeepCategoryWrapper.js index fe197a1..a529151 100644 --- a/frontend-react/src/components/widgets/DeepCategoryWrapper.js +++ b/frontend-react/src/components/widgets/DeepCategoryWrapper.js @@ -1,9 +1,9 @@ import React from "react"; -import { subcategorywrapper } from "utils/subcategorywrapper"; -import { hoc } from "utils/helpers"; +import { subcategorywrapper } from "../../utils/subcategorywrapper"; +import { hoc } from "../../utils/helpers"; import withStyles from "@material-ui/core/styles/withStyles"; -import sidebarStyle from "assets/sidebarStyle.js"; +import sidebarStyle from "../../assets/sidebarStyle.js"; import List from "@material-ui/core/List"; import ListItem from "@material-ui/core/ListItem"; import ListItemIcon from "@material-ui/core/ListItemIcon"; diff --git a/frontend-react/src/components/widgets/DropDownWrapper.js b/frontend-react/src/components/widgets/DropDownWrapper.js index b216c07..4bf9a17 100644 --- a/frontend-react/src/components/widgets/DropDownWrapper.js +++ b/frontend-react/src/components/widgets/DropDownWrapper.js @@ -1,12 +1,12 @@ import React from "react"; -import { optionchangewrapper } from "utils/optionchangewrapper"; +import { optionchangewrapper } from "../../utils/optionchangewrapper"; import withStyles from "@material-ui/core/styles/withStyles"; import List from "@material-ui/core/List"; import ListItem from "@material-ui/core/ListItem"; import ListItemIcon from "@material-ui/core/ListItemIcon"; import ListItemText from "@material-ui/core/ListItemText"; -import sidebarStyle from "assets/sidebarStyle.js"; +import sidebarStyle from "../../assets/sidebarStyle.js"; import StarBorder from "@material-ui/icons/StarBorder"; class DropdownWrapper extends React.Component { diff --git a/frontend-react/src/components/widgets/RangeWrapper.js b/frontend-react/src/components/widgets/RangeWrapper.js index 3732ce0..597b2af 100644 --- a/frontend-react/src/components/widgets/RangeWrapper.js +++ b/frontend-react/src/components/widgets/RangeWrapper.js @@ -1,7 +1,7 @@ import React from "react"; import { Range } from "rc-slider"; -import { optionchangewrapper } from "utils/optionchangewrapper"; -import "assets/rangeStyle.css"; +import { optionchangewrapper } from "../../utils/optionchangewrapper"; +import "../../assets/rangeStyle.css"; import "rc-slider/assets/index.css"; import Input from "@material-ui/core/Input"; diff --git a/frontend-react/src/components/widgets/SelectDisplayCheckboxWrapper.js b/frontend-react/src/components/widgets/SelectDisplayCheckboxWrapper.js index 773ad33..a527008 100644 --- a/frontend-react/src/components/widgets/SelectDisplayCheckboxWrapper.js +++ b/frontend-react/src/components/widgets/SelectDisplayCheckboxWrapper.js @@ -1,6 +1,6 @@ import React from "react"; -import CheckboxAndRadioWrapper from "components/widgets/CheckboxAndRadioWrapper"; -import { optionchangewrapper } from "utils/optionchangewrapper"; +import CheckboxAndRadioWrapper from "../../components/widgets/CheckboxAndRadioWrapper"; +import { optionchangewrapper } from "../../utils/optionchangewrapper"; class SelectDisplayCheckboxWrapper extends React.Component { render() { diff --git a/frontend-react/src/reducers/category.js b/frontend-react/src/reducers/category.js index 42e8436..975e13d 100644 --- a/frontend-react/src/reducers/category.js +++ b/frontend-react/src/reducers/category.js @@ -1,4 +1,4 @@ -import { CATEGORY_SELECT } from "constants/actionTypes"; +import { CATEGORY_SELECT } from "../constants/actionTypes"; export default (state = null, action) => { switch (action.type) { diff --git a/frontend-react/src/reducers/items.js b/frontend-react/src/reducers/items.js index c819850..bc29c22 100644 --- a/frontend-react/src/reducers/items.js +++ b/frontend-react/src/reducers/items.js @@ -3,7 +3,7 @@ import { SUBCATEGORY_SELECT, CATEGORY_SELECT, OPTION_CHANGE -} from "constants/actionTypes"; +} from "../constants/actionTypes"; export default (state = [], action) => { switch (action.type) { diff --git a/frontend-react/src/reducers/modal.js b/frontend-react/src/reducers/modal.js index 9ee95cc..adaebdb 100644 --- a/frontend-react/src/reducers/modal.js +++ b/frontend-react/src/reducers/modal.js @@ -1,4 +1,4 @@ -import { MODAL_CLOSE, MODAL_OPEN } from "constants/actionTypes"; +import { MODAL_CLOSE, MODAL_OPEN } from "../constants/actionTypes"; export default (state = false, action) => { switch (action.type) { diff --git a/frontend-react/src/reducers/options.js b/frontend-react/src/reducers/options.js index b78d0b1..360d5d0 100644 --- a/frontend-react/src/reducers/options.js +++ b/frontend-react/src/reducers/options.js @@ -2,7 +2,7 @@ import { SUBCATEGORY_SELECT, CATEGORY_SELECT, OPTION_CHANGE -} from "constants/actionTypes"; +} from "../constants/actionTypes"; export default (state = {}, action) => { switch (action.type) { diff --git a/frontend-react/src/reducers/subcategory.js b/frontend-react/src/reducers/subcategory.js index 2474350..12e3e06 100644 --- a/frontend-react/src/reducers/subcategory.js +++ b/frontend-react/src/reducers/subcategory.js @@ -1,4 +1,4 @@ -import { SUBCATEGORY_SELECT, CATEGORY_SELECT } from "constants/actionTypes"; +import { SUBCATEGORY_SELECT, CATEGORY_SELECT } from "../constants/actionTypes"; export default (state = {}, action) => { switch (action.type) { diff --git a/frontend-react/src/reducers/uiexpand.js b/frontend-react/src/reducers/uiexpand.js index 59d0f44..37fa1f3 100644 --- a/frontend-react/src/reducers/uiexpand.js +++ b/frontend-react/src/reducers/uiexpand.js @@ -2,7 +2,7 @@ import { OPTION_EXPAND_CHANGE, CATEGORY_SELECT, SUBCATEGORY_SELECT -} from "constants/actionTypes"; +} from "../constants/actionTypes"; export default (state = {}, action) => { switch (action.type) { diff --git a/frontend-react/src/reducers/userdata.js b/frontend-react/src/reducers/userdata.js index e8e1046..fb04eb7 100644 --- a/frontend-react/src/reducers/userdata.js +++ b/frontend-react/src/reducers/userdata.js @@ -1,4 +1,4 @@ -import { USER_DATA_CHANGED } from "constants/actionTypes"; +import { USER_DATA_CHANGED } from "../constants/actionTypes"; export default (state = {}, action) => { switch (action.type) { diff --git a/frontend-react/src/utils/notificationmodalwrapper.js b/frontend-react/src/utils/notificationmodalwrapper.js index 60f0ba3..ca3d417 100644 --- a/frontend-react/src/utils/notificationmodalwrapper.js +++ b/frontend-react/src/utils/notificationmodalwrapper.js @@ -3,7 +3,7 @@ import { MODAL_CLOSE, MODAL_OPEN, USER_DATA_CHANGED -} from "constants/actionTypes"; +} from "../constants/actionTypes"; const mapStateToProps = state => { return { diff --git a/frontend-react/src/utils/optionchangewrapper.js b/frontend-react/src/utils/optionchangewrapper.js index e3093a0..e257ad4 100644 --- a/frontend-react/src/utils/optionchangewrapper.js +++ b/frontend-react/src/utils/optionchangewrapper.js @@ -1,5 +1,5 @@ import { connect } from "react-redux"; -import { OPTION_CHANGE } from "constants/actionTypes"; +import { OPTION_CHANGE } from "../constants/actionTypes"; const mapStateToProps = state => { return { diff --git a/frontend-react/src/utils/subcategorywrapper.js b/frontend-react/src/utils/subcategorywrapper.js index f25cdcc..99ecdae 100644 --- a/frontend-react/src/utils/subcategorywrapper.js +++ b/frontend-react/src/utils/subcategorywrapper.js @@ -1,5 +1,5 @@ import { connect } from "react-redux"; -import { SUBCATEGORY_SELECT } from "constants/actionTypes"; +import { SUBCATEGORY_SELECT } from "../constants/actionTypes"; const mapStateToProps = state => { return { diff --git a/backend/index.js b/index.js similarity index 88% rename from backend/index.js rename to index.js index 890549a..5ad208b 100644 --- a/backend/index.js +++ b/index.js @@ -1,10 +1,10 @@ let express = require("express"); const path = require("path"); const bodyParser = require("body-parser"); -const MarketAlert = require("./MarketAlert"); -const sendNotification = require("./utils/sendnotification"); -const scrapTheItems = require("./utils/scraptheitems"); -const sequelize = require("./db.js"); +const MarketAlert = require("./backend/MarketAlert"); +const sendNotification = require("./backend/utils/sendnotification"); +const scrapTheItems = require("./backend/utils/scraptheitems"); +const sequelize = require("./backend/db.js"); const Twocheckout = require("2checkout-node"); const app = express(); @@ -98,7 +98,7 @@ 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')) + res.sendFile(path.join(__dirname + './frontend-react/build/index.html')) }) app.listen(port, () => console.log(`Example app listening on port ${port}!`)); diff --git a/package.json b/package.json index 2b5e24d..6654e59 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,11 @@ "name": "marketalarm", "version": "1.0.0", "description": "Market Alarm", - "main": "./backend/index.js", + "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node ./index.js", + "heroku-postbuild": "cd frontend-react && npm install && npm run build" }, "repository": { "type": "git", @@ -16,10 +18,12 @@ "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" + "2checkout-node": "0.0.1", + "@sendgrid/mail": "^6.3.1", + "cheerio": "^1.0.0-rc.2", + "express": "^4.16.4", + "mysql2": "^1.6.4", + "node-fetch": "^2.3.0", + "sequelize": "^4.42.0" } }