My html page is cutting on mobile screen and scroll bar on x-axis automatically becomes active. What is the issue?

I am working on my porfolio. My project section html page is cutting on mobile screen and scroll bar on x-axis automatically becomes active. What is the issue?.

UI:
User Interface Link OR https://hamzailyas-portfolio-237.web.app/portfolio/projects.html

HTML code:
https://i.stack.imgur.com/639QQ.png

CSS code:

.project-container {
    float: left;
    width: 30%;
    text-align: center;
    border-radius: 6px;
    margin: 40px 22px;
}

#row {
    margin-top: -100px !important;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
}

.project-card {
    box-shadow: 0 4px 6px 0 rgba(0, 0, 0, 0.2);
    padding: 70px 20px !important;
    min-width: fit-content;
    text-align: center;
}

.project-card a {
    color: black;
    text-decoration: none;
}

.project-card:hover {
    background: crimson;
    color: white !important;
    transition: all 0.3s ease !important;
    transform: scale(1.05);
}

.project-card:hover a {
    color: white !important;
}

.project-card h1 {
    font-size: 35px;
    text-transform: capitalize;
    font-family: 'Ubuntu', sans-serif;
}

.project-card p {
    font-size: larger;
    margin-top: 30px;
    display: flex;
    justify-content: space-evenly;
}

.project-card p img {
    height: 30px;
    margin-top: -5px;
}

/* @media only screen and (min-width: 651px) and (max-width: 1100px) { 
    .project-container {
        margin-right: 100px;
    }        
} */

@media screen and (max-width: 1319px) {
    .project-card img {
        margin-right: 7px;
    }
}

@media screen and (max-width: 950px) {
    .project-container {
        width: 50%;
    }
}

@media screen and (max-width: 650px) {
    .project-container {
        width: 70%;
    }
}

@media screen and (max-width: 550px) {
    .project-container {
        width: 90%;
    }

    .project-card img {
        margin-right: 10px;
    }
}

@media screen and (max-width: 450px) {
    .project-card img {
        margin-right: 10px;
    }

    .project-card {
        padding: 60px 10px !important;
        font-size: smaller;
    }
}

JavaScript – Modify localstorage json

I have the following Json, in the browser’s localstorage, I want to know if there is a way to take it and modify it with JavaScript.

The json you are seeing is modified to make it easier to understand the information, but it grows more than 22 thousand lines and exponentially due to the values ​​of the variable called pricelist.

What I want to do is :

  1. grab the json from localstorage.

  2. make a method that goes through all the json and when it finds the variable “pricelist” delete the content that has “items_ids” and “items”

  3. reload the json to the same key

ANNOTATIONS: -the variable lines can be empty.
-the variable pricelist can be false.

Thank you very much for your attention and your comments.

[
{
   "id":"00027-008-0001",
   "data":{
      "lines":[
        [
            0,
            0,
            {
               "product_id":23603,
               "pricelist":{
                  "id":10,
                  "item_ids":[
                     27069,
                     26894
                  ],
                  "items":[
                    {
                        "id":20044,
                        "product_tmpl_id":[
                           13142,
                           "[DNCM1LT] DESENGRASANTE NARANJA CITRUSMAX 1 LT"
                        ]
                    }
                    ]
                },
                "uom_id":[
                    1
                ]
            }
        ],
        [
            0,
            0,
            {
               "product_id":23666,
               "pricelist":false,
                "uom_id":[
                    1
                ]
            }
        ]
        ],
        "pos_session_id":27
    }
},
{
    "id":"00027-008-0002",
    "data":{
       "lines":[
          [
             0,
             0,
             {
                "product_id":23655,
                "pricelist":false,
                 "uom_id":[
                     1
                 ]
             }
         ]
         ],
         "pos_session_id":27
     }
 },
{
    "id":"00027-008-0003",
    "data":{
        "lines":[
        
        ],
        "pos_session_id":27
    }
}]

Jest testing a loop with Booleans

I have the following function in Jest. I have a method called isAquatic that returns a bool depending on the animal.

        const nonAquaticAnimal = ["tiger", "cat", "lion]
        test.each(nonAquaticAnimal)(
          '.isAquatic',
          (input, false) => {
            const animal = isAquatic(input)
            expect(animal).toBe(false);
          },
        );

I have an error that says identifier false is a reserved word and cannot be used here. How can I loop through the array and call this method which returns a boolean?

d3 to account for missing data in line chart

I am using d3.js to create a data-driven path. But the path is not accounting for missing data.

For example,

const src = [{
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 1997,
        "Value": 15.540540540540499
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 1998,
        "Value": 15.540540540540499
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 1999,
        "Value": 22.4489795918367
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2000,
        "Value": 22.972972972973
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2002,
        "Value": 25.3333333333333
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2003,
        "Value": 25.3333333333333
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2004,
        "Value": 24.6666666666667
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2005,
        "Value": 24.6666666666667
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2006,
        "Value": 24.6666666666667
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2007,
        "Value": 26.6666666666667
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2008,
        "Value": 26.6666666666667
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2009,
        "Value": 27.3333333333333
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2010,
        "Value": 24.6666666666667
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2011,
        "Value": 24.6666666666667
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2012,
        "Value": 24.6666666666667
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2013,
        "Value": 26
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2014,
        "Value": 26
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2015,
        "Value": 26.6666666666667
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2016,
        "Value": 28.6666666666667
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2017,
        "Value": 28.6666666666667
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2018,
        "Value": 28.6666666666667
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2019,
        "Value": 30.463576158940398
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2020,
        "Value": 30.463576158940398
    },
    {
        "Region": "East Asia & Pacific",
        "Name": "Australia",
        "Year": 2021,
        "Value": 31.125827814569501
    }
]

////////////////////////////////////////////////////////////
//////////////////////// 1 CREATE SVG ////////////////////
////////////////////////////////////////////////////////////
const width = 1280;
const height = 720;

const svgns = 'http://www.w3.org/2000/svg'
const svg = d3.select('svg')

svg
//.attr('xmlns', svgns)
    .attr('viewBox', `0 0 ${width} ${height}`)

//---create a rect covering viewBox --- to be deleted later
svg.append('rect')
    .attr('class', 'vBoxRect')
    .attr('width', `${width}`)
    .attr('height', `${height}`)
    .attr('fill', 'none')
    .attr('stroke', 'red')

////////////////////////////////////////////////////////////
//////////////////////// 2 CREATE BOUND ////////////////////
////////////////////////////////////////////////////////////   
const padding = {
    top: 70,
    bottom: 50,
    left: 70,
    right: 190
}

const boundHeight = height - padding.top - padding.bottom;
const boundWidth = width  - padding.right - padding.left;

//create BOUND rect -- to be deleted later
svg.append('rect')
    .attr('class', 'boundRect')
    .attr('x', `${padding.left}`)
    .attr('y', `${padding.top}`)
    .attr('width', `${boundWidth}`)
    .attr('height', `${boundHeight}`)
    .attr('fill', 'none')
    .attr('stroke', 'green')

//create bound element
const bound = svg.append('g')
    .attr('class', 'bound')
    //specify transform, must be .style and not .attr, px needs to be mentioned
    .style('transform', `translate(${padding.left}px,${padding.top}px)`)

////////////////////////////////////////////////////////////
//////////////////////// 3 CREATE SCALE ////////////////////
////////////////////////////////////////////////////////////


const scaleX = d3.scaleLinear()
    .range([0, boundWidth])
    .domain(d3.extent(src, d => d.Year))

const scaleY = d3.scaleLinear()
    .range([boundHeight, 0])
    .domain(d3.extent(src, d => d.Value))

////////////////////////////////////////////////////////////
//////////////////////// 4 CREATE AXIS ////////////////////
////////////////////////////////////////////////////////////    

bound.append('g').attr('class', 'yAxis')
    .append('g').attr('class', 'yAxisDetail')    
    .call(d3.axisLeft(scaleY) ) 

const data2 = src.map(d => d.Year)
const count = [...new Set(data2)].length - 1 
const minYear = Math.min([...src])

bound.append('g')
    .attr('class', 'xAxis')
    .append('g')
    .attr('class', 'xAxisBottom')
    .style('transform', `translateY(${boundHeight}px)`)
    .call(d3.axisBottom(scaleX).ticks(count).tickFormat(d3.format("d")))    

////////////////////////////////////////////////////////////
//////////////////////// 5 CREATE PATH ////////////////////
////////////////////////////////////////////////////////////    
    
    const line = d3.line()   
    .x(d => scaleX(d.Year))
    .y(d => scaleY(d.Value))
    
bound.append('g')
     .attr('class', 'valLine')
     .append('path')
     .attr('d', line(src))
     .attr('stroke', 'black')
     .attr('fill', 'none')
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script type="text/javascript" src="https://d3js.org/d3.v7.min.js"></script>


<body>

    <div id="container" class="svg-container"></div>
    <svg>
   
</svg>
    

</body>
    <script type="text/javascript">
    </script>

</html>

There is no data for Year=2021. Yet, d3 is generating a path between 2001 and 2002. How can I ask d3 to not generate anything between that.

I am hoping for a gap in path between that period.

Nuxt.js 2 Module @nuxtjs/sentry cors blocked request

Please help with my problem.
I install sentry how module to Nuxt.js 2. It’s worked, but i have another problem with CORS.
i do not understand how fix this error.
enter image description here

i use "nuxt": "2.14.5"," @nuxtjs/sentry": "^5.1.7", in my project.
my nuxt.js.config:

modules: ['@nuxtjs/axios', '@nuxtjs/auth', '@nuxtjs/toast', 'vue-scrollto/nuxt', 'nuxt-i18n', '@nuxtjs/gtm', '@nuxtjs/sentry'],

sentry: { dsn: process.env.SENTRY_DSN || '', injectMock: true, injectLoadHook: false, mockApiMethods: true, chunkName: 'sentry', webpackPrefetch: false, webpackPreload: false, },

Quasar with prerender-spa-plugin Unable to prerender all routes

I have an error when I want to use ‘prerender-spa-plugin’ in my quasar application.

 App •  WAIT  • Compiling of "UI" in progress...
[prerender-spa-plugin] Unable to prerender all routes!
 App •  DONE  • "UI" compiled with errors • 8092ms

 App •  ERROR  •  UI  

[prerender-spa-plugin] Unable to prerender all routes!


 App •  COMPILATION FAILED  • Please check the log above for details.

I added prerender-spa-plugin in my package.js

  "dependencies": {
    "@quasar/extras": "^1.12.0",
    "axios": "^0.24.0",
    "core-js": "^3.19.1",
    "html-webpack-plugin": "^5.5.0",
    "quasar": "^2.3.1",
    "vue-i18n": "^9.1.9",
    "vuex": "^4.0.1"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.16.3",
    "@quasar/app": "^3.2.1",
    "@quasar/quasar-app-extension-qoverlay": "2.0.1",
    "eslint": "^8.2.0",
    "eslint-config-standard": "^16.0.2",
    "eslint-plugin-import": "^2.1.1",
    "eslint-plugin-node": "^11.0.0",
    "eslint-plugin-promise": "^5.1.1",
    "eslint-plugin-vue": "^7.0.0",
    "eslint-webpack-plugin": "^3.1.1",
    "prerender-spa-plugin": "^3.4.0"
  },

I am trying to use it like this in the quasar.conf.js

I import it like this:

const path = require('path')
const PrerenderSPAPlugin = require('prerender-spa-plugin')
build: {
  vueRouterMode: 'history', // available values: 'hash', 'history'
  extendWebpack (cfg) {
    cfg.plugins.push(
      new PrerenderSPAPlugin({
        staticDir: path.join(__dirname, 'dist/spa/'),
        routes: ['/', '/page1']
      })
    )
  },
...
}

Do you have any idea how to solve this problem?

I tried many things that I could find on google but without success.

EJS not showing only some variables

I have this ejs template:

<h1 id="city-name"><%= title %></h1>
<h5 id="weather-description"><%= description %></h5><br>
<i class="bi bi-thermometer-half"></i><p id="temperature"><=% temperature %></p><br>
<i class="bi bi-wind"></i><p id="wind"><=% wind %></p><br>
<i class="bi bi-moisture"></i><p id="humidity"><=% humidity %></p>

and this is my js:

jsonObj = res.data;
desc = jsonObj.weather[0].description;
temp = JSON.stringify(jsonObj.main.temp);
wind = JSON.stringify(jsonObj.wind.speed);
hum = JSON.stringify(jsonObj.main.humidity);
console.log(wind);
console.log(temp);
console.log(hum);
response.render('city_template.ejs', {title : nameCapitalised, description : desc, temperature : temp, wind : wind, humidity : hum});

but in the template it shows only the title and the description, not the other variables, in console it shows wind, temp and hum, what’s wrong?

How to call a parent component method (or lift of state) from a custom React-Select MenuList component?

I have created a custom MenuList button (“Add New User”) at the bottom of a React-Select element to allow for adding another user to the select list. However, I am having trouble figuring out how to handle the event once a new user is created. The codesandbox below contains a simplified version. Specifically, line 29 this._loadData(randomId) does not have the scope to access this of the parent component (obviously). My question is, how to I add a “handleEvent” property so that I can lift up state to the parent component for this custom MenuList component?

Edit react-select-custom-event-handler

Code snippet for the custom MenuList component allowing the user to add a new AppUser:

const MenuButtonAddNewUser = (props) => {
  return (
    <components.MenuList {...props}>
      {props.children}
      <div className="border-top text-center py-2">
        <a
          href="showModalUrl.action"
          onClick={(event) => {
            event.preventDefault();

            // Simluate opening a modal and adding a user
            let randomId = Math.floor(Math.random() * (10 - 4 + 1)) + 4;
            console.log(
              "Simluate loading modal and adding a user with id: " + randomId
            );

            // Tell parent componenent to reload the options from the database
            // and auto-select the new user
            // How do I gain access to "_loadData"???
            //this._loadData(randomId);
            console.log(
              "User added. Call 'this.loadData(" + randomId + ")' here!!"
            );
          }}
        >
          <i className="fa fa-fw fa-user-plus mr-1" /> Add New Agent
        </a>
      </div>
    </components.MenuList>
  );
};

Apply CSS conditionally in a loop – VueJS

I have a JSON list of items that I import in my vue component,
I loop though that file in order to show them. Each item belong to a specific ‘group’ :

See IMG

E.g. :

{
"type": "Simple list",
"title": "Simple list",
"id": 1,
"group": "list-component",
"properties": "lorem lipsum"
},

I would like to apply a CSS ‘border-top-color’ to each item according to its group.

I was trying to make a JS method but I’m not sure how to achieve that. Here’s my atempt.

The template (I’m using VueDraggable, don’t mind it) :

          <div class="item drag" :key="element" :style="[{ 'border-top-color': 'brdrTpClr' }]">
            {{ element.title }}
            <div class="addico" :key="index">
              <i class="fas fa-add"@click="$emit('pushNewElt', element.id)"></i>
            </div>
          </div>

The script :

data() {
    return {
      dragItems: dragItemsList,
      brdrTpClr: "",
    };
  },
  mounted() {
    for (let i = 0; i <= 15; i++) {
      if (this.dragItems[i].group == "list-component") {
         // I'm not sure how to do it
        // the color I want to apply : #00A3A1b
      } else if (this.dragItems[i].group == "location-media-component") {
        // #005EB8
      } else if (this.dragItems[i].group == "container-component") {
        // #0091DA
      } else if (this.dragItems[i].group == "UI-component") {
        // #6D2077
      } else if (this.dragItems[i].group == "reader-scanner-component") {
        // #470A68
      }
    }
  },

I’m using i<=15 instead of i<=this.dragItems.length because of a bug, don’t mind it too.

value in jquery.min.js selectors

I’m using jquery and I have a question.

=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)
return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}
else while(b=a[d++])c+=e(b);return c},
d=*ga.selectors={cacheLength:50,*createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}}

What does the selectors = {cacheLength: mean in jquery.min.js?
and also is it possible to change the value of cacheLength?

ReactJS – Passing a component as a return

Im using React, useState and React-Icons.

My intention is to create a dropdown menu (without Bootstrap). I want to change the icon when clicked (to init the function) but the output is the raw SVG details. Any ideas?

import { IoMdArrowDropdownCircle, IoMdArrowDropupCircle } from "react-icons/io";

function navBar() {
  const navToggle = () => {
    const [navMenuToggle, changeNavToggle] = useState(true);
    return navMenuToggle ? (
      <IoMdArrowDropdownCircle />
    ) : (
      <IoMdArrowDropupCircle />
    );
    changeNavToggle(false);
  };
<div className="tableIcon" id="navDropdown" onClick={navToggle}>
  <IoMdArrowDropdownCircle />
</div>

What am I missing? Calculation won’t show in the field

I am trying to make an area calculator and I cannot figure out what am I missing.

the area field is not updating when entering numbers in each field.

Any advice please? I wonder if I’m missing something very important.

Many thanks in advance

Here is my html:

                <tr>
                    <th style="text-align: left;"><label>Slab Width (m): </label></th>
                    <th><div class="input-box">
                        <input type="text" name="slab_width" onkeypress="return isNumber(event)" onkeyup="calculateArea()" required="" class="form-control">
                    </div></th>
                </tr>
                <tr>
                    <th style="text-align: left;"><label>Slab Length (m): </label></th>
                    <th><div class="input-box">
                        <input type="text" name="slab_length" onkeypress="return isNumber(event)" onkeyup="calculateArea()" required="" class="form-control">
                    </div></th>
                </tr>
                <tr>
                    <th style="text-align: left;"><label>Total Area (m2):</label></th>
                    <th><div class="input-box">
                       <input type="text" name="slabsArea" disabled="" class="form-control">
                    </div></th>
                </tr>
            
            </table>```


             And here is the script for it:

    function calculateArea() {
    var form = document.getElementById("calc");
    var sLength = parseFloat(form.elements["slab_length"].value);
    var sHeight = parseFloat(form.elements["slab_width"].value);

    var slabsArea = slabWidth * slabLength;
    
    //slabsArea = Math.round(slabsArea);
    //document.getElementById("slabsArea").value = slabsArea;
    form.elements["slabsArea"].value = slabsArea;
return slabsArea;

        }



location props in gatsby is not defined

I am trying to use location props in my gastby page :
I am passing props in my Link in
pages/index.js:

 <Link state={{eventID: event.id}}  to={`/date/${event.name}`}>
  </Link>

pages/date/[dateId]/index.js:

const DateWithId = ({location},props) => {
    const { state = {} } = location
    const { eventID} = state
...}

eventually I get an error Parsing error: Identifier ‘location’ has already been declareded :
enter image description here