diff --git a/Timeline.md b/Timeline.md index d68e1de..5bdfdbb 100755 --- a/Timeline.md +++ b/Timeline.md @@ -1,18 +1,27 @@ -Proposed Project TimeLine -Starts : May 11, 2020 -Week 1: -Frontend - UI layout for Home Page, - UI layout for Login Page, - UI layout for Sign up Page -Week 2: -Frontend - UI layout for Category browsing, - UI layout for Item Detail Page, -Week 3: -Frontend - UI layout for Contact Page, - UI layout for Profile Page, - UI layout for Chats Page, - UI layout complete +# Proposed Project TimeLine + +### Starts : May 11, 2020 +**** +#### Week 1: +##### Frontend +- [x] UI layout for Home Page, +- [x] UI layout for Login Page, +- [x] UI layout for Sign up Page + +**** + +#### Week 2: +##### Frontend +- [x] UI layout for Category browsing, +- [x] UI layout for Item Detail Page, + + +**** + +#### Week 3: +##### Frontend +- [ ] UI layout for Contact Page, +- [ ] UI layout for Profile Page, +- [ ] UI layout for Chats Page, +- [ ] UI layout complete diff --git a/package-lock.json b/package-lock.json index 7de2f67..c859a29 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1631,6 +1631,16 @@ "resolved": "https://registry.npmjs.org/@types/history/-/history-4.7.5.tgz", "integrity": "sha512-wLD/Aq2VggCJXSjxEwrMafIP51Z+13H78nXIX0ABEuIGhmB5sNGbR113MOKo+yfw+RDo1ZU3DM6yfnnRF/+ouw==" }, + "@types/hoist-non-react-statics": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", + "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", + "dev": true, + "requires": { + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0" + } + }, "@types/istanbul-lib-coverage": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", @@ -1708,6 +1718,18 @@ "@types/react": "*" } }, + "@types/react-redux": { + "version": "7.1.9", + "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.9.tgz", + "integrity": "sha512-mpC0jqxhP4mhmOl3P4ipRsgTgbNofMRXJb08Ms6gekViLj61v1hOZEKWDCyWsdONr6EjEA6ZHXC446wdywDe0w==", + "dev": true, + "requires": { + "@types/hoist-non-react-statics": "^3.3.0", + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0", + "redux": "^4.0.0" + } + }, "@types/react-router": { "version": "5.1.7", "resolved": "https://registry.npmjs.org/@types/react-router/-/react-router-5.1.7.tgz", @@ -1727,6 +1749,12 @@ "@types/react-router": "*" } }, + "@types/socket.io-client": { + "version": "1.4.33", + "resolved": "https://registry.npmjs.org/@types/socket.io-client/-/socket.io-client-1.4.33.tgz", + "integrity": "sha512-m4LnxkljsI9fMsjwpW5QhRpMixo2BeeLpFmg0AE+sS4H1pzAd/cs/ftTiL60FLZgfFa8PFRPx5KsHu8O0bADKQ==", + "dev": true + }, "@types/stack-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", @@ -2158,6 +2186,11 @@ } } }, + "after": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" + }, "aggregate-error": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", @@ -2319,6 +2352,11 @@ "es-abstract": "^1.17.0-next.1" } }, + "arraybuffer.slice": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" + }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -2434,6 +2472,37 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" }, + "axios": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "requires": { + "follow-redirects": "1.5.10" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, "axobject-query": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.1.2.tgz", @@ -2837,6 +2906,11 @@ "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==" }, + "backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -2897,6 +2971,11 @@ } } }, + "base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" + }, "base64-js": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", @@ -2915,6 +2994,14 @@ "tweetnacl": "^0.14.3" } }, + "better-assert": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "requires": { + "callsite": "1.0.0" + } + }, "big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", @@ -2925,6 +3012,20 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==" }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, + "blob": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", + "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==" + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -3262,6 +3363,11 @@ "caller-callsite": "^2.0.0" } }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" + }, "callsites": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", @@ -3599,11 +3705,21 @@ "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", "dev": true }, + "component-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" + }, "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" }, + "component-inherit": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" + }, "compose-function": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/compose-function/-/compose-function-3.0.3.tgz", @@ -4639,6 +4755,46 @@ "once": "^1.4.0" } }, + "engine.io-client": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.2.tgz", + "integrity": "sha512-AWjc1Xg06a6UPFOBAzJf48W1UR/qKYmv/ubgSCumo9GXgvL/xGIvo05dXoBL+2NTLMipDI7in8xK61C17L25xg==", + "requires": { + "component-emitter": "~1.3.0", + "component-inherit": "0.0.3", + "debug": "~4.1.0", + "engine.io-parser": "~2.2.0", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "~6.1.0", + "xmlhttprequest-ssl": "~1.5.4", + "yeast": "0.1.2" + }, + "dependencies": { + "ws": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz", + "integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==", + "requires": { + "async-limiter": "~1.0.0" + } + } + } + }, + "engine.io-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.0.tgz", + "integrity": "sha512-6I3qD9iUxotsC5HEMuuGsKA0cXerGz+4uGcXQEkfBidgKf0amsjrrtwcbwK/nzpZBxclXlV7gGl9dgWvu4LF6w==", + "requires": { + "after": "0.8.2", + "arraybuffer.slice": "~0.0.7", + "base64-arraybuffer": "0.1.5", + "blob": "0.0.5", + "has-binary2": "~1.0.2" + } + }, "enhanced-resolve": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz", @@ -5845,6 +6001,12 @@ "schema-utils": "^2.5.0" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "optional": true + }, "filesize": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.0.1.tgz", @@ -6369,6 +6531,26 @@ } } }, + "has-binary2": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", + "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", + "requires": { + "isarray": "2.0.1" + }, + "dependencies": { + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + } + } + }, + "has-cors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -6648,9 +6830,9 @@ "integrity": "sha1-ksnBN0w1CF912zWexWzCV8u5P6Q=" }, "http-proxy": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.0.tgz", - "integrity": "sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", "requires": { "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", @@ -6776,6 +6958,11 @@ "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=" }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" + }, "infer-owner": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", @@ -7425,7 +7612,11 @@ "version": "1.2.13", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } } } }, @@ -8540,6 +8731,12 @@ "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", "dev": true }, + "nan": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", + "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==", + "optional": true + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -8788,6 +8985,11 @@ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, + "object-component": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=" + }, "object-copy": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", @@ -9180,6 +9382,22 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" }, + "parseqs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", + "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseuri": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", + "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "requires": { + "better-assert": "~1.0.0" + } + }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -10611,6 +10829,11 @@ "whatwg-fetch": "^3.0.0" } }, + "react-axios": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/react-axios/-/react-axios-2.0.3.tgz", + "integrity": "sha512-63kY2iupdRgbvPq9G8xmM0NWUnt2Q5YmpotMoLQsxKOzKXKZg2Lo6CzF/bcZvtmv3WnfjBU6Bg8nZQO28eIAZw==" + }, "react-dev-utils": { "version": "10.2.1", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-10.2.1.tgz", @@ -10963,6 +11186,18 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "react-redux": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.0.tgz", + "integrity": "sha512-EvCAZYGfOLqwV7gh849xy9/pt55rJXPwmYvI4lilPM5rUT/1NxuuN59ipdBksRVSvz0KInbPnp4IfoXJXCqiDA==", + "requires": { + "@babel/runtime": "^7.5.5", + "hoist-non-react-statics": "^3.3.0", + "loose-envify": "^1.4.0", + "prop-types": "^15.7.2", + "react-is": "^16.9.0" + } + }, "react-router": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz", @@ -11173,6 +11408,20 @@ "strip-indent": "^3.0.0" } }, + "redux": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.0.5.tgz", + "integrity": "sha512-VSz1uMAH24DM6MF72vcojpYPtrTUu3ByVWfPL1nPfVRb5mZVTve5GnNCUV53QM/BZ66xfWrm0CTWoM+Xlz8V1w==", + "requires": { + "loose-envify": "^1.4.0", + "symbol-observable": "^1.2.0" + } + }, + "redux-thunk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.3.0.tgz", + "integrity": "sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw==" + }, "regenerate": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", @@ -12074,6 +12323,69 @@ "kind-of": "^3.2.0" } }, + "socket.io-client": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.3.0.tgz", + "integrity": "sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA==", + "requires": { + "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "~4.1.0", + "engine.io-client": "~3.4.0", + "has-binary2": "~1.0.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "socket.io-parser": "~3.3.0", + "to-array": "0.1.4" + }, + "dependencies": { + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + } + } + }, + "socket.io-parser": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.0.tgz", + "integrity": "sha512-hczmV6bDgdaEbVqhAeVMM/jfUfzuEZHsQg6eOmLgJht6G3mPKMxYm75w2+qhAQZ+4X+1+ATZ+QFKeOZD5riHng==", + "requires": { + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "isarray": "2.0.1" + }, + "dependencies": { + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, "sockjs": { "version": "0.3.19", "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.19.tgz", @@ -12630,6 +12942,11 @@ "util.promisify": "~1.0.0" } }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==" + }, "symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", @@ -12897,6 +13214,11 @@ "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=" }, + "to-array": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" + }, "to-arraybuffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", @@ -13364,7 +13686,11 @@ "version": "1.2.13", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "glob-parent": { "version": "3.1.0", @@ -13670,7 +13996,11 @@ "version": "1.2.13", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "get-caller-file": { "version": "1.0.3", @@ -14249,6 +14579,11 @@ "integrity": "sha512-yS2uJflVQs6n+CyjHoaBmVSqIDevTAWrzMmjG1Gc7h1qQ7uVozNhEPJAwZXWyGQ/Gafo3fCwrcaokezLPupVyQ==", "dev": true }, + "xmlhttprequest-ssl": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", + "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=" + }, "xregexp": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.3.0.tgz", @@ -14360,6 +14695,11 @@ "camelcase": "^5.0.0", "decamelize": "^1.2.0" } + }, + "yeast": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" } } } diff --git a/package.json b/package.json index acf6dd3..2a9aee4 100644 --- a/package.json +++ b/package.json @@ -15,12 +15,19 @@ "@types/react-dom": "^16.9.4", "@types/react-router": "^5.1.4", "@types/react-router-dom": "^5.1.3", + "axios": "^0.19.2", "ionicons": "^5.0.0", + "querystring": "^0.2.0", "react": "^16.13.0", + "react-axios": "^2.0.3", "react-dom": "^16.13.0", + "react-redux": "^7.2.0", "react-router": "^5.1.2", "react-router-dom": "^5.1.2", "react-scripts": "3.4.1", + "redux": "^4.0.5", + "redux-thunk": "^2.3.0", + "socket.io-client": "^2.3.0", "typescript": "3.8.3" }, "scripts": { @@ -52,6 +59,8 @@ }, "devDependencies": { "@capacitor/cli": "2.1.0", + "@types/react-redux": "^7.1.9", + "@types/socket.io-client": "^1.4.33", "eslint-config-airbnb-typescript-prettier": "^2.1.1", "prettier": "^2.0.5" }, diff --git a/public/images/bicycle.jfif b/public/images/bicycle.jfif new file mode 100644 index 0000000..a676c9f Binary files /dev/null and b/public/images/bicycle.jfif differ diff --git a/public/images/book.jfif b/public/images/book.jfif new file mode 100644 index 0000000..e5b7287 Binary files /dev/null and b/public/images/book.jfif differ diff --git a/public/images/cycle.jfif b/public/images/cycle.jfif new file mode 100644 index 0000000..cb0d4c0 Binary files /dev/null and b/public/images/cycle.jfif differ diff --git a/public/images/laptop.jfif b/public/images/laptop.jfif new file mode 100644 index 0000000..6019646 Binary files /dev/null and b/public/images/laptop.jfif differ diff --git a/public/images/matteress.jfif b/public/images/matteress.jfif new file mode 100644 index 0000000..5a43d2a Binary files /dev/null and b/public/images/matteress.jfif differ diff --git a/public/images/mobile.jfif b/public/images/mobile.jfif new file mode 100644 index 0000000..225af35 Binary files /dev/null and b/public/images/mobile.jfif differ diff --git a/src/App.test.tsx b/src/App.test.tsx index 25e68dc..ae51219 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -1,10 +1,10 @@ -import React from 'react'; -import { render } from '@testing-library/react'; -import App from './App'; +import React from "react"; +import { render } from "@testing-library/react"; +import App from "./App"; // eslint-disable-next-line no-undef -test('renders without crashing', () => { - const { baseElement } = render(); - // eslint-disable-next-line no-undef - expect(baseElement).toBeDefined(); +test("renders without crashing", () => { + const { baseElement } = render(); + // eslint-disable-next-line no-undef + expect(baseElement).toBeDefined(); }); diff --git a/src/App.tsx b/src/App.tsx index 0527330..1b58861 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,85 +1,109 @@ -import React from 'react'; -import { Redirect, Route } from 'react-router-dom'; +import React from "react"; +import { Redirect, Route } from "react-router-dom"; +import axios from "axios"; +import qs from "querystring"; +import { connect } from "react-redux"; import { - IonApp, - IonIcon, - IonLabel, - IonRouterOutlet, - IonTabBar, - IonTabButton, - IonTabs, -} from '@ionic/react'; -import { IonReactRouter } from '@ionic/react-router'; + IonApp, + IonIcon, + IonLabel, + IonRouterOutlet, + IonTabBar, + IonTabButton, + IonTabs, +} from "@ionic/react"; +import { IonReactRouter } from "@ionic/react-router"; import { - chatboxOutline, - gridOutline, - homeOutline, - personOutline, -} from 'ionicons/icons'; -import Home from './pages/home'; -import Categories from './pages/categories'; -import Chats from './pages/chats'; -import MyAccount from './pages/myaccount'; - + chatboxOutline, + gridOutline, + homeOutline, + personOutline, +} from "ionicons/icons"; +import Home from "./pages/home/home"; +import Categories from "./pages/categories/categories"; +import Chats from "./pages/chats/chats"; +import MyAccount from "./pages/myaccount/myaccount"; +/* new imports */ +import Register from "./pages/register/register"; +import Health from "./pages/Health/Health"; +import ItemDetail from "./components/ItemDetail/ItemDetail"; +import PostAd from "./components/PostAd/PostAd"; /* Core CSS required for Ionic components to work properly */ -import '@ionic/react/css/core.css'; +import "@ionic/react/css/core.css"; /* Basic CSS for apps built with Ionic */ -import '@ionic/react/css/normalize.css'; -import '@ionic/react/css/structure.css'; -import '@ionic/react/css/typography.css'; +import "@ionic/react/css/normalize.css"; +import "@ionic/react/css/structure.css"; +import "@ionic/react/css/typography.css"; /* Optional CSS utils that can be commented out */ -import '@ionic/react/css/padding.css'; -import '@ionic/react/css/float-elements.css'; -import '@ionic/react/css/text-alignment.css'; -import '@ionic/react/css/text-transformation.css'; -import '@ionic/react/css/flex-utils.css'; -import '@ionic/react/css/display.css'; +import "@ionic/react/css/padding.css"; +import "@ionic/react/css/float-elements.css"; +import "@ionic/react/css/text-alignment.css"; +import "@ionic/react/css/text-transformation.css"; +import "@ionic/react/css/flex-utils.css"; +import "@ionic/react/css/display.css"; /* Theme variables */ -import './theme/variables.css'; -import RegisterForm from './components/RegisterForm'; -import Health from './pages/Health'; +import "./theme/variables.css"; +import { authSuccess } from "./store/actions/index"; -const App: React.FC = () => ( - +class App extends React.Component { + componentDidMount() { + const eventUser = new EventSource("http://localhost:5000/streamUser"); + eventUser.onmessage = (e) => this.props.changeUser(e.data); + const data = { + username: "ssh", + password: "12345", + }; + axios + .post("http://localhost:5000/login", qs.stringify(data)) + .then((res) => console.log(res)) + .catch((err) => console.log(err.response)); + } + render() { + return ( + - - - - - - - - - } - exact - /> - - - - - Home - - - - Categories - - - - Chats - - - - My Account - - - + + + + + + + + + + + + + + + + Home + + + + Categories + + + + Chats + + + + My Account + + + - -); + + ); + } +} + +const mapDispatchToProps = (dispatch) => ({ + changeUser: (data) => dispatch(authSuccess(data)), +}); -export default App; +export default connect(null, mapDispatchToProps)(App); diff --git a/src/axios-ins.tsx b/src/axios-ins.tsx new file mode 100644 index 0000000..c11f0c5 --- /dev/null +++ b/src/axios-ins.tsx @@ -0,0 +1,7 @@ +import axios from "axios"; + +const instance = axios.create({ + baseURL: "http://localhost:5000", +}); + +export default instance; diff --git a/src/components/CategoryCard.css b/src/components/CategoryCard.css deleted file mode 100644 index 1447294..0000000 --- a/src/components/CategoryCard.css +++ /dev/null @@ -1,11 +0,0 @@ -.col{ - font-size:12px; - text-align: center; - border-radius:15px; - padding:4px; - padding-top:20px; - padding-bottom: 20px; - margin:12px; - border:solid 1px lightgrey; -} - diff --git a/src/components/CategoryCard.tsx b/src/components/CategoryCard.tsx deleted file mode 100644 index 766b2ee..0000000 --- a/src/components/CategoryCard.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import React from 'react'; -import { - IonGrid, - IonRow, - IonCol, - IonIcon, - IonContent, - IonLabel, -} from '@ionic/react'; -import { - laptopOutline, - bicycleOutline, - phonePortraitOutline, - tabletLandscapeOutline, - libraryOutline, - constructOutline, -} from 'ionicons/icons'; -import './CategoryCard.css'; - -const CategoryCard: React.FC = () => ( - - - - -
- Laptops -
- - -
- Bicycles -
- - -
- Mobiles -
- - -
- Mattresses -
- - -
- Books -
- - -
- Miscellaneous -
-
-
-); - -export default CategoryCard; diff --git a/src/components/CategoryCard/CategoryCard.css b/src/components/CategoryCard/CategoryCard.css new file mode 100644 index 0000000..c946b1c --- /dev/null +++ b/src/components/CategoryCard/CategoryCard.css @@ -0,0 +1,8 @@ + + +ion-chip{ + padding:30px 0px 30px 25px; + width: 160px; + margin-bottom: 10px; +} + diff --git a/src/components/CategoryCard/CategoryCard.tsx b/src/components/CategoryCard/CategoryCard.tsx new file mode 100644 index 0000000..9a08f76 --- /dev/null +++ b/src/components/CategoryCard/CategoryCard.tsx @@ -0,0 +1,84 @@ +import React from "react"; +import { + IonGrid, + IonRow, + IonCol, + IonIcon, + IonText, + IonChip, +} from "@ionic/react"; +import { + bicycle, + laptopOutline, + phonePortraitOutline, + tabletLandscapeOutline, + bookOutline, + constructOutline, +} from "ionicons/icons"; +import "./CategoryCard.css"; + +const CategoryCard: React.FC = () => ( + + + + + + +
Laptops
+
+
+
+ + + + + +
Bicycles
+
+
+
+
+ + + + + + +
Phones
+
+
+
+ + + + + +
Matteresses
+
+
+
+
+ + + + + + +
Books
+
+
+
+ + + + + +
Misc.
+
+
+
+
+
+); + +export default CategoryCard; diff --git a/src/components/HeaderCard.tsx b/src/components/HeaderCard.tsx deleted file mode 100644 index 7357f66..0000000 --- a/src/components/HeaderCard.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react'; -import { - IonCardHeader, - IonCardSubtitle, - IonCardTitle, - IonCardContent, - IonCard, - IonButton, -} from '@ionic/react'; - -const HeaderCard: React.FC = () => { - return ( - - - IIT DELHI - Marketplace - - - - Wanna buy, sell, rent items among IIT Delhi peeps? Dont worry, - we got you covered ! - - - - Sign in to start - - - - ); -}; - -export default HeaderCard; diff --git a/src/components/HeaderCard/HeaderCard.css b/src/components/HeaderCard/HeaderCard.css new file mode 100644 index 0000000..400d777 --- /dev/null +++ b/src/components/HeaderCard/HeaderCard.css @@ -0,0 +1,27 @@ +.heading { + font-size: 8vw; + text-align:center; +} + +.sub-heading { + + + font-size: 8vw; + text-align:center; +} +.sub-title { + text-align: center; +} + +.reg-btn { + + width: 200px; + text-align: center; + display: inline-block; + align-items: center; + justify-content: center; + padding-left: 10px; +} +.wrapper { + text-align: center; +} diff --git a/src/components/HeaderCard/HeaderCard.tsx b/src/components/HeaderCard/HeaderCard.tsx new file mode 100644 index 0000000..f2f2bc8 --- /dev/null +++ b/src/components/HeaderCard/HeaderCard.tsx @@ -0,0 +1,41 @@ +import React from "react"; +import { + IonCardHeader, + IonCardTitle, + IonCardContent, + IonCard, + IonButton, +} from "@ionic/react"; +import "./HeaderCard.css"; +import { RouteComponentProps } from "react-router-dom"; + +const HeaderCard: React.FC = (props) => { + const clicked = (route: string) => { + props.history.push(route); + }; + return ( + + + Welcome To + IITD Marketplace + + + Wanna buy, sell, rent items among IIT Delhi peeps? Dont worry, we got + you covered ! + + +
+ + Sign in to start + + + + Login + +
+
+
+ ); +}; + +export default HeaderCard; diff --git a/src/components/ItemCard.tsx b/src/components/ItemCard.tsx deleted file mode 100644 index 88999a9..0000000 --- a/src/components/ItemCard.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react'; -import { IonItem, IonLabel, IonThumbnail } from '@ionic/react'; - -const ItemCard: React.FC = () => { - return ( - - - Hero thunderbird -

Rs.2500

-

Zanskar

-
- - - -
- ); -}; - -export default ItemCard; diff --git a/src/components/ItemCard/ItemCard.tsx b/src/components/ItemCard/ItemCard.tsx new file mode 100644 index 0000000..34a68c8 --- /dev/null +++ b/src/components/ItemCard/ItemCard.tsx @@ -0,0 +1,20 @@ +import React from "react"; +import { IonCard, IonCardHeader, IonCardSubtitle } from "@ionic/react"; + +class ItemCard extends React.Component { + render() { + const { item } = this.props; + return ( +
+ + cardImg + + {item.name} Rs. {item.price} + + +
+ ); + } +} + +export default ItemCard; diff --git a/src/components/ItemDetail/ItemDetail.tsx b/src/components/ItemDetail/ItemDetail.tsx new file mode 100644 index 0000000..b0ee839 --- /dev/null +++ b/src/components/ItemDetail/ItemDetail.tsx @@ -0,0 +1,86 @@ +import React from "react"; +import { + IonContent, + IonHeader, + IonPage, + IonChip, + IonToolbar, + IonCard, + IonCardHeader, + IonCardSubtitle, + IonCardTitle, + IonCardContent, + IonIcon, + IonLabel, + IonButton, + IonText, +} from "@ionic/react"; +import { locationOutline } from "ionicons/icons"; + +const ItemDetail: React.FC = () => { + return ( + + + + + + Asus Tuf GT505 + + Rs. 40000 + + + + + + + + Electronics + + + Laptops + + + + + + Seller Details + + + N. Satwik + +

+ {" "} + Zanskar House +

+
+ + Chat With Seller + +
+
+ + + Product Details + + +
    +
  • 4 months old
  • +
  • 8 GB RAM, 512 GB SSD, i5 9th gen
  • +
  • RGB keyboard
  • +
  • ...
  • +
  • ...
  • +
+
+
+ + + Reviews + + + +
+
+ ); +}; + +export default ItemDetail; diff --git a/src/components/ItemList/ItemList.tsx b/src/components/ItemList/ItemList.tsx new file mode 100644 index 0000000..7f1b7a5 --- /dev/null +++ b/src/components/ItemList/ItemList.tsx @@ -0,0 +1,30 @@ +import React from "react"; +import { IonCol, IonRow } from "@ionic/react"; +import ItemCard from "../ItemCard/ItemCard"; +// import categories from '../../pages/categories/categories'; + +class ItemList extends React.Component { + render() { + const itemList = this.props.items.map((item) => { + if (this.props.category === "all") { + return ( + + + + ); + } + if (this.props.category === item.category) { + return ( + + + + ); + } else { + return null; + } + }); + + return {itemList}; + } +} +export default ItemList; diff --git a/src/components/PostAd/PostAd.css b/src/components/PostAd/PostAd.css new file mode 100644 index 0000000..849da90 --- /dev/null +++ b/src/components/PostAd/PostAd.css @@ -0,0 +1,8 @@ +.regbuttons { + align-content: center; + width:20%; +} +.btn { + text-align: center; + +} \ No newline at end of file diff --git a/src/components/PostAd/PostAd.tsx b/src/components/PostAd/PostAd.tsx new file mode 100644 index 0000000..0a00b53 --- /dev/null +++ b/src/components/PostAd/PostAd.tsx @@ -0,0 +1,133 @@ +import React, { useState } from "react"; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import "./PostAd.css"; +import { RouteComponentProps } from "react-router"; +import { + IonTitle, + IonToolbar, + IonSelect, + IonSelectOption, + IonInput, + IonItem, + IonLabel, + IonList, + IonButton, + IonPage, + IonContent, + IonHeader, + IonButtons, + IonBackButton, +} from "@ionic/react"; + +const PostAd: React.FC = () => { + const [name, setName] = useState(); + const [date, setDate] = useState(); + const [condition, setCondition] = useState(); + const [price, setPrice] = useState(); + const [category, setCategory] = useState(); + const [description, setDescription] = useState(); + + return ( + + + + + + + + + Post Your Ad + + + +
+ + + + Name of The Product + + setName(e.detail.value!)} + required + /> + + + + Tentative Date of Purchase + + setDate(e.detail.value!)} + required + /> + + + + Condition + + setCondition(e.detail.value!)} + required + /> + + + + Category + + setCategory(e.detail.value)} + > + Laptops + Mobile + Books + Cycle + Miscallaneous + + + + + Asking Price + + setPrice(e.detail.value!)} + required + /> + + + + Description + + setDescription(e.detail.value!)} + required + /> + + + + + +
+
+ + Post + +
+
+
+ ); +}; + +export default PostAd; diff --git a/src/components/RegisterForm.tsx b/src/components/RegisterForm.tsx deleted file mode 100644 index 5f7e6b7..0000000 --- a/src/components/RegisterForm.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import React, { useState } from 'react'; -import { - IonHeader, - IonTitle, - IonToolbar, - IonSelect, - IonSelectOption, - IonInput, - IonItem, - IonLabel, - IonList, - IonButton, - IonBackButton, -} from '@ionic/react'; -import './RegisterForm.css'; - -const RegisterForm: React.FC = () => { - const [uname, setUname] = useState(); - const [pass, setPass] = useState(); - const [entryno, setEntryno] = useState(); - const [hostel, setHostel] = useState(); - - return ( -
- - Join us today ! - -
- - - - Username - - setUname(e.detail.value!)} - required - /> - - - - Password - - setPass(e.detail.value!)} - required - /> - - - - Entry Number - - setEntryno(e.detail.value!)} - required - /> - - - - Hostel - - setHostel(e.detail.value)} - > - Aravalli - Girnar - Jwalamukhi - Himadri - Zanskar - - - -
-
- - Register - -
-
- ); -}; - -export default RegisterForm; diff --git a/src/components/RegisterForm.css b/src/components/RegisterForm/RegisterForm.css similarity index 100% rename from src/components/RegisterForm.css rename to src/components/RegisterForm/RegisterForm.css diff --git a/src/components/RegisterForm/RegisterForm.tsx b/src/components/RegisterForm/RegisterForm.tsx new file mode 100644 index 0000000..2eaf6c2 --- /dev/null +++ b/src/components/RegisterForm/RegisterForm.tsx @@ -0,0 +1,87 @@ +import React, { useState } from "react"; +import { + IonTitle, + IonToolbar, + IonSelect, + IonSelectOption, + IonInput, + IonItem, + IonLabel, + IonList, + IonButton, +} from "@ionic/react"; +import "./RegisterForm.css"; + +const RegisterForm: React.FC = () => { + const [uname, setUname] = useState(); + const [pass, setPass] = useState(); + const [entryno, setEntryno] = useState(); + const [hostel, setHostel] = useState(); + + return ( +
+ + Join us today ! + +
+ + + + Username + + setUname(e.detail.value!)} + required + /> + + + + Password + + setPass(e.detail.value!)} + required + /> + + + + Entry Number + + setEntryno(e.detail.value!)} + required + /> + + + + Hostel + + setHostel(e.detail.value)} + > + Aravalli + Girnar + Jwalamukhi + Himadri + Zanskar + + + +
+
+ + Register + +
+
+ ); +}; + +export default RegisterForm; diff --git a/src/components/SearchBar.css b/src/components/SearchBar.css deleted file mode 100644 index a93a59e..0000000 --- a/src/components/SearchBar.css +++ /dev/null @@ -1,3 +0,0 @@ -ion-toolbar{ - padding-top: 2em; -} diff --git a/src/components/SearchBar.tsx b/src/components/SearchBar.tsx deleted file mode 100644 index ba9e7e2..0000000 --- a/src/components/SearchBar.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React, { useState } from 'react'; -import { IonHeader, IonToolbar, IonSearchbar } from '@ionic/react'; -import './SearchBar.css'; - -const SearchBar: React.FC = () => { - const [searchText, setSearchText] = useState(''); - return ( - - setSearchText(e.detail.value!)} - placeholder="Search for laptops, cycles..." - /> - - ); -}; - -export default SearchBar; diff --git a/src/components/SearchBar/SearchBar.css b/src/components/SearchBar/SearchBar.css new file mode 100644 index 0000000..d19a6e1 --- /dev/null +++ b/src/components/SearchBar/SearchBar.css @@ -0,0 +1,3 @@ +.searchbar{ + +} diff --git a/src/components/SearchBar/SearchBar.tsx b/src/components/SearchBar/SearchBar.tsx new file mode 100644 index 0000000..671aa17 --- /dev/null +++ b/src/components/SearchBar/SearchBar.tsx @@ -0,0 +1,20 @@ +import React, { useState } from "react"; +import { IonToolbar, IonSearchbar } from "@ionic/react"; +import "./SearchBar.css"; + +const SearchBar: React.FC = () => { + const [searchText, setSearchText] = useState(""); + return ( + + setSearchText(e.detail.value!)} + placeholder="Search" + /> + + ); +}; + +export default SearchBar; diff --git a/src/index.tsx b/src/index.tsx index b597a44..f075bbf 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,5 +1,17 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './App'; +import React from "react"; +import ReactDOM from "react-dom"; +import App from "./App"; -ReactDOM.render(, document.getElementById('root')); +import { createStore, applyMiddleware } from "redux"; +import rootReducer from "./store/reducers"; +import thunk from "redux-thunk"; +import { Provider } from "react-redux"; + +const store = createStore(rootReducer, applyMiddleware(thunk)); + +ReactDOM.render( + + + , + document.getElementById("root") +); diff --git a/src/pages/Health.tsx b/src/pages/Health.tsx deleted file mode 100644 index d0ec7ea..0000000 --- a/src/pages/Health.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import React from 'react'; -import { withRouter } from 'react-router-dom'; - -const Health: React.FC = () => { - return

Ok, Healthy!

; -}; - -export default withRouter(Health); diff --git a/src/pages/Health/Health.tsx b/src/pages/Health/Health.tsx new file mode 100644 index 0000000..3526d85 --- /dev/null +++ b/src/pages/Health/Health.tsx @@ -0,0 +1,13 @@ +import React from "react"; +import { withRouter } from "react-router-dom"; +import { IonPage } from "@ionic/react"; + +const Health: React.FC = () => { + return ( + +

Ok, Healthy!

+
+ ); +}; + +export default withRouter(Health); diff --git a/src/pages/categories.tsx b/src/pages/categories.tsx deleted file mode 100644 index fe7c4e2..0000000 --- a/src/pages/categories.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import { - IonContent, - IonHeader, - IonPage, - IonTitle, - IonToolbar, -} from '@ionic/react'; -import CategoryCard from '../components/CategoryCard'; - -const categories: React.FC = () => { - return ( - - - - - - ); -}; - -export default categories; diff --git a/src/pages/categories/categories.tsx b/src/pages/categories/categories.tsx new file mode 100644 index 0000000..726034a --- /dev/null +++ b/src/pages/categories/categories.tsx @@ -0,0 +1,32 @@ +import React from "react"; +import { + IonContent, + IonPage, + IonHeader, + IonToolbar, + IonButtons, + IonBackButton, + IonTitle, +} from "@ionic/react"; +import CategoryCard from "../../components/CategoryCard/CategoryCard"; +import { RouteComponentProps } from "react-router"; + +const categories: React.FC = (props) => { + return ( + + + + + + + Categories + + + + + + + ); +}; + +export default categories; diff --git a/src/pages/chats.tsx b/src/pages/chats.tsx deleted file mode 100644 index 0e8352b..0000000 --- a/src/pages/chats.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import { - IonContent, - IonHeader, - IonPage, - IonTitle, - IonToolbar, -} from '@ionic/react'; -import HeaderCard from '../components/HeaderCard'; - -const chats: React.FC = () => { - return ( - - - - - - ); -}; - -export default chats; diff --git a/src/pages/chats/chats.tsx b/src/pages/chats/chats.tsx new file mode 100644 index 0000000..c9b1d97 --- /dev/null +++ b/src/pages/chats/chats.tsx @@ -0,0 +1,30 @@ +import React from "react"; +import { + IonContent, + IonPage, + IonHeader, + IonToolbar, + IonButtons, + IonBackButton, + IonTitle, +} from "@ionic/react"; +import { RouteComponentProps } from "react-router"; + +const chats: React.FC = (props) => { + return ( + + + + + + + + Chats + + + + + ); +}; + +export default chats; diff --git a/src/pages/home.tsx b/src/pages/home.tsx deleted file mode 100644 index d132796..0000000 --- a/src/pages/home.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import React from 'react'; -import { - IonContent, - IonLabel, - IonSearchbar, - IonHeader, - IonPage, - IonFab, - IonFabButton, - IonIcon, - IonToolbar, - IonFabList, - IonGrid, - IonRow, - IonFooter, -} from '@ionic/react'; -import { - add, - createOutline, - laptopOutline, - phonePortraitOutline, - bicycleOutline, - libraryOutline, - tabletLandscapeOutline, - appsOutline, -} from 'ionicons/icons'; -import './home.css'; -import SearchBar from '../components/SearchBar'; -import HeaderCard from '../components/HeaderCard'; -import ItemCard from '../components/ItemCard'; -import CategoryCard from '../components/CategoryCard'; - -const home: React.FC = () => { - return ( - - - - - - - - - - - - - - - - Post an Ad - - - - - ); -}; - -export default home; diff --git a/src/pages/home.css b/src/pages/home/home.css similarity index 100% rename from src/pages/home.css rename to src/pages/home/home.css diff --git a/src/pages/home/home.tsx b/src/pages/home/home.tsx new file mode 100644 index 0000000..a37b8d3 --- /dev/null +++ b/src/pages/home/home.tsx @@ -0,0 +1,100 @@ +import React from "react"; +import { + IonContent, + IonLabel, + IonSegment, + IonSegmentButton, + IonPage, + IonFab, + IonFabButton, + IonIcon, + IonToolbar, + IonFabList, + IonHeader, + IonRow, + IonCol, + IonButtons, + IonBackButton, +} from "@ionic/react"; +import { add, createOutline } from "ionicons/icons"; +import "./home.css"; +import HeaderCard from "../../components/HeaderCard/HeaderCard"; +import ItemList from "../../components/ItemList/ItemList"; +import { connect } from "react-redux"; +import { RouteComponentProps } from "react-router"; +import SearchBar from "../../components/SearchBar/SearchBar"; + +class Home extends React.Component { + // eslint-disable-next-line react/destructuring-assignment + // eslint-disable-next-line react/state-in-constructor + state = { + category: "all", + }; + render() { + return ( + + + + + + + + + + + + + + + + + this.setState({ category: e.detail.value })} + color="primary" + > + + All + + + Laptops + + + Mobiles + + + Bicycles + + + Books + + + + + + + + + + this.props.history.push("/postad")} + > + + {/* Post an Ad */} + + + + + + ); + } +} + +const mapStatetoProps = (state: any) => { + return { + items: state.item.items, + }; +}; + +export default connect(mapStatetoProps)(Home); diff --git a/src/pages/home/home2.css b/src/pages/home/home2.css new file mode 100644 index 0000000..110cbe8 --- /dev/null +++ b/src/pages/home/home2.css @@ -0,0 +1,40 @@ +.wishlist-btn{ + font-size: 26px; +} + +.notification-btn{ + font-size: 26px; + +} + +.card{ + padding:40px 0px 10px 10px; + opacity: 0.9; +} + +.card-icon{ + margin-bottom:25px; + font-size:45px; +} + +.card-text{ + font-weight: 450; + font-size:18px; + padding-left:5px; +} + +ion-card { + margin-top:10px !important; + margin-bottom:10px !important; + margin-left:10px !important ; + margin-right: 10px !important; +} + +ion-col{ + padding:0; +} + +ion-row{ + margin-left:10px; + margin-right:10px; +} diff --git a/src/pages/home/home2.tsx b/src/pages/home/home2.tsx new file mode 100644 index 0000000..a54592f --- /dev/null +++ b/src/pages/home/home2.tsx @@ -0,0 +1,141 @@ +import React from "react"; +import { + IonContent, + IonPage, + IonFab, + IonFabButton, + IonIcon, + IonToolbar, + IonHeader, + IonText, + IonRow, + IonCol, + IonCard, +} from "@ionic/react"; +import { + add, + notificationsOutline, + personCircle, + heartHalf, + checkmarkCircle, + lockClosed, + analytics, + ribbonOutline, +} from "ionicons/icons"; +import "./home2.css"; + +import { connect } from "react-redux"; +import { RouteComponentProps } from "react-router"; + +import SearchBar from "../../components/SearchBar/SearchBar"; +import CategoryCard from "../../components/CategoryCard/CategoryCard"; + +class Home extends React.Component { + // eslint-disable-next-line react/destructuring-assignment + // eslint-disable-next-line react/state-in-constructor + state = { + category: "all", + }; + render() { + return ( + + + + + + + + + + + + + + + + +
+ Safe +
+
+ + + +
+ Secure +
+
+
+ + + + +
+ Dynamic +
+
+ + + +
+ Friendly +
+
+
+
+ + + +

Choose a category

+
+ +
+ + + + this.props.history.push("/postad")} + /> + + +
+
+ ); + } +} + +const mapStatetoProps = (state: any) => { + return { + items: state.item.items, + }; +}; + +export default connect(mapStatetoProps)(Home); diff --git a/src/pages/myaccount.css b/src/pages/myaccount.css deleted file mode 100644 index 0afcaf6..0000000 --- a/src/pages/myaccount.css +++ /dev/null @@ -1,6 +0,0 @@ - -.buttons{ - text-align: center; - padding:2em; - padding-top:6em; -} \ No newline at end of file diff --git a/src/pages/myaccount.tsx b/src/pages/myaccount.tsx deleted file mode 100644 index 930de32..0000000 --- a/src/pages/myaccount.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import React from 'react'; -import { - IonContent, - IonButton, - IonIcon, - IonHeader, - IonPage, - IonItem, - IonLabel, - IonThumbnail, - IonToolbar, -} from '@ionic/react'; -import './myaccount.css'; -import HeaderCard from '../components/HeaderCard'; - -const myaccount: React.FC = () => { - return ( - - - -

-
- - Guest User - - - - -
-
-
-
-
- - - -
- ); -}; - -export default myaccount; diff --git a/src/pages/myaccount/myaccount.css b/src/pages/myaccount/myaccount.css new file mode 100644 index 0000000..b583f12 --- /dev/null +++ b/src/pages/myaccount/myaccount.css @@ -0,0 +1,20 @@ +.effect { + border: 1px solid #ccc; + padding: 7px 14px; + + background: transparent; + color:black; +} +.avatar { + height:100px; + width:100px; + position: relative; + display: block; + margin-left: auto; + margin-right: auto; + +} + +.colgap { + padding-bottom: 30px ; +} \ No newline at end of file diff --git a/src/pages/myaccount/myaccount.tsx b/src/pages/myaccount/myaccount.tsx new file mode 100644 index 0000000..e86bd9a --- /dev/null +++ b/src/pages/myaccount/myaccount.tsx @@ -0,0 +1,123 @@ +import React from "react"; +import { + IonContent, + IonHeader, + IonButton, + IonItem, + IonLabel, + IonToolbar, + IonTitle, + IonGrid, + IonRow, + IonCol, + IonInput, + IonSegment, + IonSegmentButton, + IonPage, + IonBackButton, + IonButtons, +} from "@ionic/react"; +import "./myaccount.css"; + +const Myaccount: React.FC = () => { + return ( + + + + + + + Profile + + + +
+ + + +
+ + + + Profile + + + Buy/Sell History + + + + + + +
+ Name +
+ +
+ +
+
+ +
+ Entry No. +
+
+ +
+
+ + +
+ Phone No. +
+
+ +
+
+ +
+ Email +
+ +
+ +
+
+ + +
+ Hostel +
+
+ +
+
+ + + Update Info + +
+ + + Get on PlayStore + + + Get on AppStore + + + + + Contact For Help + + +
+
+
+ ); +}; + +export default Myaccount; diff --git a/src/pages/register/register.tsx b/src/pages/register/register.tsx new file mode 100644 index 0000000..15c1387 --- /dev/null +++ b/src/pages/register/register.tsx @@ -0,0 +1,16 @@ +import React from "react"; +import RegisterForm from "../../components/RegisterForm/RegisterForm"; +import { IonPage } from "@ionic/react"; +import { RouteComponentProps } from "react-router"; + +class Register extends React.Component { + state = { + isSignUp: true, + }; + render() { + let register = ; + return {register}; + } +} + +export default Register; diff --git a/src/serviceWorker.ts b/src/serviceWorker.ts index 35e67cb..73c4506 100644 --- a/src/serviceWorker.ts +++ b/src/serviceWorker.ts @@ -11,136 +11,132 @@ // opt-in, read https://bit.ly/CRA-PWA const isLocalhost = Boolean( - window.location.hostname === 'localhost' || - // [::1] is the IPv6 localhost address. - window.location.hostname === '[::1]' || - // 127.0.0.0/8 are considered localhost for IPv4. - window.location.hostname.match( - /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ - ) + window.location.hostname === "localhost" || + // [::1] is the IPv6 localhost address. + window.location.hostname === "[::1]" || + // 127.0.0.0/8 are considered localhost for IPv4. + window.location.hostname.match( + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ + ) ); type Config = { - onSuccess?: (registration: ServiceWorkerRegistration) => void; - onUpdate?: (registration: ServiceWorkerRegistration) => void; + onSuccess?: (registration: ServiceWorkerRegistration) => void; + onUpdate?: (registration: ServiceWorkerRegistration) => void; }; export function register(config?: Config) { - if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { - // The URL constructor is available in all browsers that support SW. - const publicUrl = new URL( - process.env.PUBLIC_URL!, - window.location.href - ); - if (publicUrl.origin !== window.location.origin) { - // Our service worker won't work if PUBLIC_URL is on a different origin - // from what our page is served on. This might happen if a CDN is used to - // serve assets; see https://github.com/facebook/create-react-app/issues/2374 - return; - } + if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) { + // The URL constructor is available in all browsers that support SW. + const publicUrl = new URL(process.env.PUBLIC_URL!, window.location.href); + if (publicUrl.origin !== window.location.origin) { + // Our service worker won't work if PUBLIC_URL is on a different origin + // from what our page is served on. This might happen if a CDN is used to + // serve assets; see https://github.com/facebook/create-react-app/issues/2374 + return; + } - window.addEventListener('load', () => { - const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; + window.addEventListener("load", () => { + const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; - if (isLocalhost) { - // This is running on localhost. Let's check if a service worker still exists or not. - checkValidServiceWorker(swUrl, config); + if (isLocalhost) { + // This is running on localhost. Let's check if a service worker still exists or not. + checkValidServiceWorker(swUrl, config); - // Add some additional logging to localhost, pointing developers to the - // service worker/PWA documentation. - navigator.serviceWorker.ready.then(() => { - console.log( - 'This web app is being served cache-first by a service ' + - 'worker. To learn more, visit https://bit.ly/CRA-PWA' - ); - }); - } else { - // Is not localhost. Just register service worker - registerValidSW(swUrl, config); - } + // Add some additional logging to localhost, pointing developers to the + // service worker/PWA documentation. + navigator.serviceWorker.ready.then(() => { + console.log( + "This web app is being served cache-first by a service " + + "worker. To learn more, visit https://bit.ly/CRA-PWA" + ); }); - } + } else { + // Is not localhost. Just register service worker + registerValidSW(swUrl, config); + } + }); + } } function registerValidSW(swUrl: string, config?: Config) { - navigator.serviceWorker - .register(swUrl) - .then((registration) => { - registration.onupdatefound = () => { - const installingWorker = registration.installing; - if (installingWorker == null) { - return; - } - installingWorker.onstatechange = () => { - if (installingWorker.state === 'installed') { - if (navigator.serviceWorker.controller) { - // At this point, the updated precached content has been fetched, - // but the previous service worker will still serve the older - // content until all client tabs are closed. - console.log( - 'New content is available and will be used when all ' + - 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' - ); + navigator.serviceWorker + .register(swUrl) + .then((registration) => { + registration.onupdatefound = () => { + const installingWorker = registration.installing; + if (installingWorker == null) { + return; + } + installingWorker.onstatechange = () => { + if (installingWorker.state === "installed") { + if (navigator.serviceWorker.controller) { + // At this point, the updated precached content has been fetched, + // but the previous service worker will still serve the older + // content until all client tabs are closed. + console.log( + "New content is available and will be used when all " + + "tabs for this page are closed. See https://bit.ly/CRA-PWA." + ); - // Execute callback - if (config && config.onUpdate) { - config.onUpdate(registration); - } - } else { - // At this point, everything has been precached. - // It's the perfect time to display a - // "Content is cached for offline use." message. - console.log('Content is cached for offline use.'); + // Execute callback + if (config && config.onUpdate) { + config.onUpdate(registration); + } + } else { + // At this point, everything has been precached. + // It's the perfect time to display a + // "Content is cached for offline use." message. + console.log("Content is cached for offline use."); - // Execute callback - if (config && config.onSuccess) { - config.onSuccess(registration); - } - } - } - }; - }; - }) - .catch((error) => { - console.error('Error during service worker registration:', error); - }); + // Execute callback + if (config && config.onSuccess) { + config.onSuccess(registration); + } + } + } + }; + }; + }) + .catch((error) => { + console.error("Error during service worker registration:", error); + }); } function checkValidServiceWorker(swUrl: string, config?: Config) { - // Check if the service worker can be found. If it can't reload the page. - fetch(swUrl, { - headers: { 'Service-Worker': 'script' }, - }) - .then((response) => { - // Ensure service worker exists, and that we really are getting a JS file. - const contentType = response.headers.get('content-type'); - if ( - response.status === 404 || - (contentType != null && - contentType.indexOf('javascript') === -1) - ) { - // No service worker found. Probably a different app. Reload the page. - navigator.serviceWorker.ready.then((registration) => { - registration.unregister().then(() => { - window.location.reload(); - }); - }); - } else { - // Service worker found. Proceed as normal. - registerValidSW(swUrl, config); - } - }) - .catch(() => { - console.log( - 'No internet connection found. App is running in offline mode.' - ); + // Check if the service worker can be found. If it can't reload the page. + fetch(swUrl, { + headers: { "Service-Worker": "script" }, + }) + .then((response) => { + // Ensure service worker exists, and that we really are getting a JS file. + const contentType = response.headers.get("content-type"); + if ( + response.status === 404 || + (contentType != null && contentType.indexOf("javascript") === -1) + ) { + // No service worker found. Probably a different app. Reload the page. + navigator.serviceWorker.ready.then((registration) => { + registration.unregister().then(() => { + window.location.reload(); + }); }); + } else { + // Service worker found. Proceed as normal. + registerValidSW(swUrl, config); + } + }) + .catch(() => { + console.log( + "No internet connection found. App is running in offline mode." + ); + }); } export function unregister() { - if ('serviceWorker' in navigator) { - navigator.serviceWorker.ready.then((registration) => { - registration.unregister(); - }); - } + if ("serviceWorker" in navigator) { + navigator.serviceWorker.ready.then((registration) => { + registration.unregister(); + }); + } } diff --git a/src/setupTests.ts b/src/setupTests.ts index 74b1a27..5fdf001 100644 --- a/src/setupTests.ts +++ b/src/setupTests.ts @@ -2,4 +2,4 @@ // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom -import '@testing-library/jest-dom/extend-expect'; +import "@testing-library/jest-dom/extend-expect"; diff --git a/src/store/actions/actionTypes.tsx b/src/store/actions/actionTypes.tsx new file mode 100644 index 0000000..7210a39 --- /dev/null +++ b/src/store/actions/actionTypes.tsx @@ -0,0 +1,51 @@ +export const MISC_FOLLOW = "MISC_FOLLOW"; +export const MISC_UNFOLLOW = "MISC_UNFOLLOW"; +export const MISC_NOTIFS = "MISC_NOTIFS"; +export const MISC_REPORT = "MISC_REPORT"; +export const MISC_START = "MISC_START"; +export const MISC_FAIL = "MISC_FAIL"; + +export const AUTH_SUCCESS = "AUTH_SUCCESS"; +export const AUTH_FAIL = "AUTH_FAIL"; +export const AUTH_START = "AUTH_START"; +export const AUTH_LOGOUT = "AUTH_LOGOUT"; + +export const ITEM_START = "ITEM_START"; +export const ITEM_SUCCESS = "ITEM_SUCCESS"; +export const ITEM_FAIL = "ITEM_FAIL"; + +export const ITEM_POST_START = "ITEM_POST_START"; +export const ITEM_POST_SUCCESS = "ITEM_POST_SUCCESS"; + +export const ITEM_EDIT_START = "ITEM_EDIT_START"; +export const ITEM_EDIT_SUCCESS = "ITEM_EDIT_SUCCESS"; + +export const ITEM_DEL_START = "ITEM_DEL_START"; +export const ITEM_DEL_SUCCESS = "ITEM_DEL_SUCCESS"; + +export const ITEM_SELLINI_START = "ITEM_SELLINI_START"; +export const ITEM_SELLINI_SUCCESS = "ITEM_SELLINI_SUCCESS"; + +export const ITEM_SELLFIN_START = "ITEM_SELLFIN_START"; +export const ITEM_SELLFIN_SUCCESS = "ITEM_SELLFIN_SUCCESS"; + +export const ITEM_REPORT_SUCCESS = "ITEM_REPORT_SUCCESS"; + +export const REVIEW_START = "REVIEW_START"; +export const REVIEW_SUCCESS = "REVIEW_SUCCESS"; +export const REVIEW_FAIL = "REVIEW_FAIL"; + +export const REVIEW_POST_START = "REVIEW_POST_START"; +export const REVIEW_POST_SUCCESS = "REVIEW_POST_SUCCESS"; + +export const REVIEW_EDIT_START = "REVIEW_EDIT_START"; +export const REVIEW_EDIT_SUCCESS = "REVIEW_EDIT_SUCCESS"; + +export const REVIEW_DEL_START = "REVIEW_DEL_START"; +export const REVIEW_DEL_SUCCESS = "REVIEW_DEL_SUCCESS"; + +export const REVIEW_UPVOTE_SUCCESS = "REVIEW_UPVOTE_SUCCESS"; +export const REVIEW_DOWNVOTE_SUCCESS = "REVIEW_DOWNVOTE_SUCCESS"; + +export const REVIEW_REPORT_SUCCESS = "REVIEW_REPORT_SUCCESS"; +export const REVIEW_RESOLVE_SUCCESS = "REVIEW_RESOLVE_SUCCESS"; diff --git a/src/store/actions/auth.tsx b/src/store/actions/auth.tsx new file mode 100644 index 0000000..88ea84d --- /dev/null +++ b/src/store/actions/auth.tsx @@ -0,0 +1,44 @@ +import * as actionTypes from "./actionTypes"; +import axios from "../../axios-ins"; +import qs from "querystring"; + +export const authStart = () => ({ + type: actionTypes.AUTH_START, +}); + +export const authSuccess = (data) => ({ + type: actionTypes.AUTH_SUCCESS, + data: data, +}); + +export const authFail = (err) => ({ + type: actionTypes.AUTH_FAIL, + data: err, +}); + +export const auth = (data, isSignUp: boolean) => (dispatch) => { + dispatch(authStart()); + let url = "/login"; + if (isSignUp) { + url = "/register"; + } + axios + .post(url, qs.stringify(data)) + .then((res) => { + dispatch(authSuccess(res.data)); + }) + .catch((err) => { + dispatch(authFail(err)); + }); +}; + +export const authLogout = () => (dispatch) => { + axios + .get("/logout") + .then((res) => { + dispatch({ type: actionTypes.AUTH_LOGOUT }); + }) + .catch((err) => { + dispatch(authFail(err)); + }); +}; diff --git a/src/store/actions/chat.tsx b/src/store/actions/chat.tsx new file mode 100644 index 0000000..5614d52 --- /dev/null +++ b/src/store/actions/chat.tsx @@ -0,0 +1,13 @@ +import io from "socket.io-client"; + +export const mountChat = () => (dispatch) => { + const socket = io("http://localhost:5000/chat"); + let stack: Record; + let username: string; + socket.on("connect", () => { + socket.emit("setUserData", username); + }); + socket.on("onlineStack", (sta: Record) => { + stack = sta; + }); +}; diff --git a/src/store/actions/index.tsx b/src/store/actions/index.tsx new file mode 100644 index 0000000..f644ee6 --- /dev/null +++ b/src/store/actions/index.tsx @@ -0,0 +1,2 @@ +export { authSuccess } from "./auth"; +export {} from "./item"; diff --git a/src/store/actions/item.tsx b/src/store/actions/item.tsx new file mode 100644 index 0000000..3091911 --- /dev/null +++ b/src/store/actions/item.tsx @@ -0,0 +1,146 @@ +import axios from "../../axios-ins"; +import * as actionTypes from "./actionTypes"; +import qs from "querystring"; + +export const getItemStart = () => ({ + type: actionTypes.ITEM_START, +}); + +export const getItemSuccess = (data) => ({ + type: actionTypes.ITEM_SUCCESS, + data: data, +}); + +export const postItemStart = () => ({ + type: actionTypes.ITEM_POST_START, +}); + +export const postItemSuccess = (data) => ({ + type: actionTypes.ITEM_POST_SUCCESS, + data: data, +}); + +export const itemFail = (err) => ({ + type: actionTypes.ITEM_FAIL, + err: err, +}); + +export const editItemStart = () => ({ + type: actionTypes.ITEM_EDIT_START, +}); + +export const editItemSuccess = (data) => ({ + type: actionTypes.ITEM_EDIT_SUCCESS, + data: data, +}); + +export const delItemStart = () => ({ + type: actionTypes.ITEM_DEL_START, +}); + +export const delItemSuccess = () => ({ + type: actionTypes.ITEM_DEL_SUCCESS, +}); + +export const sellIniItemStart = () => ({ + type: actionTypes.ITEM_SELLINI_START, +}); + +export const sellIniItemSuccess = () => ({ + type: actionTypes.ITEM_SELLINI_SUCCESS, +}); + +export const sellFinItemStart = () => ({ + type: actionTypes.ITEM_SELLFIN_START, +}); + +export const sellFinItemSuccess = () => ({ + type: actionTypes.ITEM_SELLFIN_SUCCESS, +}); + +export const reportItemSuccess = () => ({ + type: actionTypes.ITEM_REPORT_SUCCESS, +}); + +export const getItem = () => (dispatch) => { + dispatch(getItemStart()); + axios + .get("/item") + .then((res) => { + dispatch(getItemSuccess(res.data)); + }) + .catch((err) => { + dispatch(itemFail(err)); + }); +}; + +export const postItem = (data) => (dispatch) => { + dispatch(postItemStart()); + axios + .post("/item", qs.stringify(data)) + .then((res) => { + dispatch(postItemSuccess(res.data)); + }) + .catch((err) => { + dispatch(itemFail(err)); + }); +}; + +export const editItem = (data, id) => (dispatch) => { + dispatch(editItemStart()); + axios + .put("/item/" + id, qs.stringify(data)) + .then((res) => { + dispatch(editItemSuccess(res.data)); + }) + .catch((err) => { + dispatch(itemFail(err)); + }); +}; + +export const delItem = (id) => (dispatch) => { + dispatch(delItemStart()); + axios + .delete("/item/" + id) + .then((res) => { + dispatch(delItemSuccess()); + }) + .catch((err) => { + dispatch(itemFail(err)); + }); +}; + +export const selliniItem = (id, data) => (dispatch) => { + dispatch(sellIniItemStart()); + axios + .patch("/item/" + id + "/sellIni", qs.stringify(data)) + .then((res) => { + dispatch(sellIniItemSuccess()); + }) + .catch((err) => { + dispatch(itemFail(err)); + }); +}; + +export const sellfniItem = (id, data) => (dispatch) => { + dispatch(sellFinItemStart()); + axios + .patch("/item/" + id + "/sellFin", qs.stringify(data)) + .then((res) => { + dispatch(sellFinItemSuccess()); + }) + .catch((err) => { + dispatch(itemFail(err)); + }); +}; + +export const reportItem = (id) => (dispatch) => { + axios + .patch("/item/" + id + "/report") + .then((res) => { + dispatch(reportItemSuccess()); + }) + .catch((err) => { + dispatch(itemFail(err)); + }); +}; diff --git a/src/store/actions/misc.tsx b/src/store/actions/misc.tsx new file mode 100644 index 0000000..681db76 --- /dev/null +++ b/src/store/actions/misc.tsx @@ -0,0 +1,79 @@ +import axios from "axios"; +import * as actionTypes from "./actionTypes"; + +export const miscStart = () => ({ + type: actionTypes.MISC_START, +}); + +export const miscFail = (err) => ({ + type: actionTypes.MISC_FAIL, + err: err, +}); + +export const miscFollow = (category) => ({ + type: actionTypes.MISC_FOLLOW, + cat: category, +}); + +export const miscUnfollow = (category) => ({ + type: actionTypes.MISC_UNFOLLOW, + cat: category, +}); + +export const miscNotifs = (notifs) => ({ + type: actionTypes.MISC_NOTIFS, + notifs: notifs, +}); + +export const miscReport = (rep) => ({ + type: actionTypes.MISC_REPORT, + report: rep, +}); + +export const follow = (cat) => (dispatch) => { + dispatch(miscStart()); + axios + .patch("/follow/" + cat) + .then((res) => { + miscFollow(cat); + }) + .catch((err) => { + miscFail(err); + }); +}; + +export const unfollow = (cat) => (dispatch) => { + dispatch(miscStart()); + axios + .patch("/unfollow/" + cat) + .then((res) => { + miscUnfollow(cat); + }) + .catch((err) => { + miscFail(err); + }); +}; + +export const notifs = () => (dispatch) => { + dispatch(miscStart()); + axios + .get("/notifications") + .then((res) => { + dispatch(miscNotifs(res.data)); + }) + .catch((err) => { + dispatch(miscFail(err)); + }); +}; + +export const report = () => (dispatch) => { + dispatch(miscStart()); + axios + .get("/report") + .then((res) => { + dispatch(miscReport(res.data)); + }) + .catch((err) => { + dispatch(miscFail(err)); + }); +}; diff --git a/src/store/actions/review.tsx b/src/store/actions/review.tsx new file mode 100644 index 0000000..1b9a31b --- /dev/null +++ b/src/store/actions/review.tsx @@ -0,0 +1,151 @@ +import axios from "../../axios-ins"; +import qs from "querystring"; +import * as actionTypes from "./actionTypes"; + +export const getReviewStart = () => ({ + type: actionTypes.REVIEW_START, +}); + +export const getReviewSuccess = (data) => ({ + type: actionTypes.REVIEW_SUCCESS, + data: data, +}); + +export const postReviewStart = () => ({ + type: actionTypes.REVIEW_POST_START, +}); + +export const postReviewSuccess = (data) => ({ + type: actionTypes.REVIEW_POST_SUCCESS, + data: data, +}); + +export const reviewFail = (err) => ({ + type: actionTypes.REVIEW_FAIL, + err: err, +}); + +export const editReviewStart = () => ({ + type: actionTypes.REVIEW_EDIT_START, +}); + +export const editReviewSuccess = (data) => ({ + type: actionTypes.REVIEW_EDIT_SUCCESS, + data: data, +}); + +export const delReviewStart = () => ({ + type: actionTypes.REVIEW_DEL_START, +}); + +export const delReviewSuccess = () => ({ + type: actionTypes.REVIEW_DEL_SUCCESS, +}); + +export const upvoteReviewSuccess = () => ({ + type: actionTypes.REVIEW_UPVOTE_SUCCESS, +}); + +export const downvoteReviewSuccess = () => ({ + type: actionTypes.REVIEW_DOWNVOTE_SUCCESS, +}); + +export const reportReviewSuccess = () => ({ + type: actionTypes.REVIEW_REPORT_SUCCESS, +}); + +export const resolveReviewSuccess = () => ({ + type: actionTypes.REVIEW_RESOLVE_SUCCESS, +}); + +export const getReview = (id) => (dispatch) => { + dispatch(getReviewStart()); + axios + .get("/users/" + id + "/reviews/") + .then((res) => { + dispatch(getReviewSuccess(res.data)); + }) + .catch((err) => { + dispatch(reviewFail(err)); + }); +}; + +export const postReview = (data, id) => (dispatch) => { + dispatch(postReviewStart()); + axios + .post("/users/" + id + "/reviews/", qs.stringify(data)) + .then((res) => { + dispatch(postReviewSuccess(res.data)); + }) + .catch((err) => { + dispatch(reviewFail(err)); + }); +}; + +export const editReview = (data, id, reviewId) => (dispatch) => { + dispatch(editReviewStart()); + axios + .put("/users/" + id + "/reviews/" + reviewId, qs.stringify(data)) + .then((res) => { + dispatch(editReviewSuccess(res.data)); + }) + .catch((err) => { + dispatch(reviewFail(err)); + }); +}; + +export const delReview = (id, reviewId) => (dispatch) => { + dispatch(delReviewStart()); + axios + .delete("/users/" + id + "/reviews/" + reviewId) + .then((res) => { + dispatch(delReviewSuccess()); + }) + .catch((err) => { + dispatch(reviewFail(err)); + }); +}; + +export const upvoteReview = (id, reviewId) => (dispatch) => { + axios + .patch("/users/" + id + "/reviews/" + reviewId + "/upvote") + .then((res) => { + dispatch(upvoteReviewSuccess()); + }) + .catch((err) => { + dispatch(reviewFail(err)); + }); +}; + +export const downvoteReview = (id, reviewId) => (dispatch) => { + axios + .patch("/users/" + id + "/reviews/" + reviewId + "/downvote") + .then((res) => { + dispatch(downvoteReviewSuccess()); + }) + .catch((err) => { + dispatch(reviewFail(err)); + }); +}; + +export const reportReview = (id, reviewId) => (dispatch) => { + axios + .patch("/users/" + id + "/reviews/" + reviewId + "/report") + .then((res) => { + dispatch(reportReviewSuccess()); + }) + .catch((err) => { + dispatch(reviewFail(err)); + }); +}; + +export const resolveReview = (id, reviewId) => (dispatch) => { + axios + .patch("/users/" + id + "/reviews/" + reviewId + "/resolve") + .then((res) => { + dispatch(resolveReviewSuccess()); + }) + .catch((err) => { + dispatch(reviewFail(err)); + }); +}; diff --git a/src/store/reducers/auth.tsx b/src/store/reducers/auth.tsx new file mode 100644 index 0000000..44f672d --- /dev/null +++ b/src/store/reducers/auth.tsx @@ -0,0 +1,7 @@ +const initState = {}; + +const authReducer = (state = initState, action = {}) => { + return state; +}; + +export default authReducer; diff --git a/src/store/reducers/index.tsx b/src/store/reducers/index.tsx new file mode 100644 index 0000000..c682e0e --- /dev/null +++ b/src/store/reducers/index.tsx @@ -0,0 +1,11 @@ +import authReducer from "./auth"; +import itemReducer from "./item"; + +import { combineReducers } from "redux"; + +const rootReducer = combineReducers({ + auth: authReducer, + item: itemReducer, +}); + +export default rootReducer; diff --git a/src/store/reducers/item.tsx b/src/store/reducers/item.tsx new file mode 100644 index 0000000..9db8373 --- /dev/null +++ b/src/store/reducers/item.tsx @@ -0,0 +1,80 @@ +const initState = { + items: [ + { + id: 1, + name: "Asus Laptop", + price: 40000, + category: "laptop", + image: "/images/laptop.jfif", + }, + { + id: 2, + name: "Macbook Air", + price: 60000, + category: "laptop", + image: "/images/laptop.jfif", + }, + { + id: 3, + name: "Hero Thunderbird", + price: 4000, + category: "bicycle", + image: "/images/bicycle.jfif", + }, + { + id: 4, + name: "Decathlon BTWX 100", + price: 5000, + category: "bicycle", + image: "/images/bicycle.jfif", + }, + { + id: 5, + name: "Samsung S10e", + price: 25000, + category: "mobile", + image: "/images/mobile.jfif", + }, + { + id: 6, + name: "Vivo V15", + price: 14000, + category: "mobile", + image: "/images/mobile.jfif", + }, + { + id: 7, + name: "Kurl On memory foam ", + price: 2000, + category: "matteress", + image: "/images/matteress.jfif", + }, + { + id: 8, + name: "SleepX", + price: 1500, + category: "matteress", + image: "/images/matteress.jfif", + }, + { + id: 9, + name: "Order of the phoenix", + price: 300, + category: "book", + image: "/images/book.jfif", + }, + { + id: 10, + name: "Differential Equation - Kreyzig", + price: 200, + category: "book", + image: "/images/book.jfif", + }, + ], +}; + +const itemReducer = (state = initState, action) => { + return state; +}; + +export default itemReducer; diff --git a/tsconfig.json b/tsconfig.json index f2850b7..4dc65a1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,8 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react" + "jsx": "react", + "noImplicitAny": false }, "include": [ "src"