grids/contect pushed off to the right in small devices/phones webpage

I am building a portfolio for myself, trying to have the website fit well on phones. currently, the sections are pushed to the right when you go phone mode. This problem only occurs when I go to dev view and select a real phone, but when I resize the window normally they are not pushed to the right.

Does anyone know what could be the cause of this?

Here is my setup so far. PhoneModeProblem picture.

INDEX.css – the whole webpage structure

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

/*
    every element will have the folowing
*/
*{
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    box-sizing: border-box;
    list-style: none;
    text-decoration: none;

}
/*
    Our CSS variables are here
    Colors of our page
*/
:root{
    --color-bg: #0c243c;
    --color-bg-variant: #c9d1d5;
    --color-primary: #55c2c3;
    --color-primary-variant: #7e8c9c;
    --color-white: #fff;
    --color-light: rgba(255, 255, 255, 0.6);

    --transition: all 400ms ease;

    --container-width-lg: 75%;
    --container-width-md: 86%;
    --container-width-sm: 90%;

}

html{
    scroll-behavior: smooth;
    
}
/**
    remove scroll bar
*/
::-webkit-scrollbar{
    display: none;
}

body{
    font-family: 'Poppins', sans-serif;
    background: var(--color-bg);
    color: var(--color-white);
    line-height: 1.7;
    background-image: url(../src/assests/image-from-rawpixel-id-3944564-original.png);

}

/* ============ GENERAL SYTLES ===========*/

.container{
    width: var(--container-width-lg);
    margin: 0 auto;
}

h1,h2,h3,h4,h5{
    font-weight: 500;
    

}
h1{
    font-size: 2.5rem;

}

section{
    margin-top: 8rem;
   

}
section > h2, section > h5{
    text-align: center;
    color: var(--color-light); 
}

section > h2 { 
    color: var(--color-primary);
    margin-bottom: 3rem;
}

.text-light{
    color: var(--color-light);
    
}

a{
    color: var(--color-primary);
    transition: var(--transition);
}

a:hover{
    color: var(--color-white);
}

/* buttons */
.btn{
    width: max-content;
    display: inline-block;
    color: var(--color-primary);
    padding: 0.75rem 1.2rem;
    border-radius: 0.4rem;
    cursor: pointer;
    border: 1px solid var(--color-primary);
    transition: var(--transition);  
}

.btn:hover{
    background: var(--color-white);
    color: var(--color-bg);
    border-color: transparent;

}

.btn-primary{
    background: var(--color-primary);
    color: var(--color-bg);
}

img{
    display: block;
    width: 100%;
    object-fit: cover;
}

/* =================  (MEDIUM DEVICES/TABLETS) MEDIA QUERIES ================ */

@media screen and (max-width: 1024px) {
    .container{
        width: var(--container-width-md);
    }

    section{
        margin: 6rem;   
    }
}

/* ================= (SMALL DEVICES/PHONES) MEDIA QUERIES ================ */

@media screen and (max-width: 600px) {
    .container{
        width: var(--container-width-sm);
    }

    section > h2{
        margin-bottom: 2rem;   
    }
}

Experience.css – the problem rises after styling

.experience__container{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.experience__container > div {
    background: var(--color-bg);
    padding: 2.4rem 5rem;
    border-radius: 2rem;
    border: 1px solid transparent;
    transition: var(--transition);
}
.experience__container > div:hover{
    background: transparent;
    border-color: var(--color-primary-variant);
    
}
.experience__container > div h3{
    text-align: center;
    margin-bottom: 2rem;
    color: var(--color-primary);
}
.experience__contect{
    display: grid;
    grid-template-columns: 1fr 1fr;
    row-gap: 1.7rem;
}

.experience__details{
    display: flex;
    gap: 1rem;
}
.experience__details-icon{
    margin-top: 6px;
    color: var(--color-primary);
}
.experience__frontend{
    align-items: center;
}

/* =================  (MEDIUM DEVICES/tablets) MEDIA QUERIES ================ */

@media screen and (max-width: 1024px) {
    .experience__container{
        grid-template-columns: 1fr;
    }
    .experience__container > div{
        width: 80%;
        padding: 2rem;
        margin: 0 auto;
    }
    .experience__contect{
        padding: 1rem;
    }
    
 
 }
 
 /* ================= (SMALL DEVICES/PHONES) MEDIA QUERIES ================ */
 
 @media screen and (max-width: 600px) {
     .experience__container{
         gap: 1rem;
     }
     .experience__container > div{
         width: 100%;
         padding: 2rem;
     }
     .experience__contect{
         padding: 1rem;
     }

 }

experience.jsx – Where the problem happnes in small devices.

import React from 'react'
import './experience.css'
import {BsPatchCheckFill} from 'react-icons/bs'

const experience = () => {
  return (
    <section id='experience'>
      <h5>What Skills I Have</h5>
      <h2>My Experience</h2>
      <div className="container experience__container">
        <div className="experience__frontend">
          <h3> Frontend Development</h3>
          <div className="experience__contect">
            <article className='experience__details'>
              <BsPatchCheckFill className='experience__details-icon' />
              <div>
                <h4>HTML</h4>
                <small className='text-light'>Intermediate</small>
              </div>
            </article>
            <article className='experience__details'>
              <BsPatchCheckFill className='experience__details-icon'/>
              <div>
                <h4>CSS</h4>
                <small className='text-light'>Intermediate</small>
              </div>
            </article>
            <article className='experience__details'>
              <BsPatchCheckFill className='experience__details-icon'/>
              <div>
                <h4>JavaScript</h4>
                <small className='text-light'>Basic</small>
              </div>
            </article>
            <article className='experience__details'>
              <BsPatchCheckFill className='experience__details-icon'/>
              <div>
                <h4>React</h4>
                <small className='text-light'>Intermediate</small>
              </div>
            </article>
            <article className='experience__details'>
              <BsPatchCheckFill className='experience__details-icon'/>
              <div>
                <h4>BootStrap</h4>
                <small className='text-light'>Basic</small>
              </div>
            </article>
          </div>
        </div>
        {/* END OF FRONT END */}
        <div className="experience__backend">
          <h3>Backend Development</h3>
          <div className="experience__contect">
        <article className='experience__details'>
              <BsPatchCheckFill className='experience__details-icon'/>
              <div>
              <h4>Java</h4>
              <small className='text-light'>Intermediate</small>
              </div>
            </article>
            <article className='experience__details'>
              <BsPatchCheckFill className='experience__details-icon'/>
              <div>
                <h4>Python</h4>
                <small className='text-light'>Intermediate</small>
              </div>
            </article>
            <article className='experience__details'>
              <BsPatchCheckFill className='experience__details-icon'/>
              <div>
                <h4>C#</h4>
                <small className='text-light'>Intermediate</small>
              </div>
            </article>
            <article className='experience__details'>
              <BsPatchCheckFill className='experience__details-icon'/>
              <div>
                <h4>Node JS</h4>
                <small className='text-light'>Basic</small>
              </div>
            </article>
            <article className='experience__details'>
              <BsPatchCheckFill className='experience__details-icon'/>
              <div>
                <h4>Microsoft SQL</h4>
                <small className='text-light'>Basic</small>
              </div>
            </article>
            </div>
        </div>
      </div>
    </section>
  )
}

export default experience

How to merge a nested array of objects in javascript with a specific shape

I am trying to merge an array of objects by summing up the totals of each key value pair under the totals object. For example, the below array would yield one object with a totals object of 3 apples and 5 oranges. This should be dynamic. If pears were to be a key in another object, the resulting object would include three keys under the totals object: apples, orange, and pears.

// Input Shape: array of "n" objects
const arr = [
  {
    summary: {
      totals: {
        apples: 2,
        oranges: 3,
      },
    },
  },
  {
    summary: {
      totals: {
        apples: 1,
        oranges: 2,
      },
    },
  },
];

/*
Output Shape: one object
{
    summary:{
    totals:{
      apples:3,
      oranges:5
    }
  }
}
*/

function mergeObjects(arr) {
  let shape = {
    summary:{
      totals:{}
    }
  }
  
  return arr.reduce((prev, cur) => {
   if(cur.summary.totals.apples){
     shape.summary.totals.apples.push(cur.summary.totals.apples)
   }
  }, shape);
}

how to update data after delete operation in database using react and redux

i am building a ecommerce project react and django and i want to create my own custom admin page.
I am using redux for state management and axios for fetching data from api. when i perform the delete operation it gets delted from database but it updates in frontend only after refreshig the page. i want it to update in real time . please help me to solve this. the source code used is as follows:

AdminPage.js

    import React, { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
        
import { userList  ,deleteUser} from "../actions/userAction";
import { Link, useNavigate } from "react-router-dom";
import Loader from "../components/Loader";

function AdminPage() {
  const dispatch = useDispatch();
  const navigate = useNavigate();

  const usersList = useSelector((state) => state.usersList);
  const { users, error, loading } = usersList;

  const loginuser = useSelector((state) => state.loginuser);
  const {userInfo} = loginuser

  const userDelete = useSelector(state => state.userDelete)
  const { success:successDelete} = userDelete

  useEffect(() => {
    if (userInfo && userInfo.isAdmin){
       dispatch(userList())
      } else{
          
          navigate('/login')
      }
     
  }, [ dispatch, successDelete ,  userInfo ]);

  const handleDelete = (id) => {
  
    dispatch(deleteUser(id))
  }
  const handleEdit = () => {
    console.log('edited');
  }


  

  

  return loading ? (
    <Loader />
  ) : error ? (
    <div className="alert alert-danger mt-5">{error}</div>
  ) : (
    <div className="container">
      <div className="row">
        <div className="col-md-10 col-sm-12 mx-auto">
          <h5 className="text-center mb-4 mt-5">USERS</h5>
          <table className="table table-dark table-striped">
            <thead>
              <tr>
                <th scope="col">Id</th>
                <th scope="col">email</th>
                <th scope="col">Name</th>
                <th scope="col">Admin</th>
                <th scope="col">Action</th>
              </tr>
            </thead>
            <tbody>
              {users.map((user) => (
                <tr key={user._id}>
                  <td>{user._id}</td>
                  <td>{user.email}</td>
                  <td>{user.name}</td>
                  <td>
                    {user.isAdmin ? (
                      <i
                        className="fas fa-check"
                        style={{ color: "green" }}
                      ></i>
                    ) : (
                      <i className="fas fa-times" style={{ color: "red" }} />
                    )}
                  </td>
                  <td>
                    <button className="btn-sm"
                     onClick={() => handleEdit}>
                      <i className="fa-solid fa-pen-to-square"></i>
                    </button>
                    <button className="btn-sm" 
                    onClick={() => handleDelete(user._id)}>
                      <i
                        className="fa-solid fa-trash-can"b
                        style={{ color: "red" }}
                      ></i>
                    </button>
                  </td>
                </tr>
              ))}
            </tbody>
          </table>
        </div>
      </div>
    </div>
  );
}
export default AdminPage;

How to get the two Input control elements look exactly same in terms of background and border?

I am using Material UI to create a password field and normal textField

        <OutlinedInput
        
   
        type={showPassword ? "text" : "password"}
        variant="outlined"
        size="small"
        sx={{
          height: 38,
          width: 190,
        }}
        endAdornment={
          <InputAdornment position="end">
            <IconButton
              onClick={() =>
                setShowPassword((showPassword) => !showPassword)
              }
              onMouseDown={(event) => event.preventDefault()}
              edge="end"
            >
              {showPassword ? <VisibilityOff /> : <Visibility />}
            </IconButton>
          </InputAdornment>
        }
      />

and here is the normal text field –

<TextField
               
                onChange={onChange}
                variant="outlined"
                size="small"
                type="Text"
                className={classes.Text}
              />

The problem is that my password looks very different also the mouse click for the password entry is not good. Here is the screen shot. How can I make it look exactly like TextField but with that eye icon for password – show and hide?

Icon button and TextField

How to Generate a Random Number that are stored on the Browser on Javascript or PHP

Can anyone help me with this code? This code is in liquid language, but I wanted it in javascript or php, both would be great for me to test here which one would be better. But basically this code is generated on the page and once generated the user can update as many times as he wants and it doesn’t change. If anyone can help me I would be very grateful.

{%- assign min = 333 -%} 
{%- assign max = 1800 -%} 
{%- assign diff = max | minus: min -%} 
{%- assign random_number = "now" | date: "%N" | modulo: diff | plus: min -%}

<span  | {{ random_number }} </span>

I try simulate a method type of puppeter in a Vanilla Js. – Check a Focus and send a string to input

I’m trying to do a chrome extension automation.
I’m blocked in the following problem.

I chose to use Vanila JS
Me to be a simple automation
But the website is a ReactApplication.
Everytime i send a number string for a input.
The state of webapplication reset for NaN.

In the puppeter JS.
I can’t use a type function to send a string.
But in Vanila JS i try set
** element.value = ‘2.0’
// and nothing.

**i think is dispathEvent is the solution for this but i dont know event i call for this

anyone know how a i can’t send fix this feature

Reloading stylesheet is fluid in Chrome, but weird in Firefox (jQuery)

I am using the following code to reload a stylesheet when the user makes a selection:

<link type="text/css" id="main_style" href="css/style.php" rel="stylesheet">

<button id="secret_1" style="display:none;"></button>

$(document).ready(function(){
function freshStyle(stylesheet){
   $('#main_style').attr('href',stylesheet);
}
$('#secret_1').click(function(event){
    event.preventDefault();
    var restyled = 'style.php?v='+Math.random(0,10000); 
    freshStyle(restyled);
});
});

In Chrome, the reload happens fluidly, and the transitions look great. In Firefox, the website temporarily becomes a garbled mess (while the stylesheet is being reloaded) for a second before the new stylesheet is active.

Is this something that can be solved with code, or is this just a feature of the Firefox browser?

How do I switch objects from a level into a child object without importing anything new in javascript?

How can I switch the frame of the bouncePad when the player collides with a lever without importing new stuff? Currently it just says the lever does not exist when the player tries to bounce.

Basically I want the character to bounce when it touches the bounce pad but only when the lever is turned on.

I am using replit so I cant have child objects in the addLevel function

addLevel([
        "            x",
        "   ======================",
        "            -----------===",
        "                         -=           /",
        "                                ========",
        "                  $            =--------",
        "            ============      =-",
        "",
        "                           x",
        "============================@=============================",
    ], {
        // define the size of each block
        width: 32,
        height: 32,
        // define what each symbol means, by a function returning    a component list (what will be passed to add())
        "=": () => [
            sprite("ground"),
            area(),
            solid(),
            "ground",
        ],
        "/": () => [
            sprite("lever"),
            pos(),
            area(),
            "lever"
        ],
        "-": () => [
            sprite("dirt"),
            area(),
            solid(),
            "ground"
        ],
        "@": () => [
            sprite("bouncePad"),
            pos(0, -1),
            area(),
            solid(),
            "bouncePad"
        ],
    })


    player.onCollide("bouncePad", (bouncePad) => {
        if (lever.frame == 2) {
            player.jump(JUMP_FORCE * 2)
        }
    })
    player2.onCollide("bouncePad", (bouncePad) => {
        if (lever.frame == 2) {
            player2.jump(JUMP_FORCE * 2)
        }
    })
    player.onCollide("lever", (lever) => {
        if (lever.frame == 0) {
            lever.play("switch")
            wait(0.2, () => {
                lever.stop()
                lever.frame = 2
                wait(0.3)
            })
            bouncePad.frame = 5
        }
    })
    player2.onCollide("lever", (lever) => {
        if (lever.frame == 0) {
            lever.play("switch")
            wait(0.2, () => {
                lever.stop()
                lever.frame = 2
                wait(0.3)
            })
        }
    })

Aframe camera disconnects from rig when page is loaded

I am new to Aframe and I came to one problem which I cant solve. When my Glitch page is loaded, the camera sometimes somehow disconnects from rig (player) head. I was looking for what could possibly cause this problem and I only saw this happening when I added render cam child to main camera (because of minimap).

I am using for 2nd cam this component:
https://github.com/jgbarah/aframe-playground/tree/master/camrender-01

Screenshot of problem:
https://imgur.com/a/V8hVKt8

Any tips or suggestions?

Thanks.

Code:

<a-assets>
   <canvas id="cam2" position="0 0 0"></canvas>
</a-assets>
<a-entity id="bodyOfPlayer"> 
         <a-entity   
                    id="rig"        
                    position = "0 0 0"
                    rotation="0 0 0"
                    movement-controls   
                    gaze-interaction  
                    kinematic-body
                    >
                  <a-entity
                            id="headOfPlayer"
                            camera 
                            position="0 1.6 0"
                            rotation="0 0 0"
                            look-controls="pointerLockEnabled:false"                          
                            >                  
                             
                             <a-sphere class="head" visible="true" random-color></a-sphere>
                    
                             <a-circle position="-1.2 0.58 -1" rotation="0 0 0" scale="0.2 0.2 0.2" width="0.41" height="0.41"
                             material="src:#cam2; opacity: .95" canvas-updater></a-circle>
                             <a-image src="#map" position="-1.2 0.58 -1" width="0.53" height="0.53"></a-image>
                        
                             <a-entity class="rayhead" cursor raycaster="objects: .clickable; showLine: true; far: 500" line="color: white; opacity: 1" position="0 0 0" visible="false"></a-entity> 
                            <a-entity cursor="fuse: false" geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03" material="color: black; shader: flat" position="0 0 -1"></a-entity> 
                  </a-entity>
           <a-entity camera="active: false" active="false" camrender="cid: cam2" position="0 15 0" rotation="-90 0 0"></a-entity>
         </a-entity>
      </a-entity> 

Laravel Hiding Validation Errors Message with Ajax when is true

i have implement the validation errors message with ajax successfully, but when the previous input form is true, the previous error in that input form is not hiding. Anyone can help me to hide the previous error if input form is true?

This is my javascript code :

error: function (jqXHR, textStatus, errorThrown) {
            console.log(jqXHR);
            let errors = jqXHR.responseJSON.errors;
            $.each(errors, function (key, value) {
                $(`#${key}`).addClass("is-invalid");
                $(`.${key}-error`).append(`
                <span class="text-danger" style="font-size: 0.8rem">
                    ${value.map((v) => "<strong>" + v + "</strong>")}
                </span>
                `);
            });
            Swal.fire({
                icon: "error",
                type: "error",
                title: "Make sure all data is filled!",
                showConfirmButton: true,
            });
        }

In my controller i have return validation error json from Validator::make()

if ($validator->fails()) {
       return response()->json(['errors' => $validator->errors()->all()]);
}

convert base64 string to usable URL

I have a string that was made using toDataURL() on my HTML canvas, creating an image. I’d like to be able to encode / decode that string so it can be used with window.open(string)

string looks like

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB4AAAAOfCAYAAAApbd6bAAAgAElEQVR4Xuzdfaxt6V0X8OHct5nplEHQUFobiJEWakwNiRKjmIqJBQShCS...