├── .babelrc
├── .eslintrc.json
├── .github
└── workflows
│ └── linters.yml
├── .gitignore
├── .hintrc
├── .stylelintrc.json
├── README.md
├── dist
├── 329acb512a429ca2049d.ttf
├── d5fc999d957a88d8067b.ttf
├── index.html
└── main.js
├── package-lock.json
├── package.json
├── setupJest.js
├── src
├── assets
│ ├── fonts
│ │ ├── Captainmarvel-anm9.ttf
│ │ ├── MarvelRegular-Dj83.ttf
│ │ ├── captain-marvel-font.zip
│ │ └── marvel-font.zip
│ ├── logo.png
│ └── thumbnail.png
├── comment-counter.test.js
├── display-comments.js
├── display-item.js
├── index.html
├── index.js
├── likes_involment_api.js
├── marvel-api-call.js
├── pop-up.js
├── reservations.js
├── reservations.test.js
├── retrieve-item.js
├── style.css
├── testing-items-homepage.js
└── testing-items-homepage.test.js
├── ssCapstone.png
└── webpack.config.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "test": {
4 | "plugins": ["@babel/plugin-transform-modules-commonjs"]
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "es6": true,
5 | "jest": true
6 | },
7 | "parser": "babel-eslint",
8 | "parserOptions": {
9 | "ecmaVersion": 2018,
10 | "sourceType": "module"
11 | },
12 | "extends": ["airbnb-base"],
13 | "rules": {
14 | "no-shadow": "off",
15 | "no-param-reassign": "off",
16 | "eol-last": "off",
17 | "import/extensions": [ 1, {
18 | "js": "always", "json": "always"
19 | }]
20 | },
21 | "ignorePatterns": [
22 | "dist/",
23 | "build/"
24 | ]
25 | }
--------------------------------------------------------------------------------
/.github/workflows/linters.yml:
--------------------------------------------------------------------------------
1 | name: Linters
2 |
3 | on: pull_request
4 |
5 | env:
6 | FORCE_COLOR: 1
7 |
8 | jobs:
9 | lighthouse:
10 | name: Lighthouse
11 | runs-on: ubuntu-18.04
12 | steps:
13 | - uses: actions/checkout@v2
14 | - uses: actions/setup-node@v1
15 | with:
16 | node-version: "12.x"
17 | - name: Setup Lighthouse
18 | run: npm install -g @lhci/cli@0.7.x
19 | - name: Lighthouse Report
20 | run: lhci autorun --upload.target=temporary-public-storage --collect.staticDistDir=.
21 | webhint:
22 | name: Webhint
23 | runs-on: ubuntu-18.04
24 | steps:
25 | - uses: actions/checkout@v2
26 | - uses: actions/setup-node@v1
27 | with:
28 | node-version: "12.x"
29 | - name: Setup Webhint
30 | run: |
31 | npm install --save-dev hint@6.x
32 | [ -f .hintrc ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.hintrc
33 | - name: Webhint Report
34 | run: npx hint
35 | stylelint:
36 | name: Stylelint
37 | runs-on: ubuntu-18.04
38 | steps:
39 | - uses: actions/checkout@v2
40 | - uses: actions/setup-node@v1
41 | with:
42 | node-version: "12.x"
43 | - name: Setup Stylelint
44 | run: |
45 | npm install --save-dev stylelint@13.x stylelint-scss@3.x stylelint-config-standard@21.x stylelint-csstree-validator@1.x
46 | [ -f .stylelintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.stylelintrc.json
47 | - name: Stylelint Report
48 | run: npx stylelint "**/*.{css,scss}"
49 | eslint:
50 | name: ESLint
51 | runs-on: ubuntu-18.04
52 | steps:
53 | - uses: actions/checkout@v2
54 | - uses: actions/setup-node@v1
55 | with:
56 | node-version: "12.x"
57 | - name: Setup ESLint
58 | run: |
59 | npm install --save-dev eslint@7.x eslint-config-airbnb-base@14.x eslint-plugin-import@2.x babel-eslint@10.x
60 | [ -f .eslintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.eslintrc.json
61 | - name: ESLint Report
62 | run: npx eslint .
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .DS_Store
--------------------------------------------------------------------------------
/.hintrc:
--------------------------------------------------------------------------------
1 | {
2 | "connector": {
3 | "name": "local",
4 | "options": {
5 | "pattern": ["**", "!.git/**", "!node_modules/**"]
6 | }
7 | },
8 | "extends": ["development"],
9 | "formatters": ["stylish"],
10 | "hints": [
11 | "button-type",
12 | "disown-opener",
13 | "html-checker",
14 | "meta-charset-utf-8",
15 | "meta-viewport",
16 | "no-inline-styles:error"
17 | ]
18 | }
--------------------------------------------------------------------------------
/.stylelintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["stylelint-config-standard"],
3 | "plugins": ["stylelint-scss", "stylelint-csstree-validator"],
4 | "rules": {
5 | "at-rule-no-unknown": null,
6 | "scss/at-rule-no-unknown": true,
7 | "csstree/validator": true
8 | },
9 | "ignoreFiles": ["build/**", "dist/**", "**/reset*.css", "**/bootstrap*.css", "**/*.js", "**/*.jsx"]
10 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # Marvel's Characters
4 |
5 | > Here you can find some of Marvel's characters, write a comment, like them or even book a rescue!
6 |
7 | 
8 |
9 | ## Description
10 |
11 | - This project was developed by a team of three people, here every one of us code a single section, we follow git-flow to build the whole project and sometimes we solved conflicts to merge our pull request to the dev branch. This project is working with two APIs one to get the info about the characters and the second one to post comments, reservations and even likes for your favourite ones.
12 |
13 |
14 | ## Built With
15 |
16 | - JavaScript
17 | - Webpack
18 | - HTML/CSS
19 | - Linters
20 |
21 | ## Live Demo
22 |
23 | [Live Demo Link](https://alexrs90.github.io/javascript-capstone/dist)
24 |
25 | ### Setup Locally
26 | - Open your terminal and run the following command: git clone https://github.com/AlexRS90/javascript-capstone.git
27 | - Run the command cd javascript-capstone
28 | - Run the command npm install
29 | - Run the command npm run start
30 |
31 | Once you completed this steps you should see the app running at: http://localhost:8080/ in your browser.
32 |
33 |
34 | ## Authors
35 |
36 | 👤 **Abel Herrera**
37 |
38 | - GitHub: [@Lino09](https://github.com/Lino09)
39 | - Twitter: [@AbelHerreraZam1](https://twitter.com/AbelHerreraZam1)
40 | - LinkedIn: [@abelherrarz](https://linkedin.com/in/abelherreraz)
41 |
42 | 👤 **Jim Ntare**
43 |
44 | - GitHub: [@Ntare22](https://github.com/Ntare22)
45 | - Twitter: [@JimNtare](https://twitter.com/JimNtare)
46 | - LinkedIn: [@jimntare](https://www.linkedin.com/in/jimntare/)
47 |
48 | 👤 **Alejandro Ramos**
49 |
50 | - GitHub: [@AlexRS90](https://github.com/AlexRS90)
51 | - Twitter: [@AlejandroRBenji](https://twitter.com/AlejandroRBenji)
52 | - LinkedIn: [@alejandro-ramos-santos-9b0b52135](https://www.linkedin.com/in/AlexRS90/)
53 |
54 | ## 🤝 Contributing
55 |
56 | Contributions, issues, and feature requests are welcome!
57 |
58 | Feel free to check the [issues page](https://github.com/AlexRS90/javascript-capstone/issues).
59 |
60 | ## Show your support
61 |
62 | Give a ⭐️ if you like this project!
63 |
64 | ## Acknowledgments
65 |
66 | - Hat tip to anyone whose code was used
67 | - Inspiration
68 | - etc
69 |
70 | ## 📝 License
71 |
72 | This project is [MIT](./MIT.md) licensed.
73 |
--------------------------------------------------------------------------------
/dist/329acb512a429ca2049d.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexRS90/javascript-capstone/be36d691ae9268271d92bf44650eb272747d732f/dist/329acb512a429ca2049d.ttf
--------------------------------------------------------------------------------
/dist/d5fc999d957a88d8067b.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexRS90/javascript-capstone/be36d691ae9268271d92bf44650eb272747d732f/dist/d5fc999d957a88d8067b.ttf
--------------------------------------------------------------------------------
/dist/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Marvel Characters
8 |
9 |
10 |
11 |
12 |
22 |
23 |
24 |
25 |
26 |
27 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/dist/main.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
3 | * This devtool is neither made for production nor for readable output files.
4 | * It uses "eval()" calls to create a separate source file in the browser devtools.
5 | * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
6 | * or disable the default devtool with "devtool: false".
7 | * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
8 | */
9 | /******/ (() => { // webpackBootstrap
10 | /******/ "use strict";
11 | /******/ var __webpack_modules__ = ({
12 |
13 | /***/ "./node_modules/css-loader/dist/cjs.js!./src/style.css":
14 | /*!*************************************************************!*\
15 | !*** ./node_modules/css-loader/dist/cjs.js!./src/style.css ***!
16 | \*************************************************************/
17 | /***/ ((module, __webpack_exports__, __webpack_require__) => {
18 |
19 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/noSourceMaps.js */ \"./node_modules/css-loader/dist/runtime/noSourceMaps.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/getUrl.js */ \"./node_modules/css-loader/dist/runtime/getUrl.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2__);\n// Imports\n\n\n\nvar ___CSS_LOADER_URL_IMPORT_0___ = new URL(/* asset import */ __webpack_require__(/*! ./assets/fonts/MarvelRegular-Dj83.ttf */ \"./src/assets/fonts/MarvelRegular-Dj83.ttf\"), __webpack_require__.b);\nvar ___CSS_LOADER_URL_IMPORT_1___ = new URL(/* asset import */ __webpack_require__(/*! ./assets/fonts/Captainmarvel-anm9.ttf */ \"./src/assets/fonts/Captainmarvel-anm9.ttf\"), __webpack_require__.b);\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));\nvar ___CSS_LOADER_URL_REPLACEMENT_0___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default()(___CSS_LOADER_URL_IMPORT_0___);\nvar ___CSS_LOADER_URL_REPLACEMENT_1___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default()(___CSS_LOADER_URL_IMPORT_1___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"html,\\nbody {\\n padding: 0;\\n margin: 0;\\n background-color: var(--marvel-blue);\\n font-family: 'cpt-marvel', monospace;\\n color: white;\\n}\\n\\n@font-face {\\n font-family: marvel-logo;\\n src: url(\" + ___CSS_LOADER_URL_REPLACEMENT_0___ + \");\\n}\\n\\n@font-face {\\n font-family: cpt-marvel;\\n src: url(\" + ___CSS_LOADER_URL_REPLACEMENT_1___ + \");\\n}\\n\\n* {\\n box-sizing: border-box;\\n}\\n\\n:root {\\n --marvel-red: #e23636;\\n --marvel-brown: #504a4a;\\n --marvel-blue: rgb(18, 17, 47);\\n --marvel-orange: #f78f3f;\\n}\\n\\n.d-flex {\\n display: flex;\\n}\\n\\n.logo-wrap {\\n background-color: var(--marvel-red);\\n display: flex;\\n align-items: center;\\n padding: 20px 16px 8px 20px;\\n}\\n\\n.logo {\\n font-family: 'marvel-logo', monospace !important;\\n font-size: 60px;\\n color: white;\\n padding: 0;\\n margin: 0;\\n letter-spacing: 2px;\\n}\\n\\n.nav-container {\\n justify-content: space-between;\\n padding: 12px 16px;\\n background-color: var(--marvel-blue);\\n box-shadow: 0 0 8px 0 var(--marvel-red);\\n position: fixed;\\n top: 0;\\n width: 100%;\\n}\\n\\n.nav-menu {\\n list-style: none;\\n justify-content: space-between;\\n padding-left: 0;\\n align-items: center;\\n}\\n\\n.nav-menu li {\\n color: #fff;\\n margin: 0 16px;\\n cursor: pointer;\\n}\\n\\n.super-heroes-container {\\n flex-wrap: wrap;\\n justify-content: center;\\n}\\n\\n.card-container {\\n flex-direction: column;\\n width: 25%;\\n margin: 2.5%;\\n background-color: var(--marvel-brown);\\n padding: 1%;\\n border-radius: 10px;\\n}\\n\\n.card-container img {\\n border-radius: 10px;\\n}\\n\\n.card-info {\\n justify-content: space-between;\\n}\\n\\n.main-btn {\\n margin: 5px;\\n padding: 6px;\\n font-weight: 600;\\n cursor: pointer;\\n}\\n\\n.main-btn:hover {\\n background-color: var(--marvel-blue);\\n color: white;\\n border: 1px solid white;\\n}\\n\\n#footer {\\n width: 100%;\\n bottom: 0;\\n padding: 16px;\\n background: var(--marvel-orange);\\n}\\n\\n.overlay {\\n position: fixed;\\n height: 100vh;\\n width: 100%;\\n top: 0;\\n backdrop-filter: blur(5px);\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n z-index: 50;\\n}\\n\\n.content-rsvtn {\\n width: 100%;\\n max-width: 800px;\\n height: 750px;\\n background-color: white;\\n display: flex;\\n flex-direction: column;\\n align-items: center;\\n padding: 24px;\\n color: var(--marvel-blue);\\n border-radius: 5px;\\n position: relative;\\n overflow-y: auto;\\n}\\n\\n.content-rsvtn h2 {\\n padding: 0;\\n margin: 0 0 24px 0;\\n font-size: 28px;\\n}\\n\\n.content-rsvtn p {\\n font-size: 18px;\\n}\\n\\n.content-rsvtn img {\\n border-radius: 5px;\\n}\\n\\n.close-rsvtn {\\n position: absolute;\\n top: 16px;\\n right: 16px;\\n border: none;\\n color: var(--marvel-red);\\n background-color: transparent;\\n padding: 8px 12px;\\n border-radius: 8px;\\n font-size: 18px;\\n font-weight: 600;\\n}\\n\\n.close-rsvtn:hover {\\n background-color: var(--marvel-red);\\n color: white;\\n}\\n\\n.fa-heart {\\n color: var(--marvel-blue);\\n width: 20px;\\n}\\n\\n.likes-container {\\n padding-top: 5px;\\n flex-direction: column;\\n align-items: center;\\n}\\n\\n.rsvtn-form {\\n text-align: center;\\n width: 75%;\\n display: grid;\\n grid-template-columns: 1fr 1fr;\\n gap: 16px;\\n}\\n\\n.rsvtn-form h2 {\\n grid-column: 1 / 3;\\n color: var(--marvel-brown);\\n}\\n\\n.rsvtn-form button {\\n cursor: pointer;\\n padding: 16px;\\n grid-column: 1 / 3;\\n}\\n\\n.rsvtn-label {\\n width: 100%;\\n padding: 0;\\n margin: 0;\\n}\\n\\n.rsvtn-input {\\n width: 100%;\\n padding: 8px;\\n}\\n\\n.label-name {\\n grid-column: 1 / 3;\\n}\\n\\n.rsvtns-list {\\n list-style: none;\\n width: 100%;\\n display: grid;\\n grid-template-columns: 1fr 1fr 1fr;\\n gap: 16px;\\n}\\n\\n.rsvtns-list h2 {\\n grid-column: 1 / 4;\\n color: var(--marvel-brown);\\n}\\n\\n.rsvtns-list li {\\n color: white;\\n padding: 4px;\\n background-color: var(--marvel-brown);\\n border-radius: 4px;\\n}\\n\\n.rsvtns-list li * {\\n font-size: 14px;\\n margin: 4px 0;\\n padding: 0 0;\\n}\\n\\n#comment-input {\\n display: flex;\\n flex-direction: column;\\n color: #000;\\n}\\n\\n#comment-input h3 {\\n font-size: 25px;\\n}\\n\\n#comment-input input,\\n#comment-input textarea {\\n padding: 10px 10px;\\n margin: 10px 0;\\n}\\n\\n#comment-input textarea {\\n padding: 30px 10px;\\n}\\n\\n#comment-input button {\\n font-family: 'cpt-marvel', monospace;\\n background-color: var(--marvel-red);\\n border: none;\\n color: #fff;\\n margin: 0 200px;\\n padding: 10px 10px;\\n}\\n\\n.single-comment {\\n background-color: var(--marvel-blue);\\n padding: 2px 10px;\\n margin: 10px 0;\\n border-radius: 8px;\\n border: 1px solid #000;\\n}\\n\\n.single-comment p {\\n font-size: 24px;\\n color: #fff;\\n}\\n\\n.single-comment h4 {\\n margin-left: 10px;\\n color: #fff;\\n}\\n\\n.number-of-items {\\n padding: 120px 0 0 16px;\\n font-size: 20px;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://webpack/./src/style.css?./node_modules/css-loader/dist/cjs.js");
20 |
21 | /***/ }),
22 |
23 | /***/ "./node_modules/css-loader/dist/runtime/api.js":
24 | /*!*****************************************************!*\
25 | !*** ./node_modules/css-loader/dist/runtime/api.js ***!
26 | \*****************************************************/
27 | /***/ ((module) => {
28 |
29 | eval("\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\nmodule.exports = function (cssWithMappingToString) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = \"\";\n var needLayer = typeof item[5] !== \"undefined\";\n\n if (item[4]) {\n content += \"@supports (\".concat(item[4], \") {\");\n }\n\n if (item[2]) {\n content += \"@media \".concat(item[2], \" {\");\n }\n\n if (needLayer) {\n content += \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\");\n }\n\n content += cssWithMappingToString(item);\n\n if (needLayer) {\n content += \"}\";\n }\n\n if (item[2]) {\n content += \"}\";\n }\n\n if (item[4]) {\n content += \"}\";\n }\n\n return content;\n }).join(\"\");\n }; // import a list of modules into the list\n\n\n list.i = function i(modules, media, dedupe, supports, layer) {\n if (typeof modules === \"string\") {\n modules = [[null, modules, undefined]];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var k = 0; k < this.length; k++) {\n var id = this[k][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _k = 0; _k < modules.length; _k++) {\n var item = [].concat(modules[_k]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n continue;\n }\n\n if (typeof layer !== \"undefined\") {\n if (typeof item[5] === \"undefined\") {\n item[5] = layer;\n } else {\n item[1] = \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\").concat(item[1], \"}\");\n item[5] = layer;\n }\n }\n\n if (media) {\n if (!item[2]) {\n item[2] = media;\n } else {\n item[1] = \"@media \".concat(item[2], \" {\").concat(item[1], \"}\");\n item[2] = media;\n }\n }\n\n if (supports) {\n if (!item[4]) {\n item[4] = \"\".concat(supports);\n } else {\n item[1] = \"@supports (\".concat(item[4], \") {\").concat(item[1], \"}\");\n item[4] = supports;\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};\n\n//# sourceURL=webpack://webpack/./node_modules/css-loader/dist/runtime/api.js?");
30 |
31 | /***/ }),
32 |
33 | /***/ "./node_modules/css-loader/dist/runtime/getUrl.js":
34 | /*!********************************************************!*\
35 | !*** ./node_modules/css-loader/dist/runtime/getUrl.js ***!
36 | \********************************************************/
37 | /***/ ((module) => {
38 |
39 | eval("\n\nmodule.exports = function (url, options) {\n if (!options) {\n options = {};\n }\n\n if (!url) {\n return url;\n }\n\n url = String(url.__esModule ? url.default : url); // If url is already wrapped in quotes, remove them\n\n if (/^['\"].*['\"]$/.test(url)) {\n url = url.slice(1, -1);\n }\n\n if (options.hash) {\n url += options.hash;\n } // Should url be wrapped?\n // See https://drafts.csswg.org/css-values-3/#urls\n\n\n if (/[\"'() \\t\\n]|(%20)/.test(url) || options.needQuotes) {\n return \"\\\"\".concat(url.replace(/\"/g, '\\\\\"').replace(/\\n/g, \"\\\\n\"), \"\\\"\");\n }\n\n return url;\n};\n\n//# sourceURL=webpack://webpack/./node_modules/css-loader/dist/runtime/getUrl.js?");
40 |
41 | /***/ }),
42 |
43 | /***/ "./node_modules/css-loader/dist/runtime/noSourceMaps.js":
44 | /*!**************************************************************!*\
45 | !*** ./node_modules/css-loader/dist/runtime/noSourceMaps.js ***!
46 | \**************************************************************/
47 | /***/ ((module) => {
48 |
49 | eval("\n\nmodule.exports = function (i) {\n return i[1];\n};\n\n//# sourceURL=webpack://webpack/./node_modules/css-loader/dist/runtime/noSourceMaps.js?");
50 |
51 | /***/ }),
52 |
53 | /***/ "./src/style.css":
54 | /*!***********************!*\
55 | !*** ./src/style.css ***!
56 | \***********************/
57 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
58 |
59 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ \"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/styleDomAPI.js */ \"./node_modules/style-loader/dist/runtime/styleDomAPI.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/insertBySelector.js */ \"./node_modules/style-loader/dist/runtime/insertBySelector.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js */ \"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/insertStyleElement.js */ \"./node_modules/style-loader/dist/runtime/insertStyleElement.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/styleTagTransform.js */ \"./node_modules/style-loader/dist/runtime/styleTagTransform.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _node_modules_css_loader_dist_cjs_js_style_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../node_modules/css-loader/dist/cjs.js!./style.css */ \"./node_modules/css-loader/dist/cjs.js!./src/style.css\");\n\n \n \n \n \n \n \n \n \n \n\nvar options = {};\n\noptions.styleTagTransform = (_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default());\noptions.setAttributes = (_node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default());\n\n options.insert = _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, \"head\");\n \noptions.domAPI = (_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default());\noptions.insertStyleElement = (_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default());\n\nvar update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_style_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"], options);\n\n\n\n\n /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_style_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"] && _node_modules_css_loader_dist_cjs_js_style_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"].locals ? _node_modules_css_loader_dist_cjs_js_style_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"].locals : undefined);\n\n\n//# sourceURL=webpack://webpack/./src/style.css?");
60 |
61 | /***/ }),
62 |
63 | /***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":
64 | /*!****************************************************************************!*\
65 | !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***!
66 | \****************************************************************************/
67 | /***/ ((module) => {
68 |
69 | eval("\n\nvar stylesInDOM = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDOM.length; i++) {\n if (stylesInDOM[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var indexByIdentifier = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3],\n supports: item[4],\n layer: item[5]\n };\n\n if (indexByIdentifier !== -1) {\n stylesInDOM[indexByIdentifier].references++;\n stylesInDOM[indexByIdentifier].updater(obj);\n } else {\n var updater = addElementStyle(obj, options);\n options.byIndex = i;\n stylesInDOM.splice(i, 0, {\n identifier: identifier,\n updater: updater,\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction addElementStyle(obj, options) {\n var api = options.domAPI(options);\n api.update(obj);\n\n var updater = function updater(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {\n return;\n }\n\n api.update(obj = newObj);\n } else {\n api.remove();\n }\n };\n\n return updater;\n}\n\nmodule.exports = function (list, options) {\n options = options || {};\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDOM[index].references--;\n }\n\n var newLastIdentifiers = modulesToDom(newList, options);\n\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n\n var _index = getIndexByIdentifier(_identifier);\n\n if (stylesInDOM[_index].references === 0) {\n stylesInDOM[_index].updater();\n\n stylesInDOM.splice(_index, 1);\n }\n }\n\n lastIdentifiers = newLastIdentifiers;\n };\n};\n\n//# sourceURL=webpack://webpack/./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?");
70 |
71 | /***/ }),
72 |
73 | /***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js":
74 | /*!********************************************************************!*\
75 | !*** ./node_modules/style-loader/dist/runtime/insertBySelector.js ***!
76 | \********************************************************************/
77 | /***/ ((module) => {
78 |
79 | eval("\n\nvar memo = {};\n/* istanbul ignore next */\n\nfunction getTarget(target) {\n if (typeof memo[target] === \"undefined\") {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n}\n/* istanbul ignore next */\n\n\nfunction insertBySelector(insert, style) {\n var target = getTarget(insert);\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n}\n\nmodule.exports = insertBySelector;\n\n//# sourceURL=webpack://webpack/./node_modules/style-loader/dist/runtime/insertBySelector.js?");
80 |
81 | /***/ }),
82 |
83 | /***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js":
84 | /*!**********************************************************************!*\
85 | !*** ./node_modules/style-loader/dist/runtime/insertStyleElement.js ***!
86 | \**********************************************************************/
87 | /***/ ((module) => {
88 |
89 | eval("\n\n/* istanbul ignore next */\nfunction insertStyleElement(options) {\n var element = document.createElement(\"style\");\n options.setAttributes(element, options.attributes);\n options.insert(element, options.options);\n return element;\n}\n\nmodule.exports = insertStyleElement;\n\n//# sourceURL=webpack://webpack/./node_modules/style-loader/dist/runtime/insertStyleElement.js?");
90 |
91 | /***/ }),
92 |
93 | /***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":
94 | /*!**********************************************************************************!*\
95 | !*** ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***!
96 | \**********************************************************************************/
97 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
98 |
99 | eval("\n\n/* istanbul ignore next */\nfunction setAttributesWithoutAttributes(styleElement) {\n var nonce = true ? __webpack_require__.nc : 0;\n\n if (nonce) {\n styleElement.setAttribute(\"nonce\", nonce);\n }\n}\n\nmodule.exports = setAttributesWithoutAttributes;\n\n//# sourceURL=webpack://webpack/./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js?");
100 |
101 | /***/ }),
102 |
103 | /***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js":
104 | /*!***************************************************************!*\
105 | !*** ./node_modules/style-loader/dist/runtime/styleDomAPI.js ***!
106 | \***************************************************************/
107 | /***/ ((module) => {
108 |
109 | eval("\n\n/* istanbul ignore next */\nfunction apply(styleElement, options, obj) {\n var css = \"\";\n\n if (obj.supports) {\n css += \"@supports (\".concat(obj.supports, \") {\");\n }\n\n if (obj.media) {\n css += \"@media \".concat(obj.media, \" {\");\n }\n\n var needLayer = typeof obj.layer !== \"undefined\";\n\n if (needLayer) {\n css += \"@layer\".concat(obj.layer.length > 0 ? \" \".concat(obj.layer) : \"\", \" {\");\n }\n\n css += obj.css;\n\n if (needLayer) {\n css += \"}\";\n }\n\n if (obj.media) {\n css += \"}\";\n }\n\n if (obj.supports) {\n css += \"}\";\n }\n\n var sourceMap = obj.sourceMap;\n\n if (sourceMap && typeof btoa !== \"undefined\") {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n options.styleTagTransform(css, styleElement, options.options);\n}\n\nfunction removeStyleElement(styleElement) {\n // istanbul ignore if\n if (styleElement.parentNode === null) {\n return false;\n }\n\n styleElement.parentNode.removeChild(styleElement);\n}\n/* istanbul ignore next */\n\n\nfunction domAPI(options) {\n var styleElement = options.insertStyleElement(options);\n return {\n update: function update(obj) {\n apply(styleElement, options, obj);\n },\n remove: function remove() {\n removeStyleElement(styleElement);\n }\n };\n}\n\nmodule.exports = domAPI;\n\n//# sourceURL=webpack://webpack/./node_modules/style-loader/dist/runtime/styleDomAPI.js?");
110 |
111 | /***/ }),
112 |
113 | /***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js":
114 | /*!*********************************************************************!*\
115 | !*** ./node_modules/style-loader/dist/runtime/styleTagTransform.js ***!
116 | \*********************************************************************/
117 | /***/ ((module) => {
118 |
119 | eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElement) {\n if (styleElement.styleSheet) {\n styleElement.styleSheet.cssText = css;\n } else {\n while (styleElement.firstChild) {\n styleElement.removeChild(styleElement.firstChild);\n }\n\n styleElement.appendChild(document.createTextNode(css));\n }\n}\n\nmodule.exports = styleTagTransform;\n\n//# sourceURL=webpack://webpack/./node_modules/style-loader/dist/runtime/styleTagTransform.js?");
120 |
121 | /***/ }),
122 |
123 | /***/ "./src/display-comments.js":
124 | /*!*********************************!*\
125 | !*** ./src/display-comments.js ***!
126 | \*********************************/
127 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
128 |
129 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"comments\": () => (/* binding */ comments),\n/* harmony export */ \"displayComments\": () => (/* binding */ displayComments)\n/* harmony export */ });\nconst commentSection = document.createElement('div');\ncommentSection.id = 'comment-input';\nconst commentContainer = document.createElement('div');\nconst commentsHeading = document.createElement('h4');\nlet singleComment = document.createElement('div');\nlet commentHeader = document.createElement('p');\nlet commenter = document.createElement('h4');\ncommentContainer.classList = 'comment-container';\n\nconst listComments = (data) => {\n commentContainer.innerHTML = '';\n\n let comments;\n\n comments = data;\n commentsHeading.innerHTML = `${comments.length !== undefined ? comments.length : '0'} Comment(s)`;\n\n if (comments.error !== undefined) {\n comments = [];\n const noComment = document.createElement('p');\n noComment.innerHTML = 'No Comments Yet';\n commentContainer.appendChild(noComment);\n }\n\n commentContainer.appendChild(commentsHeading);\n\n comments.forEach((comment) => {\n singleComment = document.createElement('div');\n singleComment.classList = 'single-comment';\n commentHeader = document.createElement('p');\n commenter = document.createElement('h4');\n\n commentHeader.innerHTML = `\"${comment.comment}\"`;\n commenter.innerHTML = `~ ${comment.username}`;\n\n singleComment.appendChild(commentHeader);\n singleComment.appendChild(commenter);\n commentContainer.appendChild(singleComment);\n });\n};\n\nconst displayComments = async (characterId) => {\n try {\n const url = `https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/bJg0BJIh3l3Fd7AaCJp1/comments?item_id=${characterId}`;\n const comments = await fetch(url);\n const result = await comments.json();\n return result;\n } catch (e) {\n return e;\n }\n};\n\nconst postComment = async (characterId, username, comment) => {\n const url = 'https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/bJg0BJIh3l3Fd7AaCJp1/comments';\n const sendObj = {\n item_id: characterId,\n username,\n comment,\n };\n const postComment = await fetch(url, {\n method: 'POST',\n body: JSON.stringify(sendObj),\n headers: { 'Content-type': 'application/json; charset=UTF-8' },\n });\n\n const getUpdatedComments = await displayComments(characterId);\n await listComments(getUpdatedComments);\n return postComment;\n};\n\nconst comments = async (characterData) => {\n const content = document.querySelector('.content-rsvtn');\n commentSection.innerHTML = '';\n\n const commentSecHeading = document.createElement('h3');\n commentSecHeading.id = 'comment-heading';\n commentSecHeading.innerHTML = `Write your comments/reviews of ${characterData.name}`;\n\n const usernameInput = document.createElement('input');\n usernameInput.placeholder = 'Your Name';\n const commentInput = document.createElement('textarea');\n commentInput.placeholder = 'Your Comment';\n\n usernameInput.value = '';\n commentInput.value = '';\n\n const submitComment = document.createElement('button');\n submitComment.innerHTML = 'Submit Comment';\n submitComment.addEventListener('click', () => {\n postComment(characterData.id, usernameInput.value, commentInput.value);\n usernameInput.value = '';\n commentInput.value = '';\n });\n\n const comments = await displayComments(characterData.id);\n\n listComments(comments);\n\n commentSection.appendChild(commentSecHeading);\n commentSection.appendChild(usernameInput);\n commentSection.appendChild(commentInput);\n commentSection.appendChild(submitComment);\n commentSection.appendChild(commentContainer);\n content.appendChild(commentSection);\n};\n\n\n\n\n//# sourceURL=webpack://webpack/./src/display-comments.js?");
130 |
131 | /***/ }),
132 |
133 | /***/ "./src/display-item.js":
134 | /*!*****************************!*\
135 | !*** ./src/display-item.js ***!
136 | \*****************************/
137 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
138 |
139 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _display_comments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./display-comments.js */ \"./src/display-comments.js\");\n/* harmony import */ var _pop_up_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pop-up.js */ \"./src/pop-up.js\");\n/* harmony import */ var _retrieve_item_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./retrieve-item.js */ \"./src/retrieve-item.js\");\n\n\n\n\nconst displayItem = async (id) => {\n const displayItem = await (0,_retrieve_item_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(id);\n const charData = displayItem.data.results[0];\n (0,_pop_up_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(charData);\n (0,_display_comments_js__WEBPACK_IMPORTED_MODULE_0__.comments)(charData);\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (displayItem);\n\n\n//# sourceURL=webpack://webpack/./src/display-item.js?");
140 |
141 | /***/ }),
142 |
143 | /***/ "./src/index.js":
144 | /*!**********************!*\
145 | !*** ./src/index.js ***!
146 | \**********************/
147 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
148 |
149 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"displaySHCards\": () => (/* binding */ displaySHCards),\n/* harmony export */ \"displayLike\": () => (/* binding */ displayLike)\n/* harmony export */ });\n/* harmony import */ var _style_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./style.css */ \"./src/style.css\");\n/* harmony import */ var _reservations_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./reservations.js */ \"./src/reservations.js\");\n/* harmony import */ var _likes_involment_api_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./likes_involment_api.js */ \"./src/likes_involment_api.js\");\n/* harmony import */ var _testing_items_homepage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./testing-items-homepage.js */ \"./src/testing-items-homepage.js\");\n/* harmony import */ var _marvel_api_call__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./marvel-api-call */ \"./src/marvel-api-call.js\");\n/* harmony import */ var _display_item_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./display-item.js */ \"./src/display-item.js\");\n\n\n//eslint-disable-line\n\n\n//eslint-disable-line\n\n\nlet superHeroes = [];\nlet likesCounter = [];\n\nconst displaySHCards = (arraySuperH) => {\n superHeroes = arraySuperH;\n const message = 'Superheroes: ';\n let newCard = '';\n superHeroes.forEach((heroes) => {\n newCard += `\n

\n
\n \n
\n
`;\n });\n document.querySelector('.super-heroes-container').innerHTML = newCard;\n document.querySelector('.number-of-items').innerHTML = message + (0,_testing_items_homepage_js__WEBPACK_IMPORTED_MODULE_3__.countingCards)(superHeroes);\n};\n\nconst displayLike = (likeArray) => {\n const singular = ' like';\n const plural = ' likes';\n likesCounter = likeArray;\n setTimeout(() => {\n document.querySelectorAll('.number-likes').forEach((like) => {\n const getId = like.id;\n likesCounter.forEach((find) => {\n if (find.item_id.split('_', 2)[1] === getId.split('_', 2)[1]) {\n if (find.likes === 1) {\n like.innerHTML = find.likes + singular;\n } else {\n like.innerHTML = find.likes + plural;\n }\n }\n });\n });\n }, 500);\n};\n\n(0,_marvel_api_call__WEBPACK_IMPORTED_MODULE_4__[\"default\"])();\n_likes_involment_api_js__WEBPACK_IMPORTED_MODULE_2__.getLike();\n\nwindow.onload = setTimeout(() => {\n document.querySelectorAll('.btn-reservation').forEach((el) => {\n el.addEventListener('click', () => {\n _reservations_js__WEBPACK_IMPORTED_MODULE_1__.create(el.id);\n });\n });\n\n document.querySelectorAll('.btn-comments').forEach((el) => {\n el.addEventListener('click', () => {\n (0,_display_item_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(el.id);\n });\n });\n\n document.querySelectorAll('.fa-heart').forEach((like) => {\n like.addEventListener('click', () => {\n like.style.color = 'red';\n _likes_involment_api_js__WEBPACK_IMPORTED_MODULE_2__.giveLike(like.id);\n });\n });\n}, 2000);\n\n\n\n\n//# sourceURL=webpack://webpack/./src/index.js?");
150 |
151 | /***/ }),
152 |
153 | /***/ "./src/likes_involment_api.js":
154 | /*!************************************!*\
155 | !*** ./src/likes_involment_api.js ***!
156 | \************************************/
157 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
158 |
159 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"giveLike\": () => (/* binding */ giveLike),\n/* harmony export */ \"getLike\": () => (/* binding */ getLike)\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./src/index.js\");\n//eslint-disable-line\n\nconst url = 'https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/bJg0BJIh3l3Fd7AaCJp1/likes';\n\nconst getLike = async () => {\n const checkLikes = await fetch(url);\n const allLikes = await checkLikes.json();\n (0,_index_js__WEBPACK_IMPORTED_MODULE_0__.displayLike)(allLikes);\n};\n\nconst giveLike = async (newLike) => {\n await fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n item_id: newLike,\n }),\n headers: {\n 'Content-type': 'application/json; charset=UTF-8',\n },\n });\n getLike();\n};\n\n\n\n//# sourceURL=webpack://webpack/./src/likes_involment_api.js?");
160 |
161 | /***/ }),
162 |
163 | /***/ "./src/marvel-api-call.js":
164 | /*!********************************!*\
165 | !*** ./src/marvel-api-call.js ***!
166 | \********************************/
167 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
168 |
169 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index */ \"./src/index.js\");\n//eslint-disable-line\n\nconst url = 'https://gateway.marvel.com/v1/public/characters?ts=1&hash=cef440fde913b8756e1db19d5f18cd9e&apikey=580e7d5773a2965034fd7fcd3cad5f53';\nconst apiCall = async () => {\n const call = await fetch(url);\n const arr = await call.json();\n (0,_index__WEBPACK_IMPORTED_MODULE_0__.displaySHCards)(arr.data.results);\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (apiCall);\n\n//# sourceURL=webpack://webpack/./src/marvel-api-call.js?");
170 |
171 | /***/ }),
172 |
173 | /***/ "./src/pop-up.js":
174 | /*!***********************!*\
175 | !*** ./src/pop-up.js ***!
176 | \***********************/
177 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
178 |
179 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nconst popUp = (characterData) => {\n const overlay = document.createElement('div');\n overlay.classList.add('overlay');\n const content = document.createElement('div');\n content.classList.add('content-rsvtn');\n const charName = document.createElement('h2');\n charName.innerText = characterData.name;\n const charDesc = document.createElement('p');\n charDesc.innerText = characterData.description\n || 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu.';\n const charPicture = document.createElement('img');\n charPicture.src = `${characterData.thumbnail.path}/standard_fantastic.${characterData.thumbnail.extension}`;\n const closeBtn = document.createElement('button');\n closeBtn.innerText = 'X';\n closeBtn.classList.add('close-rsvtn');\n closeBtn.addEventListener('click', () => {\n document.body.removeChild(overlay);\n });\n\n content.append(charName, charPicture, charDesc, closeBtn);\n\n overlay.appendChild(content);\n overlay.addEventListener('click', (e) => {\n if (overlay !== e.target) return;\n document.body.removeChild(overlay);\n });\n document.body.appendChild(overlay);\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (popUp);\n\n\n//# sourceURL=webpack://webpack/./src/pop-up.js?");
180 |
181 | /***/ }),
182 |
183 | /***/ "./src/reservations.js":
184 | /*!*****************************!*\
185 | !*** ./src/reservations.js ***!
186 | \*****************************/
187 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
188 |
189 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"countRsvtns\": () => (/* binding */ countRsvtns),\n/* harmony export */ \"fillRsrvtns\": () => (/* binding */ fillRsrvtns),\n/* harmony export */ \"create\": () => (/* binding */ create)\n/* harmony export */ });\n/* harmony import */ var _pop_up_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pop-up.js */ \"./src/pop-up.js\");\n\n\nconst appID = 'bJg0BJIh3l3Fd7AaCJp1';\n\nconst countRsvtns = (rsvtns) => `${rsvtns.length} ${rsvtns.length === 1 ? 'person' : 'people'} is being rescued by this Hero in the next days`;\n\nconst fillRsrvtns = async (id) => {\n let rsvtns = await fetch(`https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/${appID}/reservations?item_id=${id}`).then((response) => response.json()).catch(() => []);\n if (rsvtns.error) {\n rsvtns = [];\n }\n const futureRsvtns = document.querySelector('.rsvtns-list');\n futureRsvtns.innerHTML = '';\n const rsvtnsCount = document.createElement('h2');\n rsvtnsCount.innerText = countRsvtns(rsvtns);\n futureRsvtns.appendChild(rsvtnsCount);\n rsvtns.forEach((reservation) => {\n const card = document.createElement('li');\n card.innerHTML = `${reservation.username}
\n From: ${reservation.date_start}
\n To: ${reservation.date_end}
`;\n futureRsvtns.appendChild(card);\n });\n};\n\nconst create = async (id) => {\n const character = await fetch(`https://gateway.marvel.com/v1/public/characters/${id}?ts=1&hash=cef440fde913b8756e1db19d5f18cd9e&apikey=580e7d5773a2965034fd7fcd3cad5f53`).then((response) => response.json());\n const charData = character.data.results[0];\n (0,_pop_up_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(charData);\n const content = document.querySelector('.content-rsvtn');\n const futureRsvtns = document.createElement('ul');\n futureRsvtns.classList.add('rsvtns-list');\n content.appendChild(futureRsvtns);\n fillRsrvtns(id);\n const rsvtnForm = document.createElement('form');\n rsvtnForm.innerHTML = `Get rescued by this hero, Reserve Now!
\n \n \n \n `;\n rsvtnForm.classList.add('rsvtn-form');\n rsvtnForm.addEventListener('submit', (e) => {\n e.preventDefault();\n fetch(`https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/${appID}/reservations`, {\n method: 'POST',\n body: JSON.stringify({\n item_id: id,\n username: document.querySelector('#rsvtn-name').value,\n date_start: document.querySelector('#dateStart').value,\n date_end: document.querySelector('#dateEnd').value,\n }),\n headers: {\n 'Content-type': 'application/json; charset=UTF-8',\n },\n }).then(() => {\n document.querySelector('#rsvtn-name').value = '';\n document.querySelector('#dateStart').value = '';\n document.querySelector('#dateEnd').value = '';\n fillRsrvtns(id);\n });\n });\n content.appendChild(rsvtnForm);\n};\n\n\n//# sourceURL=webpack://webpack/./src/reservations.js?");
190 |
191 | /***/ }),
192 |
193 | /***/ "./src/retrieve-item.js":
194 | /*!******************************!*\
195 | !*** ./src/retrieve-item.js ***!
196 | \******************************/
197 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
198 |
199 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nconst retrieveItem = async (id) => {\n const character = await fetch(`https://gateway.marvel.com/v1/public/characters/${id}?ts=1&hash=cef440fde913b8756e1db19d5f18cd9e&apikey=580e7d5773a2965034fd7fcd3cad5f53`);\n return character.json();\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (retrieveItem);\n\n//# sourceURL=webpack://webpack/./src/retrieve-item.js?");
200 |
201 | /***/ }),
202 |
203 | /***/ "./src/testing-items-homepage.js":
204 | /*!***************************************!*\
205 | !*** ./src/testing-items-homepage.js ***!
206 | \***************************************/
207 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
208 |
209 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"countingCards\": () => (/* binding */ countingCards),\n/* harmony export */ \"hello\": () => (/* binding */ hello)\n/* harmony export */ });\nconst countingCards = (heroArray) => {\n const allCards = heroArray.length;\n return (allCards);\n};\n\nconst hello = () => {\n\n};\n\n\n\n//# sourceURL=webpack://webpack/./src/testing-items-homepage.js?");
210 |
211 | /***/ }),
212 |
213 | /***/ "./src/assets/fonts/Captainmarvel-anm9.ttf":
214 | /*!*************************************************!*\
215 | !*** ./src/assets/fonts/Captainmarvel-anm9.ttf ***!
216 | \*************************************************/
217 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
218 |
219 | eval("module.exports = __webpack_require__.p + \"d5fc999d957a88d8067b.ttf\";\n\n//# sourceURL=webpack://webpack/./src/assets/fonts/Captainmarvel-anm9.ttf?");
220 |
221 | /***/ }),
222 |
223 | /***/ "./src/assets/fonts/MarvelRegular-Dj83.ttf":
224 | /*!*************************************************!*\
225 | !*** ./src/assets/fonts/MarvelRegular-Dj83.ttf ***!
226 | \*************************************************/
227 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
228 |
229 | eval("module.exports = __webpack_require__.p + \"329acb512a429ca2049d.ttf\";\n\n//# sourceURL=webpack://webpack/./src/assets/fonts/MarvelRegular-Dj83.ttf?");
230 |
231 | /***/ })
232 |
233 | /******/ });
234 | /************************************************************************/
235 | /******/ // The module cache
236 | /******/ var __webpack_module_cache__ = {};
237 | /******/
238 | /******/ // The require function
239 | /******/ function __webpack_require__(moduleId) {
240 | /******/ // Check if module is in cache
241 | /******/ var cachedModule = __webpack_module_cache__[moduleId];
242 | /******/ if (cachedModule !== undefined) {
243 | /******/ return cachedModule.exports;
244 | /******/ }
245 | /******/ // Create a new module (and put it into the cache)
246 | /******/ var module = __webpack_module_cache__[moduleId] = {
247 | /******/ id: moduleId,
248 | /******/ // no module.loaded needed
249 | /******/ exports: {}
250 | /******/ };
251 | /******/
252 | /******/ // Execute the module function
253 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
254 | /******/
255 | /******/ // Return the exports of the module
256 | /******/ return module.exports;
257 | /******/ }
258 | /******/
259 | /******/ // expose the modules object (__webpack_modules__)
260 | /******/ __webpack_require__.m = __webpack_modules__;
261 | /******/
262 | /************************************************************************/
263 | /******/ /* webpack/runtime/compat get default export */
264 | /******/ (() => {
265 | /******/ // getDefaultExport function for compatibility with non-harmony modules
266 | /******/ __webpack_require__.n = (module) => {
267 | /******/ var getter = module && module.__esModule ?
268 | /******/ () => (module['default']) :
269 | /******/ () => (module);
270 | /******/ __webpack_require__.d(getter, { a: getter });
271 | /******/ return getter;
272 | /******/ };
273 | /******/ })();
274 | /******/
275 | /******/ /* webpack/runtime/define property getters */
276 | /******/ (() => {
277 | /******/ // define getter functions for harmony exports
278 | /******/ __webpack_require__.d = (exports, definition) => {
279 | /******/ for(var key in definition) {
280 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
281 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
282 | /******/ }
283 | /******/ }
284 | /******/ };
285 | /******/ })();
286 | /******/
287 | /******/ /* webpack/runtime/global */
288 | /******/ (() => {
289 | /******/ __webpack_require__.g = (function() {
290 | /******/ if (typeof globalThis === 'object') return globalThis;
291 | /******/ try {
292 | /******/ return this || new Function('return this')();
293 | /******/ } catch (e) {
294 | /******/ if (typeof window === 'object') return window;
295 | /******/ }
296 | /******/ })();
297 | /******/ })();
298 | /******/
299 | /******/ /* webpack/runtime/hasOwnProperty shorthand */
300 | /******/ (() => {
301 | /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
302 | /******/ })();
303 | /******/
304 | /******/ /* webpack/runtime/make namespace object */
305 | /******/ (() => {
306 | /******/ // define __esModule on exports
307 | /******/ __webpack_require__.r = (exports) => {
308 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
309 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
310 | /******/ }
311 | /******/ Object.defineProperty(exports, '__esModule', { value: true });
312 | /******/ };
313 | /******/ })();
314 | /******/
315 | /******/ /* webpack/runtime/publicPath */
316 | /******/ (() => {
317 | /******/ var scriptUrl;
318 | /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
319 | /******/ var document = __webpack_require__.g.document;
320 | /******/ if (!scriptUrl && document) {
321 | /******/ if (document.currentScript)
322 | /******/ scriptUrl = document.currentScript.src
323 | /******/ if (!scriptUrl) {
324 | /******/ var scripts = document.getElementsByTagName("script");
325 | /******/ if(scripts.length) scriptUrl = scripts[scripts.length - 1].src
326 | /******/ }
327 | /******/ }
328 | /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
329 | /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
330 | /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
331 | /******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
332 | /******/ __webpack_require__.p = scriptUrl;
333 | /******/ })();
334 | /******/
335 | /******/ /* webpack/runtime/jsonp chunk loading */
336 | /******/ (() => {
337 | /******/ __webpack_require__.b = document.baseURI || self.location.href;
338 | /******/
339 | /******/ // object to store loaded and loading chunks
340 | /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
341 | /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
342 | /******/ var installedChunks = {
343 | /******/ "main": 0
344 | /******/ };
345 | /******/
346 | /******/ // no chunk on demand loading
347 | /******/
348 | /******/ // no prefetching
349 | /******/
350 | /******/ // no preloaded
351 | /******/
352 | /******/ // no HMR
353 | /******/
354 | /******/ // no HMR manifest
355 | /******/
356 | /******/ // no on chunks loaded
357 | /******/
358 | /******/ // no jsonp function
359 | /******/ })();
360 | /******/
361 | /************************************************************************/
362 | /******/
363 | /******/ // startup
364 | /******/ // Load entry module and return exports
365 | /******/ // This entry module is referenced by other modules so it can't be inlined
366 | /******/ var __webpack_exports__ = __webpack_require__("./src/index.js");
367 | /******/
368 | /******/ })()
369 | ;
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "webpack",
3 | "version": "1.0.0",
4 | "description": "",
5 | "private": true,
6 | "scripts": {
7 | "test": "jest",
8 | "start": "webpack serve --open",
9 | "build": "webpack",
10 | "watch": "jest --watch **/*.js"
11 | },
12 | "repository": {
13 | "type": "git",
14 | "url": "git+https://github.com/Lino09/webpack-first.git"
15 | },
16 | "keywords": [],
17 | "author": "",
18 | "license": "ISC",
19 | "bugs": {
20 | "url": "https://github.com/Lino09/webpack-first/issues"
21 | },
22 | "homepage": "https://github.com/Lino09/webpack-first#readme",
23 | "devDependencies": {
24 | "@babel/plugin-transform-modules-commonjs": "^7.16.0",
25 | "babel-eslint": "^10.1.0",
26 | "css-loader": "^6.5.0",
27 | "eslint": "^7.32.0",
28 | "eslint-config-airbnb-base": "^14.2.1",
29 | "eslint-plugin-import": "^2.25.3",
30 | "hint": "^6.1.9",
31 | "html-webpack-plugin": "^5.5.0",
32 | "jest": "^27.3.1",
33 | "style-loader": "^3.3.1",
34 | "stylelint": "^13.13.1",
35 | "stylelint-config-standard": "^21.0.0",
36 | "stylelint-csstree-validator": "^1.9.0",
37 | "stylelint-scss": "^3.21.0",
38 | "webpack": "^5.60.0",
39 | "webpack-cli": "^4.9.1",
40 | "webpack-dev-server": "^4.3.1"
41 | },
42 | "dependencies": {
43 | "jest-fetch-mock": "^3.0.3",
44 | "lodash": "^4.17.21"
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/setupJest.js:
--------------------------------------------------------------------------------
1 | import fetchMock from 'jest-fetch-mock';
2 |
3 | fetchMock.enableMocks();
4 | // fetchMock.dontMock()
--------------------------------------------------------------------------------
/src/assets/fonts/Captainmarvel-anm9.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexRS90/javascript-capstone/be36d691ae9268271d92bf44650eb272747d732f/src/assets/fonts/Captainmarvel-anm9.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/MarvelRegular-Dj83.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexRS90/javascript-capstone/be36d691ae9268271d92bf44650eb272747d732f/src/assets/fonts/MarvelRegular-Dj83.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/captain-marvel-font.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexRS90/javascript-capstone/be36d691ae9268271d92bf44650eb272747d732f/src/assets/fonts/captain-marvel-font.zip
--------------------------------------------------------------------------------
/src/assets/fonts/marvel-font.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexRS90/javascript-capstone/be36d691ae9268271d92bf44650eb272747d732f/src/assets/fonts/marvel-font.zip
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexRS90/javascript-capstone/be36d691ae9268271d92bf44650eb272747d732f/src/assets/logo.png
--------------------------------------------------------------------------------
/src/assets/thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexRS90/javascript-capstone/be36d691ae9268271d92bf44650eb272747d732f/src/assets/thumbnail.png
--------------------------------------------------------------------------------
/src/comment-counter.test.js:
--------------------------------------------------------------------------------
1 | import { displayComments } from './display-comments.js';
2 |
3 | global.fetch = jest.fn(() => Promise.resolve({
4 | json: () => Promise.resolve([{ creation_date: '2021-11-17', username: 'Jim ', comment: 'This is a mocked comment for A-Bomb' }]),
5 | }));
6 |
7 | describe('Comment Test', () => {
8 | test('comment function', async () => {
9 | const result = await displayComments(1017100);
10 | expect(result.length).toBe(1);
11 | });
12 | });
13 |
--------------------------------------------------------------------------------
/src/display-comments.js:
--------------------------------------------------------------------------------
1 | const commentSection = document.createElement('div');
2 | commentSection.id = 'comment-input';
3 | const commentContainer = document.createElement('div');
4 | const commentsHeading = document.createElement('h4');
5 | let singleComment = document.createElement('div');
6 | let commentHeader = document.createElement('p');
7 | let commenter = document.createElement('h4');
8 | commentContainer.classList = 'comment-container';
9 |
10 | const listComments = (data) => {
11 | commentContainer.innerHTML = '';
12 |
13 | let comments;
14 |
15 | comments = data;
16 | commentsHeading.innerHTML = `${comments.length !== undefined ? comments.length : '0'} Comment(s)`;
17 |
18 | if (comments.error !== undefined) {
19 | comments = [];
20 | const noComment = document.createElement('p');
21 | noComment.innerHTML = 'No Comments Yet';
22 | commentContainer.appendChild(noComment);
23 | }
24 |
25 | commentContainer.appendChild(commentsHeading);
26 |
27 | comments.forEach((comment) => {
28 | singleComment = document.createElement('div');
29 | singleComment.classList = 'single-comment';
30 | commentHeader = document.createElement('p');
31 | commenter = document.createElement('h4');
32 |
33 | commentHeader.innerHTML = `"${comment.comment}"`;
34 | commenter.innerHTML = `~ ${comment.username}`;
35 |
36 | singleComment.appendChild(commentHeader);
37 | singleComment.appendChild(commenter);
38 | commentContainer.appendChild(singleComment);
39 | });
40 | };
41 |
42 | const displayComments = async (characterId) => {
43 | try {
44 | const url = `https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/bJg0BJIh3l3Fd7AaCJp1/comments?item_id=${characterId}`;
45 | const comments = await fetch(url);
46 | const result = await comments.json();
47 | return result;
48 | } catch (e) {
49 | return e;
50 | }
51 | };
52 |
53 | const postComment = async (characterId, username, comment) => {
54 | const url = 'https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/bJg0BJIh3l3Fd7AaCJp1/comments';
55 | const sendObj = {
56 | item_id: characterId,
57 | username,
58 | comment,
59 | };
60 | const postComment = await fetch(url, {
61 | method: 'POST',
62 | body: JSON.stringify(sendObj),
63 | headers: { 'Content-type': 'application/json; charset=UTF-8' },
64 | });
65 |
66 | const getUpdatedComments = await displayComments(characterId);
67 | await listComments(getUpdatedComments);
68 | return postComment;
69 | };
70 |
71 | const comments = async (characterData) => {
72 | const content = document.querySelector('.content-rsvtn');
73 | commentSection.innerHTML = '';
74 |
75 | const commentSecHeading = document.createElement('h3');
76 | commentSecHeading.id = 'comment-heading';
77 | commentSecHeading.innerHTML = `Write your comments/reviews of ${characterData.name}`;
78 |
79 | const usernameInput = document.createElement('input');
80 | usernameInput.placeholder = 'Your Name';
81 | const commentInput = document.createElement('textarea');
82 | commentInput.placeholder = 'Your Comment';
83 |
84 | usernameInput.value = '';
85 | commentInput.value = '';
86 |
87 | const submitComment = document.createElement('button');
88 | submitComment.innerHTML = 'Submit Comment';
89 | submitComment.addEventListener('click', () => {
90 | postComment(characterData.id, usernameInput.value, commentInput.value);
91 | usernameInput.value = '';
92 | commentInput.value = '';
93 | });
94 |
95 | const comments = await displayComments(characterData.id);
96 |
97 | listComments(comments);
98 |
99 | commentSection.appendChild(commentSecHeading);
100 | commentSection.appendChild(usernameInput);
101 | commentSection.appendChild(commentInput);
102 | commentSection.appendChild(submitComment);
103 | commentSection.appendChild(commentContainer);
104 | content.appendChild(commentSection);
105 | };
106 |
107 | export { comments, displayComments };
108 |
--------------------------------------------------------------------------------
/src/display-item.js:
--------------------------------------------------------------------------------
1 | import { comments } from './display-comments.js';
2 | import popUp from './pop-up.js';
3 | import retrieveItem from './retrieve-item.js';
4 |
5 | const displayItem = async (id) => {
6 | const displayItem = await retrieveItem(id);
7 | const charData = displayItem.data.results[0];
8 | popUp(charData);
9 | comments(charData);
10 | };
11 |
12 | export default displayItem;
13 |
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Marvel Characters
8 |
9 |
10 |
11 |
12 |
22 |
23 |
24 |
25 |
26 |
27 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import './style.css';
2 | import * as rsvtn from './reservations.js';
3 | import * as likeAPI from './likes_involment_api.js';//eslint-disable-line
4 | import { countingCards } from './testing-items-homepage.js';
5 |
6 | import apiCall from './marvel-api-call';//eslint-disable-line
7 | import displayItem from './display-item.js';
8 |
9 | let superHeroes = [];
10 | let likesCounter = [];
11 |
12 | const displaySHCards = (arraySuperH) => {
13 | superHeroes = arraySuperH;
14 | const message = 'Superheroes: ';
15 | let newCard = '';
16 | superHeroes.forEach((heroes) => {
17 | newCard += `
18 |

19 |
20 |
${heroes.name}
21 |
25 |
26 |
27 |
28 |
`;
29 | });
30 | document.querySelector('.super-heroes-container').innerHTML = newCard;
31 | document.querySelector('.number-of-items').innerHTML = message + countingCards(superHeroes);
32 | };
33 |
34 | const displayLike = (likeArray) => {
35 | const singular = ' like';
36 | const plural = ' likes';
37 | likesCounter = likeArray;
38 | setTimeout(() => {
39 | document.querySelectorAll('.number-likes').forEach((like) => {
40 | const getId = like.id;
41 | likesCounter.forEach((find) => {
42 | if (find.item_id.split('_', 2)[1] === getId.split('_', 2)[1]) {
43 | if (find.likes === 1) {
44 | like.innerHTML = find.likes + singular;
45 | } else {
46 | like.innerHTML = find.likes + plural;
47 | }
48 | }
49 | });
50 | });
51 | }, 500);
52 | };
53 |
54 | apiCall();
55 | likeAPI.getLike();
56 |
57 | window.onload = setTimeout(() => {
58 | document.querySelectorAll('.btn-reservation').forEach((el) => {
59 | el.addEventListener('click', () => {
60 | rsvtn.create(el.id);
61 | });
62 | });
63 |
64 | document.querySelectorAll('.btn-comments').forEach((el) => {
65 | el.addEventListener('click', () => {
66 | displayItem(el.id);
67 | });
68 | });
69 |
70 | document.querySelectorAll('.fa-heart').forEach((like) => {
71 | like.addEventListener('click', () => {
72 | like.style.color = 'red';
73 | likeAPI.giveLike(like.id);
74 | });
75 | });
76 | }, 2000);
77 |
78 | export { displaySHCards, displayLike };
79 |
--------------------------------------------------------------------------------
/src/likes_involment_api.js:
--------------------------------------------------------------------------------
1 | import { displayLike } from './index.js';//eslint-disable-line
2 |
3 | const url = 'https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/bJg0BJIh3l3Fd7AaCJp1/likes';
4 |
5 | const getLike = async () => {
6 | const checkLikes = await fetch(url);
7 | const allLikes = await checkLikes.json();
8 | displayLike(allLikes);
9 | };
10 |
11 | const giveLike = async (newLike) => {
12 | await fetch(url, {
13 | method: 'POST',
14 | body: JSON.stringify({
15 | item_id: newLike,
16 | }),
17 | headers: {
18 | 'Content-type': 'application/json; charset=UTF-8',
19 | },
20 | });
21 | getLike();
22 | };
23 |
24 | export { giveLike, getLike };
--------------------------------------------------------------------------------
/src/marvel-api-call.js:
--------------------------------------------------------------------------------
1 | import {displaySHCards} from './index';//eslint-disable-line
2 |
3 | const url = 'https://gateway.marvel.com/v1/public/characters?ts=1&hash=cef440fde913b8756e1db19d5f18cd9e&apikey=580e7d5773a2965034fd7fcd3cad5f53';
4 | const apiCall = async () => {
5 | const call = await fetch(url);
6 | const arr = await call.json();
7 | displaySHCards(arr.data.results);
8 | };
9 |
10 | export default apiCall;
--------------------------------------------------------------------------------
/src/pop-up.js:
--------------------------------------------------------------------------------
1 | const popUp = (characterData) => {
2 | const overlay = document.createElement('div');
3 | overlay.classList.add('overlay');
4 | const content = document.createElement('div');
5 | content.classList.add('content-rsvtn');
6 | const charName = document.createElement('h2');
7 | charName.innerText = characterData.name;
8 | const charDesc = document.createElement('p');
9 | charDesc.innerText = characterData.description
10 | || 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu.';
11 | const charPicture = document.createElement('img');
12 | charPicture.src = `${characterData.thumbnail.path}/standard_fantastic.${characterData.thumbnail.extension}`;
13 | const closeBtn = document.createElement('button');
14 | closeBtn.innerText = 'X';
15 | closeBtn.classList.add('close-rsvtn');
16 | closeBtn.addEventListener('click', () => {
17 | document.body.removeChild(overlay);
18 | });
19 |
20 | content.append(charName, charPicture, charDesc, closeBtn);
21 |
22 | overlay.appendChild(content);
23 | overlay.addEventListener('click', (e) => {
24 | if (overlay !== e.target) return;
25 | document.body.removeChild(overlay);
26 | });
27 | document.body.appendChild(overlay);
28 | };
29 |
30 | export default popUp;
31 |
--------------------------------------------------------------------------------
/src/reservations.js:
--------------------------------------------------------------------------------
1 | import popUp from './pop-up.js';
2 |
3 | const appID = 'bJg0BJIh3l3Fd7AaCJp1';
4 |
5 | export const countRsvtns = (rsvtns) => `${rsvtns.length} ${rsvtns.length === 1 ? 'person' : 'people'} is being rescued by this Hero in the next days`;
6 |
7 | export const fillRsrvtns = async (id) => {
8 | let rsvtns = await fetch(`https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/${appID}/reservations?item_id=${id}`).then((response) => response.json()).catch(() => []);
9 | if (rsvtns.error) {
10 | rsvtns = [];
11 | }
12 | const futureRsvtns = document.querySelector('.rsvtns-list');
13 | futureRsvtns.innerHTML = '';
14 | const rsvtnsCount = document.createElement('h2');
15 | rsvtnsCount.innerText = countRsvtns(rsvtns);
16 | futureRsvtns.appendChild(rsvtnsCount);
17 | rsvtns.forEach((reservation) => {
18 | const card = document.createElement('li');
19 | card.innerHTML = `${reservation.username}
20 | From: ${reservation.date_start}
21 | To: ${reservation.date_end}
`;
22 | futureRsvtns.appendChild(card);
23 | });
24 | };
25 |
26 | export const create = async (id) => {
27 | const character = await fetch(`https://gateway.marvel.com/v1/public/characters/${id}?ts=1&hash=cef440fde913b8756e1db19d5f18cd9e&apikey=580e7d5773a2965034fd7fcd3cad5f53`).then((response) => response.json());
28 | const charData = character.data.results[0];
29 | popUp(charData);
30 | const content = document.querySelector('.content-rsvtn');
31 | const futureRsvtns = document.createElement('ul');
32 | futureRsvtns.classList.add('rsvtns-list');
33 | content.appendChild(futureRsvtns);
34 | fillRsrvtns(id);
35 | const rsvtnForm = document.createElement('form');
36 | rsvtnForm.innerHTML = `Get rescued by this hero, Reserve Now!
37 |
40 |
43 |
46 | `;
47 | rsvtnForm.classList.add('rsvtn-form');
48 | rsvtnForm.addEventListener('submit', (e) => {
49 | e.preventDefault();
50 | fetch(`https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/${appID}/reservations`, {
51 | method: 'POST',
52 | body: JSON.stringify({
53 | item_id: id,
54 | username: document.querySelector('#rsvtn-name').value,
55 | date_start: document.querySelector('#dateStart').value,
56 | date_end: document.querySelector('#dateEnd').value,
57 | }),
58 | headers: {
59 | 'Content-type': 'application/json; charset=UTF-8',
60 | },
61 | }).then(() => {
62 | document.querySelector('#rsvtn-name').value = '';
63 | document.querySelector('#dateStart').value = '';
64 | document.querySelector('#dateEnd').value = '';
65 | fillRsrvtns(id);
66 | });
67 | });
68 | content.appendChild(rsvtnForm);
69 | };
70 |
--------------------------------------------------------------------------------
/src/reservations.test.js:
--------------------------------------------------------------------------------
1 | import { countRsvtns } from './reservations.js';
2 |
3 | describe('Reservations Tests', () => {
4 | test('count multiple reservations', () => {
5 | const reservations = [1, 2, 3];
6 | const reservationsMessage = countRsvtns(reservations);
7 | expect(reservationsMessage).toBe('3 people is being rescued by this Hero in the next days');
8 | });
9 |
10 | test('count zero reservations', () => {
11 | const reservations = [];
12 | const reservationsMessage = countRsvtns(reservations);
13 | expect(reservationsMessage).toBe('0 people is being rescued by this Hero in the next days');
14 | });
15 |
16 | test('count aunique reservation', () => {
17 | const reservations = [1];
18 | const reservationsMessage = countRsvtns(reservations);
19 | expect(reservationsMessage).toBe('1 person is being rescued by this Hero in the next days');
20 | });
21 | });
--------------------------------------------------------------------------------
/src/retrieve-item.js:
--------------------------------------------------------------------------------
1 | const retrieveItem = async (id) => {
2 | const character = await fetch(`https://gateway.marvel.com/v1/public/characters/${id}?ts=1&hash=cef440fde913b8756e1db19d5f18cd9e&apikey=580e7d5773a2965034fd7fcd3cad5f53`);
3 | return character.json();
4 | };
5 |
6 | export default retrieveItem;
--------------------------------------------------------------------------------
/src/style.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | padding: 0;
4 | margin: 0;
5 | background-color: var(--marvel-blue);
6 | font-family: 'cpt-marvel', monospace;
7 | color: white;
8 | }
9 |
10 | @font-face {
11 | font-family: marvel-logo;
12 | src: url(./assets/fonts/MarvelRegular-Dj83.ttf);
13 | }
14 |
15 | @font-face {
16 | font-family: cpt-marvel;
17 | src: url(./assets/fonts/Captainmarvel-anm9.ttf);
18 | }
19 |
20 | * {
21 | box-sizing: border-box;
22 | }
23 |
24 | :root {
25 | --marvel-red: #e23636;
26 | --marvel-brown: #504a4a;
27 | --marvel-blue: rgb(18, 17, 47);
28 | --marvel-orange: #f78f3f;
29 | }
30 |
31 | .d-flex {
32 | display: flex;
33 | }
34 |
35 | .logo-wrap {
36 | background-color: var(--marvel-red);
37 | display: flex;
38 | align-items: center;
39 | padding: 20px 16px 8px 20px;
40 | }
41 |
42 | .logo {
43 | font-family: 'marvel-logo', monospace !important;
44 | font-size: 60px;
45 | color: white;
46 | padding: 0;
47 | margin: 0;
48 | letter-spacing: 2px;
49 | }
50 |
51 | .nav-container {
52 | justify-content: space-between;
53 | padding: 12px 16px;
54 | background-color: var(--marvel-blue);
55 | box-shadow: 0 0 8px 0 var(--marvel-red);
56 | position: fixed;
57 | top: 0;
58 | width: 100%;
59 | }
60 |
61 | .nav-menu {
62 | list-style: none;
63 | justify-content: space-between;
64 | padding-left: 0;
65 | align-items: center;
66 | }
67 |
68 | .nav-menu li {
69 | color: #fff;
70 | margin: 0 16px;
71 | cursor: pointer;
72 | }
73 |
74 | .super-heroes-container {
75 | flex-wrap: wrap;
76 | justify-content: center;
77 | }
78 |
79 | .card-container {
80 | flex-direction: column;
81 | width: 25%;
82 | margin: 2.5%;
83 | background-color: var(--marvel-brown);
84 | padding: 1%;
85 | border-radius: 10px;
86 | }
87 |
88 | .card-container img {
89 | border-radius: 10px;
90 | }
91 |
92 | .card-info {
93 | justify-content: space-between;
94 | }
95 |
96 | .main-btn {
97 | margin: 5px;
98 | padding: 6px;
99 | font-weight: 600;
100 | cursor: pointer;
101 | }
102 |
103 | .main-btn:hover {
104 | background-color: var(--marvel-blue);
105 | color: white;
106 | border: 1px solid white;
107 | }
108 |
109 | #footer {
110 | width: 100%;
111 | bottom: 0;
112 | padding: 16px;
113 | background: var(--marvel-orange);
114 | }
115 |
116 | .overlay {
117 | position: fixed;
118 | height: 100vh;
119 | width: 100%;
120 | top: 0;
121 | backdrop-filter: blur(5px);
122 | display: flex;
123 | align-items: center;
124 | justify-content: center;
125 | z-index: 50;
126 | }
127 |
128 | .content-rsvtn {
129 | width: 100%;
130 | max-width: 800px;
131 | height: 750px;
132 | background-color: white;
133 | display: flex;
134 | flex-direction: column;
135 | align-items: center;
136 | padding: 24px;
137 | color: var(--marvel-blue);
138 | border-radius: 5px;
139 | position: relative;
140 | overflow-y: auto;
141 | }
142 |
143 | .content-rsvtn h2 {
144 | padding: 0;
145 | margin: 0 0 24px 0;
146 | font-size: 28px;
147 | }
148 |
149 | .content-rsvtn p {
150 | font-size: 18px;
151 | }
152 |
153 | .content-rsvtn img {
154 | border-radius: 5px;
155 | }
156 |
157 | .close-rsvtn {
158 | position: absolute;
159 | top: 16px;
160 | right: 16px;
161 | border: none;
162 | color: var(--marvel-red);
163 | background-color: transparent;
164 | padding: 8px 12px;
165 | border-radius: 8px;
166 | font-size: 18px;
167 | font-weight: 600;
168 | }
169 |
170 | .close-rsvtn:hover {
171 | background-color: var(--marvel-red);
172 | color: white;
173 | }
174 |
175 | .fa-heart {
176 | color: var(--marvel-blue);
177 | width: 20px;
178 | }
179 |
180 | .likes-container {
181 | padding-top: 5px;
182 | flex-direction: column;
183 | align-items: center;
184 | }
185 |
186 | .rsvtn-form {
187 | text-align: center;
188 | width: 75%;
189 | display: grid;
190 | grid-template-columns: 1fr 1fr;
191 | gap: 16px;
192 | }
193 |
194 | .rsvtn-form h2 {
195 | grid-column: 1 / 3;
196 | color: var(--marvel-brown);
197 | }
198 |
199 | .rsvtn-form button {
200 | cursor: pointer;
201 | padding: 16px;
202 | grid-column: 1 / 3;
203 | }
204 |
205 | .rsvtn-label {
206 | width: 100%;
207 | padding: 0;
208 | margin: 0;
209 | }
210 |
211 | .rsvtn-input {
212 | width: 100%;
213 | padding: 8px;
214 | }
215 |
216 | .label-name {
217 | grid-column: 1 / 3;
218 | }
219 |
220 | .rsvtns-list {
221 | list-style: none;
222 | width: 100%;
223 | display: grid;
224 | grid-template-columns: 1fr 1fr 1fr;
225 | gap: 16px;
226 | }
227 |
228 | .rsvtns-list h2 {
229 | grid-column: 1 / 4;
230 | color: var(--marvel-brown);
231 | }
232 |
233 | .rsvtns-list li {
234 | color: white;
235 | padding: 4px;
236 | background-color: var(--marvel-brown);
237 | border-radius: 4px;
238 | }
239 |
240 | .rsvtns-list li * {
241 | font-size: 14px;
242 | margin: 4px 0;
243 | padding: 0 0;
244 | }
245 |
246 | #comment-input {
247 | display: flex;
248 | flex-direction: column;
249 | color: #000;
250 | }
251 |
252 | #comment-input h3 {
253 | font-size: 25px;
254 | }
255 |
256 | #comment-input input,
257 | #comment-input textarea {
258 | padding: 10px 10px;
259 | margin: 10px 0;
260 | }
261 |
262 | #comment-input textarea {
263 | padding: 30px 10px;
264 | }
265 |
266 | #comment-input button {
267 | font-family: 'cpt-marvel', monospace;
268 | background-color: var(--marvel-red);
269 | border: none;
270 | color: #fff;
271 | margin: 0 200px;
272 | padding: 10px 10px;
273 | }
274 |
275 | .single-comment {
276 | background-color: var(--marvel-blue);
277 | padding: 2px 10px;
278 | margin: 10px 0;
279 | border-radius: 8px;
280 | border: 1px solid #000;
281 | }
282 |
283 | .single-comment p {
284 | font-size: 24px;
285 | color: #fff;
286 | }
287 |
288 | .single-comment h4 {
289 | margin-left: 10px;
290 | color: #fff;
291 | }
292 |
293 | .number-of-items {
294 | padding: 120px 0 0 16px;
295 | font-size: 20px;
296 | }
297 |
--------------------------------------------------------------------------------
/src/testing-items-homepage.js:
--------------------------------------------------------------------------------
1 | const countingCards = (heroArray) => {
2 | const allCards = heroArray.length;
3 | return (allCards);
4 | };
5 |
6 | const hello = () => {
7 |
8 | };
9 |
10 | export { countingCards, hello };
--------------------------------------------------------------------------------
/src/testing-items-homepage.test.js:
--------------------------------------------------------------------------------
1 | describe('Counting all showing cards', () => {
2 | test('Count cards', () => {
3 | const heroArray = [{
4 | comics: 2,
5 | events: 5,
6 | id: 84738,
7 | }, {
8 | comics: 2,
9 | events: 5,
10 | id: 84738,
11 | }, {
12 | comics: 2,
13 | events: 5,
14 | id: 84738,
15 | }];
16 | const counter = heroArray.length;
17 | expect(counter).toBe(3);
18 | });
19 | });
--------------------------------------------------------------------------------
/ssCapstone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexRS90/javascript-capstone/be36d691ae9268271d92bf44650eb272747d732f/ssCapstone.png
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const HtmlWebpackPlugin = require('html-webpack-plugin');
3 |
4 | module.exports = {
5 | mode: 'development',
6 | entry: './src/index.js',
7 | plugins: [
8 | new HtmlWebpackPlugin({
9 | template: './src/index.html',
10 | }),
11 | ],
12 | output: {
13 | filename: 'main.js',
14 | path: path.resolve(__dirname, 'dist'),
15 | clean: true,
16 | },
17 | devServer: {
18 | static: './dist',
19 | },
20 | module: {
21 | rules: [
22 | {
23 | test: /\.css$/i,
24 | use: ['style-loader', 'css-loader'],
25 | },
26 | ],
27 | },
28 | };
--------------------------------------------------------------------------------