How to Properly Use React.memo with Framer Motion and Next.js Image Component

I’m working on a Next.js project where I need to display hero images using the Image component from next/image and animate them with framer-motion. I also want to optimize performance by using React.memo
However, I’m encountering issues with the images not rendering correctly when the hero prop is null. and all of them getting animated when only one is updated.

Here is the relevant code:

import { motion } from "framer-motion";
import Image from "next/image";
import React from "react";

interface Hero {
  name: string;
  img: string;
}

const HeroImage = React.memo(
  ({ hero, index }: { hero: Hero | null; index: Number }) => {
    return (
      <motion.div
        key={"hero" + index}
        className="relative w-full h-full"
        layoutId={"hero" + index}
        initial={{ opacity: 0 }}
        animate={{ opacity: 1 }}
        exit={{ opacity: 0 }}
      >
        <Image
          key={"hero" + index}
          src={hero?.img || ""}
          alt={hero?.name || "Placeholder"}
          layout="fill"
          objectFit="cover"
          draggable={false}
          style={{
            visibility: hero ? "visible" : "hidden",
          }}
        />
      </motion.div>
    );
  }
);

const HeroCard = React.memo(
  ({ hero, index }: { hero: Hero | null; index: Number }) => {
    return (
      <div
        className="relative overflow-hidden rounded flex-grow bg-cover"
        style={{
          backgroundImage: `url('/placeholder.png')`,
        }}
      >
        <HeroImage hero={hero} index={index} />
        <div className="absolute bottom-0 left-0 right-0 bg-black/70 text-white text-center py-1">
          {hero?.name}
        </div>
      </div>
    );
  }
);

export { HeroImage, HeroCard };

Any help or suggestions would be greatly appreciated!

I wanted a slide up animation when a hero is picked but when i pick one it works fine but if i select another all the previous ones also gets animated. i only want the animation on the one which is updated

Export in PDF issue in Angular using jspdf

     <div id="content" #content>
    <div class="skill-view-head">
                <div>
                  <label for="emp-id">Emp ID: </label>
                  <span> {{employeeId}}</span>
                </div>
                <div>
                  <label for="emp-name">Emp Name: </label>
                  <span> {{empName}}</span>
                </div>
                <div>
                  <label for="doj">DOJ: </label>
                  <span> {{doj | date:'MM/dd/yyyy'}}</span>
                </div>
              </div>
    <table class="skill-view-table certificate-table">
              <tr>
                <th>#</th>
                <th>Date</th>
                <th>Attributes</th>
                <th>Certificate Name</th>
              </tr>
              <tr *ngFor="let certificate of skillBonusdetails[0]?.getCertificatesTemp; let i = index">
                <td>{{ i + 1 }}</td>
                <td>{{ certificate.date | date:'MM/dd/yyyy' }}</td>
                <td>{{ certificate.type }}</td>
                <td>{{ certificate.certificateName }}</td>
              </tr>
              <tr *ngIf="skillBonusdetails[0]?.getCertificatesTemp?.length > 0" style="background-color: #fff;">
                <td colspan="3">Earned Points</td>
                <td>{{certificateEarnedPoints}}</td>
              </tr>
              <tr *ngIf="skillBonusdetails[0]?.getCertificatesTemp === null">
                <td colspan="4" class="text-center">No records available</td>
              </tr>
            </table>
    <div>
     <button (click)="onExportPdf(this.empName)" class="border-0 green-btn hide-export-btn">Export To PDF</button>

onExportPdf(EmpName) {
    this.loaderservice.display(true);
    const doc = new jsPDF('p', 'pt', 'A4');
    const source = document.getElementById('content');
    const button = document.querySelector('.hide-export-btn') as HTMLElement;
    const button2 = document.querySelector('.hide-export-btn2') as HTMLElement;
    const button3 = document.querySelector('.hide-export-btn3') as HTMLElement;
    source.style.width = '800px';
    doc.setFontSize(8);
    doc.html(source, {
      callback: function (pdf) {
        //doc.output('dataurlnewwindow');
        doc.save(EmpName + ' Points Details.pdf');
        
      },
      html2canvas: {
        scale: 0.7
      }
    });
    this.loaderservice.display(false);
  }

I have this code to export table content in pdf format its working good but these is only one problem, when we export pdf then some content in footer is break between first and last page. See the attached image click here image highlighted issue between two pdf pages, can you please suggest how to fix this.

Social media project: a user sees a friend’s profile

I need to create a social network project equivalent to facebook and I am in the process of creating a profile of a member using boostrap 5. In the browser I have the main profile of the administrator displayed. In my instructions, I am asked that the administrator be able to see the profile of one of his friends. I have codified this but the friend’s profile is not displayed in the browser. Can you help me please? Thank you all

type here



<div class="container mt-5">
<div class="row">
<div class="col-md-4">
<div class="card">
<img
src="assets/Juan.png"
alt="Photo de profil"
class="rounded-circle img-fluid"
style="width: 150px"
/>

        <div class="card-body">
          <h5 class="card-title" id="username">Pseudonyme</h5>
          <p class="card-text" id="FullName">Nom et Prénom</p>
          <p class="card-text" id="age">Age</p>
          <p class="card-text" id="gender">Genre</p>
          <p class="card-text" id="email">Email</p>
          <p class="card-text" id="contact">Coordonnées</p>
          <p class="card-text" id="bio">Présentation</p>
          <p class="card-text" id="preferences">Préférences</p>
          <a href="#" class="btn btn-primary">Modifier les informations</a>
        </div>
      </div>
    </div>
    <div class="col-md-8">
      <div class="card">
        <div class="card-header">Identité des utilisateurs</div>
        <div class="card-body">
          <table class="table">
            <thead>
              <tr>
                <th scope="col">Nom</th>
                <th scope="col">Prénom</th>
                <th scope="col">Voir le profil</th>
              </tr>
            </thead>
            <tbody id="usersTableBody">
              <!-- Charger les données des utilisateurs ici -->
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>
<!--Voir le profil d'un ami de l'administrateur-->
<div
  class="modal fade"
  id="viewProfileModal"
  tabindex="-1"
  aria-labelledby="viewProfileModalLabel"
  aria-hidden="true"
>
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="viewProfileModalLabel">
          Profil de l'ami
        </h5>
        <button
          type="button"
          class="btn-close"
          data-bs-dismiss="modal"
          aria-label="Close"
        ></button>
      </div>
      <div class="modal-body">
        <img
          src="assets/Rafa.png"
          alt="Photo de profil de l'ami"
          class="rounded-circle img-fluid"
          style="width: 150px"
        />
        <p>
          <strong>Pseudonyme :</strong> <span id="friendUsername"></span>
        </p>
        <p>
          <strong>Nom et Prénom :</strong> <span id="friendFullName"></span>
        </p>
        <p><strong>Age :</strong> <span id="friendAge"></span></p>
        <p><strong>Genre :</strong> <span id="friendGender"></span></p>
        <p><strong>Email :</strong> <span id="friendEmail"></span></p>
        <p>
          <strong>Coordonnées :</strong> <span id="friendContact"></span>
        </p>
        <p><strong>Présentation :</strong> <span id="friendBio"></span></p>
        <p>
          <strong>Préférences :</strong>
          <span id="friendPreferences"></span>
        </p>
      </div>
    </div>
  </div>
</div>

Loading videos one after the other freezes PHP website

`I have a PHP website hosted from my Raspberry Pi 4 8GB RAM using Apache2. It’s just a website that shows the time while playing videos in the back. The videos are stored on the Pi, not on the client.

I have a video element in my index.php file with an onended event bound function which gets the next video file path (e.g. /Media/video_name.mp4) stored in an array inside my JavaScript file. It then sets the video element’s source (src) to new new source.

However, after a while of running and changing the video source many times, the entire website freezes. The clock text does not change anymore. The video is eithe`r stuck or completely white (freezes between video loading I guess). This happens when running the website on the Pi as well as on my PC. I’m starting to think it’s something related to memory cache or the video element itself.

I’m always running my website using the url “https://website/index.php” even on the server itself (instead of using localhost).

Also, I have the net::ERR_CERT_COMMON_NAME_INVALID error because I have an invalid certificate for my HTTPS website. Perhaps this is related?

I spotted this problem after updating my website to use PHP and HTTPS. My index.html became index.php. I also generated a personal certificate for my HTTPS that is “not trusted” which gives me a warning whenever I access the website.

Here is the code I was using to make tests to see what caused the crash. This code only displays videos which causes the freeze after running for an hour using short videos and after 12 hours for longer videos.

index.php:

<!DOCTYPE html>
<html>

<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body id="body" onload="onLoad()">
    <video autoplay muted id="myVideo" class="myMedia" onended="NextMedia()">
        Your browser does not support HTML5 video.
    </video>
    <img id="myGIF" class="myMedia" onload="onImageLoaded()" onerror="onImageError()" />

    <div class="dateTimePanel">
        <b id="time_txt">00:00:00</b>
        <div id="date_txt">1 January 2000</div>
    </div>

    <div class="tittleSection">
        <div id="video_name">VIDEO NAME HERE</div>
    </div>

    <script src="script.js"></script>

</body>

</html>

script.js:

const video_list = [
    ["dog.mp4", "cat.mp4", "bird.mp4", "hamster.mp4"]
    , ["tokyo.mp4", "berlin.mp4", "france.mp4", "london.mp4"]
    , ["gif 1.gif", "gif 2.mp4", "gif 3.gif", "gif 4.gif"]
];
const dir_paths = ["./animals/", "./cities/", "./gifs/"];

const weekday = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var clockTimer;
var videoTimeout;

var video = document.getElementById("myVideo");
var GIF = document.getElementById("myGIF");
var media_title = document.getElementById('video_name');
var video_index = 0;
var playlist_index = 0;

function onLoad() {
    startTime();
    shuffle(video_list[0]);
    video.loop = false;
    NextMedia();
};

function NextMedia() {
    video_index++;
    if (video_index >= video_list[0].length) {
        video_index = 0;
        shuffle(video_list[0]);
    }
    media_src = dir_paths[0].concat(video_list[0][video_index]);
    document.getElementById('video_name').innerHTML = media_src;
    setMediaVisibility(media_src);
    // Sets the video name text
    media_title.innerHTML = video_list[0][video_index];
}

function setMediaVisibility(media_src) {
    video.style.visibility = "collapse";
    GIF.style.visibility = "collapse";
    // Verify if the file is a video
    if (media_src.toLowerCase().substr(media_src.length - 4).localeCompare("webm") == 0
        || media_src.toLowerCase().substr(media_src.length - 3).localeCompare("mp4") == 0
        || media_src.toLowerCase().substr(media_src.length - 3).localeCompare("mov") == 0
        || media_src.toLowerCase().substr(media_src.length - 3).localeCompare("avi") == 0) {
        video.style.visibility = "visible";
        video.src = media_src;
        video.play();
    }
    if (media_src.toLowerCase().substr(media_src.length - 3).localeCompare("gif") == 0
        || media_src.toLowerCase().substr(media_src.length - 3).localeCompare("jpg") == 0
        || media_src.toLowerCase().substr(media_src.length - 4).localeCompare("jpeg") == 0
        || media_src.toLowerCase().substr(media_src.length - 4).localeCompare("webp") == 0) {
        GIF.style.visibility = "visible";
        GIF.src = media_src;
    }
}

function getPlaylist() {
    return video_list[playlist_index];
}

function shuffle(array) {
    var currentIndex = array.length, randomIndex;

    // While there remain elements to shuffle.
    while (currentIndex != 0) {

        // Pick a remaining element.
        randomIndex = Math.floor(Math.random() * currentIndex);
        currentIndex--;

        // And swap it with the current element.
        [array[currentIndex], array[randomIndex]] = [
            array[randomIndex], array[currentIndex]];
    }

    return array;
};

function startTime() {
    clearTimeout(clockTimer);
    const today = new Date();
    var h = today.getHours();
    var m = today.getMinutes();
    var s = today.getSeconds();
    var day = weekday[today.getDay()];
    var date = today.getDate();
    var month = today.getMonth() + 1;
    var year = today.getFullYear();
    h = checkTime(h);
    m = checkTime(m);
    s = checkTime(s);
    date = checkTime(date);
    month = checkTime(month);

    document.getElementById('time_txt').innerHTML = h + ":" + m + ":" + s;
    document.getElementById('date_txt').innerHTML = day + " " + year + "/" + month + "/" + date;
    clockTimer = setTimeout(startTime, 1000);
};

function checkTime(i) {
    if (i < 10) { i = "0" + i };  // add zero in front of numbers < 10
    return i;
};

I tried to set the video’s src to "" then call video.load() to clear any memory used. I also added the video.load() call after whenever I set my video’s src.

I tried running my website with the bare minimum for the video (no clocks, no playlists) and it works for at least 12 hours when it comes to GIFs (using a img element). It also worked for longer videos (3-5 minutes) because I’m not changing the video src as much I guess.

I’m aiming to make my website work 24/7 without the need to go through the “untrusted certificate warning” and without it freezing.

I have only tested my program using PHP because I transitioned from HTML to PHP without changing my HTML (or PHP in this case) or my JavaScript code. Right after the transition, the problem started to appear. Therefore, I assumed it was regarding PHP and did not investigate further with a regular HTML file. The website freezes on my PC while the server is running on my Pi. I can still operate my Pi while the website on my PC is frozen.
I’ve also tried the answer on the following thread but to no avail. Same result: How do i change the src of an html5 video via javascript without either crashing chrome or leak memory?

The browser on my PC is Chrome Version 130.0.6723.117 running on Windows 11 Home Build 22621.4317. The browser on my Raspberry Pi 4 8 GB RAM is Chromium (latest) running on Raspbian Release 11 uname 6.1.21-v8+. The browser “freezes” as in any action I do does not do anything on the browser. A warning on Chromium indicates that the page is unresponsive and asks if I want to close the page which does not do anything. I have to ALT+F4 and reopen the page in order to get the website running again. When it freezes on my PI, the server is still responsive and can be accessed from my PC.

Because the Pi takes less time for Chromium to freeze, I have logged the CPU and MEM usage of chromium from start to freeze on Raspbian. Here’s the data:

Data on launch: S | 173.8% CPU | 2.6% MEM | 2:05.97 TIME+ | Chromium-Browser

Time CPU% MEM%
10h04 37.0 2.2
10h14 168.9 2.8
10h26 203.0 2.9
10h34 136.2 3.2
10h55 172.1 2.2
11h04 62.3 2.6
11h10 [F] FREEZE FREEZE
11h20 53.6 3.4

The browser froze at 11h10. I logged the final data 10 minutes after the freeze.

javascript – how to pass a variable as an argument in html code

I want to use onclick to call my dropDown function and pass 2 javascript varibles as arguments. Before I started to code my function I used numbers to test it as Ive never done this before. It seemed simple enough but I keep getting undefined in my console rather than the numbers I passed.

HTML:

<button type="button" class="list-buttons" id="link-one" onclick="dropDown()">

JavaScript:

var one = 1
var two = 2

function dropDown(button, answer){
    console.log(button)
    console.log(answer)
    console.log(button + answer)
}

Why is the function returning undefined for my parameters?

What I aim to do:

My plan was to make a dropdown button. When you click each button, it will call the function (onclick=”dropdown()”) and pass the associated content as a parameter (example: #answer-one).

The function would simply change the display of the dropdown content (#answer-one) from ‘none’ to ‘display: block’

Web Speech API: Setting a Custom Audio Output Device (Speaker) for TTS Playback with sinkId

I’m building a Text-to-Speech (TTS) component in React, where I want to specify the audio output device using sinkId (e.g., a selected speaker). Despite setting sinkId on the audio element, the audio consistently plays through the default output device instead of the selected one.

In this setup, I’m using SpeechSynthesisUtterance to generate TTS playback, and I tried routing the audio through an AudioContext with a MediaStreamDestination to control the output. However, sinkId does not seem to take effect. Any suggestions for correctly setting the output device?

example code :

import { useEffect, useRef, useState } from "react";
import { useDispatch, useSelector } from "react-redux";

const UseTTS = () => {
    const [isSpeaking, setSpeaking] = useState(false);
    const [isPaused, setIsPaused] = useState(false);

    const audioContextRef = useRef(null);
    const audioElement = useRef(null);
    const utteranceRef = useRef(null);

    const { selectedSpeakerSrc } = useSelector(state => state.setup);

    useEffect(() => {
        // Initialize AudioContext and audio element
        if (!audioContextRef.current) {
            audioContextRef.current = new (window.AudioContext || window.webkitAudioContext)();
        }
        if (!audioElement.current) {
            audioElement.current = new Audio();
        }
    }, []);

    const handlePlay = async () => {
        const ttsText = "Hello, this is a test message!";
        
        if (!utteranceRef.current) {
            utteranceRef.current = new SpeechSynthesisUtterance(ttsText);
            utteranceRef.current.lang = 'en-US';
            utteranceRef.current.onend = handleSpeechEnd;
        }

        try {
            if (audioElement.current.setSinkId && selectedSpeakerSrc) {
                await audioElement.current.setSinkId(selectedSpeakerSrc);
            }
        } catch (error) {
            console.error(`Failed to set sinkId: ${error}`);
        }

        utteranceRef.current.voice = speechSynthesis.getVoices()[0];
        speechSynthesis.speak(utteranceRef.current);
        setSpeaking(true);
    };

    const handleSpeechEnd = () => {
        setSpeaking(false);
        utteranceRef.current = null;
    };

    return {
        isSpeaking,
        handlePlay,
    };
};

export default UseTTS;

How to add labels outside the canvas in Javascript using ChartJS

Hello guys i got this problem where im trying to put some labels or kind of annotations outside a canvas that i generate with ChartJS, but im new to using ChartJS and idk if im doing the right way to do this. After the graph is generated also gives you the option to download the canva to a pdf. Let me show you what the canva looks like pic 1. And pic 2 what i want to do.pic1. PIC2.
This is what my JS looks like:

function inicializarGrafica() {
    let fecha1Input = document.getElementById("fecha1");
    let enviarButton = document.getElementById("enviar");
    let miGraficaCanvas = document.getElementById('miGrafica');
    let miGrafica;
    let totalRealElement = document.getElementById('totalReal');
    let totalEsperadoElement = document.getElementById('totalEsperado');
    let descargarButton = document.getElementById('descargarPdf');
    let graficaContainer = document.getElementById('graficaContainer'); 
    const grupos = {
        "Pozos Carrizal": ["C1", "C3", "27SP", "28SP", "SG1", "SG2", "BURGOIN", "MAUTO"],
        "Acueducto 1": ["8", "9", "10", "11", "12", "16", "30R", "31R", "H3"],
        "Acueducto 2": ["18", "17", "15BIS", "17BIS"],
        "Acueducto 3": ["20", "21", "22", "23", "24", "25", "26"],
        "Acueducto 4": ["2R", "4R", "19R"],
        "Cham. y Cent.": ["ARD1", "ARD2", "LC1", "29C"],
        "Ciudad": ["1", "2", "4", "6", "7", "14"],
        "Otros": ["PINO", "DUARTE"]
    };

    if (fecha1Input && enviarButton && miGraficaCanvas && totalRealElement && totalEsperadoElement && descargarButton) {
        enviarButton.addEventListener("click", async function () {
            var fechaActual = new Date().toISOString().split('T')[0];
            const fecha1 = fecha1Input.value;

            if (!fecha1) {
                Swal.fire({
                    icon: 'error',
                    title: 'Error',
                    text: 'El campo de fecha está vacío, favor de ingresar una fecha.'
                });
                return;
            }

            if (fecha1 > fechaActual) {
                Swal.fire({
                    icon: 'error',
                    title: 'Error',
                    text: 'La fecha ingresada no puede ser mayor a la fecha actual.'
                });
                return;
            }

            document.getElementById('fechaTotal').innerText = `Fecha: ${fecha1}`;
            const url = "APIURL";
            const datos = new URLSearchParams();
            datos.append("fecha1", fecha1);

            const opciones = {
                method: "POST",
                body: datos,
                headers: {
                    "Content-Type": "application/x-www-form-urlencoded",
                },
            };

            try {
                const response = await fetch(url, opciones);
                if (!response.ok) {
                    throw new Error(`Error en la solicitud. Código de estado: ${response.status}`);
                }
                const data = await response.json();

                let lbls = [];
                let data_real = [];
                let valor_esperado = [];
                const pozosConAsterisco = ["2R", "4R", "4", "6", "16", "17BIS", "17", "14", "19R", "20", "22", "24", "25", "26", "27SP", "28SP", "2", "8", "9", "15BIS", "21", "DUARTE", "BURGOIN", "H3"];

                // Mapear y ordenar los pozos en el orden de cada grupo
                for (let grupo in grupos) {
                    const pozosGrupo = grupos[grupo];
                    pozosGrupo.forEach(pozo => {
                        const pozoData = data.find(d => d.nombre === pozo);
                        if (pozoData) {
                            let nombrePozo = pozoData.nombre;
                            if (pozosConAsterisco.includes(nombrePozo)) {
                                nombrePozo += " *"; // Añadir asterisco
                            }
                            lbls.push(nombrePozo);
                            data_real.push(pozoData.data);
                            valor_esperado.push(pozoData.esperado);
                        }
                    });
                }

                const totalReal = data_real.reduce((a, b) => a + Number(b), 0).toFixed(2);
                const totalEsperado = valor_esperado.reduce((a, b) => a + Number(b), 0).toFixed(2);

                totalRealElement.innerHTML = `Total producido: <span style="color:${totalReal < 1067 ? '#FFAA00' : 'green'};">${totalReal}</span>`;
                totalEsperadoElement.innerHTML = `Total esperado: ${totalEsperado}`;

                function obtenerHoraUltimaCerrada() {
                    let ahoraUTC = new Date();
                    let offsetHoras = 0;
                    let horaLocal = new Date(ahoraUTC.getTime() + (offsetHoras * 60 * 60 * 1000));
                    let hora = horaLocal.getHours();
                    let horaCerrada = Math.floor(hora);
                    horaCerrada = horaCerrada < 10 ? `0${horaCerrada}` : horaCerrada;
                    document.getElementById('ultimaActualizacion').innerHTML = `Actualización: ${horaCerrada}:00 horas`;
                }
                obtenerHoraUltimaCerrada();

                if (miGrafica) {
                    miGrafica.destroy();
                }

                var datos_grafica = {
                    labels: lbls,
                    datasets: [
                        {
                            label: 'Producción',
                            data: data_real,
                            backgroundColor: 'rgba(75, 192, 192, 0.2)',
                            borderColor: 'rgba(75, 192, 192, 1)',
                            borderWidth: 1
                        },
                        {
                            label: 'Valor esperado',
                            data: valor_esperado,
                            backgroundColor: 'rgba(150, 192, 152, 0.527)',
                            borderColor: 'rgba(75, 192, 192, 1)',
                            borderWidth: 1
                        }
                    ]
                };

                var config = {
                    type: 'bar',
                    data: datos_grafica,
                    options: {
                        responsive: true,
                        maintainAspectRatio: false,
                        scales: {
                            x: {
                                ticks: {
                                    maxRotation: 45,
                                    minRotation: 45
                                }
                            },
                            y: {
                                beginAtZero: true
                            }
                        },
                        layout: {
                            padding: {
                                bottom: 50
                            }
                        },
                        plugins: {
                            tooltip: {
                                enabled: false
                            },
                            datalabels: {
                                display: true,
                                anchor: 'end',
                                align: 'end',
                                color: function(context) {
                                    const datasetIndex = context.datasetIndex;
                                    if (datasetIndex === 0) {
                                        const valueReal = context.dataset.data[context.dataIndex];
                                        const valueEsperado = valor_esperado[context.dataIndex];
                                        const porcentaje = (valueReal / valueEsperado) * 100;
                                        
                                        if (porcentaje < 70) {
                                            return 'red';
                                        } else if (porcentaje < 100) {
                                            return '#FFAA00';
                                        } else {
                                            return 'green';
                                        }
                                    } else {
                                        return 'black';
                                    }
                                },
                                font: {
                                    size: 14
                                },
                                formatter: function(value) {
                                    return value;
                                },
                                offset: 5,
                                clip: false,
                                rotation: -90
                            }
                        },
                        devicePixelRatio: window.devicePixelRatio > 1 ? 2 : 1
                    },
                    plugins: [ChartDataLabels]
                };

                miGrafica = new Chart(miGraficaCanvas, config);

                // once you generate the graph you can download
                descargarButton.style.display = 'inline-block';

                // download PDF
                descargarButton.addEventListener('click', () => {
                    const fecha = fecha1Input.value;
                    const formattedFecha = fecha ? fecha.replace(/-/g, '') : 'fecha';
                    const container = graficaContainer; // Contenedor de la gráfica
        
                    html2canvas(container).then((canvasImage) => {
                        const { jsPDF } = window.jspdf;
                        const pdf = new jsPDF('l', 'mm', 'a4');
                        const imgData = canvasImage.toDataURL('image/png');
                        
                        pdf.addImage(imgData, 'PNG', 10, 10, 280, 0);
                        const filename = `Reporte_produccion_${formattedFecha}.pdf`;
                        pdf.save(filename);
                    });
                });

            } catch (error) {
                Swal.fire({
                    icon: 'error',
                    title: 'Error',
                    text: 'Ocurrió un error al obtener los datos.'
                });
            }
        });
    }
}

This is the version of charJS that im using and annotation.
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> <script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

And here is where the graph is shown:

<body>
    <script src="views/g_todos_dia.js" defer></script>
    <div class="cont_grafica" id="graficaContainer">
        <div class="cont_canvas">
            <canvas id="miGrafica" height="auto"></canvas>
        </div>

        <!-- Aquí se muestran los totales -->
        <div class="cont_totales" id="totales">
            <div id="totalReal">Total producido: </div>
            <div id="totalEsperado">Total esperado: </div>
            <div id="ultimaActualizacion">Actualización: </div> <!-- Nuevo renglón -->
            <div id="fechaTotal"></div> <!-- Este nuevo div mostrará la fecha -->
        </div>

      
    </div>
    <div class="cont_inputs">
            <label for="fecha1" id="lbl_fecha" style='font-size: 18px;'>Fecha: </label>
            <input type="date" id="fecha1" style='font-size: 18px; height: auto;'>
        </div>
        
        <div class="cont_btn_enviar">
            <input type="button" id="enviar" value="Enviar" style='font-size: 18px; padding: 3px 40px;'>
        </div>
    <div class="cont_btn_descargar">
        <input type="button" id="descargarPdf" value="Descargar PDF" style='font-size: 18px; padding: 3px 40px;'>
    </div>
    
</body>

I tried to use annotations but what it found in the forums of chartJS is that you cant put an annotation outside the graph so, im just wondering what should be the best option to do this labeling. I tried to group in javascript every data so that would be easier to group up once i knew how to get to label correctly.

Nest can’t resolve dependencies of the (?) Population

I m coded class scheduling with genetic algorithm (nest.js). My Program have geneticalgorithm.ts, data.ts ,population.ts, scheduleservice.ts schedulemodule.ts. population is called in the method I use in geneticalgorithmclass. as constructor. and I need to pass population.getSchedules().length as a number to the constructor. but I get this error. geneticalgorithm.ts population.ts and schedulemodule.ts are as follows.

error definition;

[Nest] 63732  - 11/11/2024, 6:51:23 PM     LOG [NestFactory] Starting Nest application...
[Nest] 63732  - 11/11/2024, 6:51:23 PM     LOG [InstanceLoader] AppModule dependencies initialized +54ms
[Nest] 63732  - 11/11/2024, 6:51:23 PM     LOG [Instance Loader] Type Orm Module dependencies initialized +0ms
[Nest] 63732  - 11/11/2024, 6:51:23 PM     LOG [Instance Loader] Number dependencies initialized +1ms

[Nest] 63732  - 11/11/2024, 6:51:23 PM   ERROR [Exception Handler] Nest can't resolve dependencies of the Population (?, Data). Please make sure that the argument Number at index [0] is available in the ScheduleModule context.

Potential solutions:
- Is ScheduleModule a valid NestJS module?
- If Number is a provider, is it part of the current ScheduleModule?
- If Number is exported from a separate @Module, is that module imported within ScheduleModule?
  @Module({
    imports: [ /* the Module containing Number */ ]
  })

    import { Injectable } from '@nestjs/common';
    import { Data } from './data';
    import { Population } from './population';
    import { Schedule } from './schedule';
    import { Driver } from './driver';
    
    @Injectable()
    export class GeneticAlgorithm {
      private data: Data;
    
      constructor(data: Data) {
        this.data = data;
      }
    
      public evolve(population: Population): Population {
        return this.mutatePopulation(this.crossoverPopulation(population));
      }
    
      private crossoverPopulation(population: Population): Population {
        const crossoverPopulation = new Population(population.getSchedules().length, this.data);
        for (let i = 0; i < Driver.NUMB_OF_ELITE_SCHEDULES; i++) {
          crossoverPopulation.getSchedules()[i] = population.getSchedules()[i];
        }
        for (let i = Driver.NUMB_OF_ELITE_SCHEDULES; i < population.getSchedules().length; i++) {
          if (Driver.CROSSOVER_RATE > Math.random()) {
            const schedule1 = this.selectTournamentPopulation(population).sortByFitness().getSchedules()[0];
            const schedule2 = this.selectTournamentPopulation(population).sortByFitness().getSchedules()[0];
            crossoverPopulation.getSchedules()[i] = this.crossoverSchedule(schedule1, schedule2);
          } else {
            crossoverPopulation.getSchedules()[i] = population.getSchedules()[i];
          }
        }
        return crossoverPopulation;
      }
    
      private crossoverSchedule(schedule1: Schedule, schedule2: Schedule): Schedule {
        const crossoverSchedule = new Schedule(this.data).initialize();
        for (let i = 0; i < crossoverSchedule.getClasses().length; i++) {
          if (Math.random() > 0.5) {
            crossoverSchedule.getClasses()[i] = schedule1.getClasses()[i];
          } else {
            crossoverSchedule.getClasses()[i] = schedule2.getClasses()[i];
          }
        }
        return crossoverSchedule;
      }
    
      private mutatePopulation(population: Population): Population {
        const mutatePopulation = new Population(population.getSchedules().length, this.data);
        const schedules = mutatePopulation.getSchedules();
        for (let i = 0; i < Driver.NUMB_OF_ELITE_SCHEDULES; i++) {
          schedules[i] = population.getSchedules()[i];
        }
        for (let i = Driver.NUMB_OF_ELITE_SCHEDULES; i < population.getSchedules().length; i++) {
          schedules[i] = this.mutateSchedule(population.getSchedules()[i]);
        }
        return mutatePopulation;
      }
    
      private mutateSchedule(schedule: Schedule): Schedule {
        const mutateSchedule = new Schedule(this.data).initialize();
        for (let i = 0; i < schedule.getClasses().length; i++) {
          if (Driver.MUTATION_RATE > Math.random()) {
            schedule.getClasses()[i] = mutateSchedule.getClasses()[i];
          }
        }
        return schedule;
      }
    
      private selectTournamentPopulation(population: Population): Population {
        const tournamentPopulation = new Population(Driver.TOURNAMENT_SELECTION_SIZE, this.data);
        for (let i = 0; i < Driver.TOURNAMENT_SELECTION_SIZE; i++) {
          tournamentPopulation.getSchedules()[i] = population.getSchedules()[Math.floor(Math.random() * population.getSchedules().length)];
        }
        return tournamentPopulation;
      }
    }


    import { Injectable } from '@nestjs/common';
    import { Data } from './data';
    import { Schedule } from './schedule';
    
    @Injectable()
    export class Population {
      private schedules: Schedule[];
    
      constructor(size: number, data: Data) {
        this.schedules = new Array<Schedule>(size);
        for (let i = 0; i < size; i++) {
          this.schedules[i] = new Schedule(data).initialize();
        }
      }
    
      public getSchedules(): Schedule[] {
        return this.schedules;
      }
    
      public sortByFitness(): Population {
        this.schedules.sort((schedule1, schedule2) => {
          let returnValue = 0;
          if (schedule1.getFitness() > schedule2.getFitness()) returnValue = -1;
          else if (schedule1.getFitness() < schedule2.getFitness()) returnValue = 1;
          return returnValue;
        });
        return this;
      }
    }


    import { Module } from '@nestjs/common';
    import { TypeOrmModule } from '@nestjs/typeorm';
    import { Schedule } from './schedule.entity';
    import { ScheduleService } from './schedule.service';
    import { ScheduleController } from './schedule.controller';
    import { ScheduleRepository } from './schedule.repository';
    import { Data } from './data';
    import { GeneticAlgorithm } from './genetic-algorithm';
    import { Population } from './population';
    import { Class } from './class.entity';
    import { CourseModule } from '../course/course.module';
    import { DepartmentModule } from '../department/department.module';
    import { InstructorModule } from '../instructor/instructor.module';
    import { MeetingTimeModule } from '../meeting-time/meeting-time.module';
    import { RoomModule } from '../room/room.module';
    
    @Module({
      imports: [
        TypeOrmModule.forFeature([Schedule, Class]),
        CourseModule,
        DepartmentModule,
        InstructorModule,
        MeetingTimeModule,
        RoomModule,
      ],
      providers: [ScheduleService, ScheduleRepository, Data, GeneticAlgorithm, Population],
        
    
      controllers: [ScheduleController],
    })
    export class ScheduleModule {}

TypeError: Cannot Read Properties of Undefined (Reading ‘equals’) in Luxon with MUI DatePicker

I’m encountering a TypeError when using luxon with the DatePicker component from MUI’s @mui/x-date-pickers. The error message is:

ERROR
Cannot read properties of undefined (reading 'equals')
TypeError: Cannot read properties of undefined (reading 'equals')
    at AdapterLuxon.setTimezone (http://localhost:3000/static/js/bundle.js:36563:23)
    at Object.setTimezone (http://localhost:3000/static/js/bundle.js:51270:73)
    at http://localhost:3000/static/js/bundle.js:50620:99
    at mountMemo (http://localhost:3000/static/js/bundle.js:85652:23)
    at Object.useMemo (http://localhost:3000/static/js/bundle.js:86037:20)
    at Object.useMemo (http://localhost:3000/static/js/bundle.js:106497:25)
    at useValueWithTimezone (http://localhost:3000/static/js/bundle.js:50620:72)
    at usePickerValue (http://localhost:3000/static/js/bundle.js:50146:85)
    at usePicker (http://localhost:3000/static/js/bundle.js:49845:97)
    at useDesktopPicker (http://localhost:3000/static/js/bundle.js:46865:69)

This error occurs in the following code when I try to use the DatePicker component:

import React, { useState, useEffect } from 'react';
import { Grid, TextField, Typography, FormControlLabel, Radio, RadioGroup, FormControl, FormLabel, Button, Autocomplete, Stack } from '@mui/material';
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon';
import { Settings, DateTime } from 'luxon';

// Set Luxon to use the UK locale globally
Settings.defaultLocale = 'en-GB';
Settings.defaultZone = 'utc';

function FlightDetails({ formik }) {
  // Code for handling form logic

  return (
    <LocalizationProvider dateAdapter={AdapterLuxon} adapterLocale="en-GB">
    <DatePicker
      label="Return Date"
      name="returnDate"
      value={
        formik.values.returnDate &&
        DateTime.fromISO(formik.values.returnDate).isValid
          ? DateTime.fromISO(formik.values.returnDate)
          : null
      }
      onChange={(newValue) => {
        formik.setFieldValue('returnDate', newValue ? newValue.toISO() : '');
      }}
      onBlur={() => formik.setFieldTouched('returnDate')}
      renderInput={(params) => (
        <TextField
          {...params}
          error={formik.touched.returnDate && Boolean(formik.errors.returnDate)}
          helperText={formik.touched.returnDate ? formik.errors.returnDate : null}
        />
      )}
      inputFormat="dd/MM/yyyy"
      fullWidth
    />
    </LocalizationProvider>
  );
}

export default FlightDetails;

Additional Information

Packages Used: @mui/material, @mui/x-date-pickers, luxon

Error Occurrence: The error occurs during rendering when the DatePicker component attempts to process date values.

What I’ve Tried:
Ensured AdapterLuxon and luxon are correctly installed and imported.
Wrapped DatePicker with LocalizationProvider.
Validated DateTime.fromISO() to ensure only valid dates are passed.

How can I resolve this TypeError related to equals when using luxon with MUI’s DatePicker? Are there any issues with how DateTime objects are being handled, or is there a specific way to integrate luxon and MUI’s DatePicker?

Any guidance on fixing this error or improving my implementation would be greatly appreciated!

Chocolatey – Access denied error for Nodejs installation

I am unable to download nodejs using the VS Code.

When I run this command to install nodejs on Virtual Studio, I get the error below:
choco install nodejs-lts --version="22.11.0"

``Chocolatey v2.3.0
Chocolatey detected you are not running from an elevated command shell
 (cmd/powershell).

 You may experience errors - many functions/packages
 require admin rights. Only advanced users should run choco w/out an
 elevated shell. When you open the command shell, you should ensure
 that you do so with "Run as Administrator" selected. If you are
 attempting to use Chocolatey in a non-administrator setting, you
 must select a different location other than the default install
 location. See
 https://docs.chocolatey.org/en-us/choco/setup#non-administrative-install
 for details.


 Do you want to continue?([Y]es/[N]o): y

Installing the following packages:
nodejs-lts
By installing, you accept licenses for the packages.
Downloading package from source 'https://community.chocolatey.org/api/v2/'
Progress: Downloading nodejs-lts 22.11.0... 100%
nodejs-lts not installed. An error occurred during installation:
 Unable to obtain lock file access on 'C:ProgramDatachocolateylib4989c1eb4c31e4327959b23b04fb3c13f8dce4cf' for operations on 'C:ProgramDatachocolateylibnodejs-lts'. 
This may mean that a different user or administrator is holding this lock and that this process does not have permission to access it. If no other process is currently performing an operation on this file it may mean that an earlier NuGet process crashed and left an inaccessible lock file, in this case removing the file 'C:ProgramDatachocolateylib4989c1eb4c31e4327959b23b04fb3c13f8dce4cf' will allow NuGet to continue.
nodejs-lts package files install failed with exit code 1. Performing other installation steps.
The install of nodejs-lts was NOT successful.
nodejs-lts not installed. An error occurred during installation:
 Unable to obtain lock file access on 'C:ProgramDatachocolateylib4989c1eb4c31e4327959b23b04fb3c13f8dce4cf' for operations on 'C:ProgramDatachocolateylibnodejs-lts'. 
This may mean that a different user or administrator is holding this lock and that this process does not have permission to access it. If no other process is currently performing an operation on this file it may mean that an earlier NuGet process crashed and left an inaccessible lock file, in this case removing the file 'C:ProgramDatachocolateylib4989c1eb4c31e4327959b23b04fb3c13f8dce4cf' will allow NuGet to continue.
This is try 1/3. Retrying after 300 milliseconds.
 Error converted to warning:
 Access to the path 'C:ProgramDatachocolateylib-bad' is denied.
This is try 2/3. Retrying after 400 milliseconds.
 Error converted to warning:
 Access to the path 'C:ProgramDatachocolateylib-bad' is denied.
Maximum tries of 3 reached. Throwing error.
Cannot create directory "C:ProgramDatachocolateylib-bad". Error was:
System.UnauthorizedAccessException: Access to the path 'C:ProgramDatachocolateylib-bad' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
   at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
   at chocolatey.infrastructure.filesystem.DotNetFileSystem.<>c__DisplayClass63_0.<CreateDirectory>b__1()
   at chocolatey.infrastructure.tolerance.FaultTolerance.<>c__DisplayClass1_0.<Retry>b__0()
   at chocolatey.infrastructure.tolerance.FaultTolerance.Retry[T](Int32 numberOfTries, Func`1 function, Int32 waitDurationMilliseconds, Int32 increaseRetryByMilliseconds, Boolean isSilent)
   at chocolatey.infrastructure.tolerance.FaultTolerance.Retry(Int32 numberOfTries, Action action, Int32 waitDurationMilliseconds, Int32 increaseRetryByMilliseconds, Boolean isSilent)
   at chocolatey.infrastructure.filesystem.DotNetFileSystem.CreateDirectory(String directoryPath, Boolean isSilent)
   at chocolatey.infrastructure.filesystem.DotNetFileSystem.EnsureDirectoryExists(String directoryPath, Boolean ignoreError, Boolean isSilent)

Chocolatey installed 0/0 packages.
 See the log for details (C:ProgramDatachocolateylogschocolatey.log).
Access to the path 'C:ProgramDatachocolateylib-bad' is denied.``

I tried cmd in regular mode and it won’t work. npm command is still not recognized. I have the chocolatey installed.

Notification: requestPermission() blocked by default

I’m attempting to allow user to be notified via a Notification(), but I see the default is ‘disabled’, so even if you issue a Notification.requestPermission() it’s immediately denied.

The mozilla.org Site (https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission_static) even says currently that you can test it with https://mdn.github.io/dom-examples/to-do-notifications/

But there, it also doesn’t work. If you manually set your Site Settings, its either Default (disabled) or Enabled. There is no ask. (Well, not in Chrome)

Is this feature being phased out? How to request Notification from users?

My project (speech to text visualizer) works on laptops but when i try to record audio on phone the visualizer works but transcript doesnt show [closed]

Here is my github.

The link to the deployment page of this project in on the right side of the github.

My theory is the audio is getting recorded and transcriptions are showing but its getting hidden behind the “your transcription will appear here” box which due to formatting issues isnt showing on phones?

Can you please help me? I dont know how to make it work on phones.

I used nextjs, tailwind, lucidereact, groqsdk using whisper AI for this.

PixiJS – can’t render an SVG with a hole inside a path (location icon)

I’m stuck on a very trivial task – trying to render an SVG icon for a location with PixiJS. This is the SVG string that I’m using:

<svg width="28" height="40" viewBox="0 0 28 40" xmlns="http://www.w3.org/2000/svg">
// <path fill-rule="evenodd" d="M14 0C6.26 0 0 6.26 0 14C0 24.5 14 40 14 40C14 40 28 24.5 28 14C28 6.26 21.74 0 14 0ZM14 19C11.24 19 9 16.76 9 14C9 11.24 11.24 9 14 9C16.76 9 19 11.24 19 14C19 16.76 16.76 19 14 19Z" />
// </svg>

It renders correctly in Figma, I tried with many different icons, but the issue with PixiJS is the same:

enter image description here

The hole in middle doesn’t render as a cutout. I tried adding fill-rule="evenodd", tried with nonzero too – no luck. In any case it should work without modifying the SVG file. Here is how I’m drawing it:

o.graphic = new Graphics()
this.#artboard.addChild(o.graphic)
o.graphic.svg(pinSVG)
o.graphic.stroke({ color: 'black', width: 2 })
o.graphic.fill('red')

I also tried loading it as a Texture and the hole renders fine, but then I can’t modify the stroke, etc.

Modal Form Submission – POST request empty

I’m hopelessly stuck here..
I have two modal popups, one for login and one for registering. The login form works fine but the register form isn’t registering POST parameters. They all are empty. Here’s the HTML.

<!-- login form  -->
<div class="cre_popup_box mfp-with-anim mfp-hide" id="login-modal">
    <h2 class="title text-center mb-2 mb-lg-4">Welcome Back!</h2>
    <!-- <h6>Please log in below</h6> -->
    <form id="loginForm">
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="user">Username</label>
                    <input type="text" id="user" name="username" class="form-control" placeholder="Enter your username">
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="password">Password</label>
                    <input type="password" id="password" name="password" class="form-control" placeholder="*********">
                </div>
            </div>
            <div class="col-sm-12">
                <div class="form-group">
                    <button type="submit" class="cu_btn base_btn">Log in</button>
                </div>
            </div>
            <div class="text-center">
                <a href="#" class="switcher_text">Forgot Password?</a>
            </div>
        </div>
    </form>
    <div class="cre_login_footer text-center mt-2 mt-lg-4 ">
        <!--<h5 class="cre_style_line">Continue with</h5>
         <div class="cre_login_social mt-2 mt-lg-4 d-flex justify-content-between">
            <a href="#" class="cre_login_btn" title="google"><img src="assets/img/google.svg" alt="">Google</a>
            <a href="#" class="cre_login_btn" title="apple"><img src="assets/img/apple.svg" alt="">Apple</a>
        </div> -->
        <p>Don't have an account? <a class="register_button" data-effect="mfp-zoom-in"
                href="#register-modal">Register</a></p>
    </div>
</div>
<!-- register form  -->
<div class="cre_popup_box mfp-with-anim mfp-hide" id="register-modal">
    <h2 class="title text-center mb-2 mb-lg-4">Register with Us</h2>
    <form id="registerForm"`>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="first_name">First Name</label>
                    <input type="text" id="first_name" class="form-control" placeholder="Enter your first name">
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="last_name">Last Name</label>
                    <input type="text" id="last_name" class="form-control" placeholder="Enter your last name">
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="username">Username</label>
                    <input type="text" id="username" class="form-control" placeholder="Enter your username">
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="email">Email Address</label>
                    <input type="email" id="email" class="form-control" placeholder="Enter your email address">
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="rpassword">Password</label>
                    <input type="password" id="rpassword" class="form-control" placeholder="Enter your password">
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="cpassword">Confirm Password</label>
                    <input type="password" id="cpassword" class="form-control" placeholder="Confirm your password">
                </div>
            </div>
            
            <div class="col-sm-12">
                <div class="form-group">
                    <button type="submit" class="cu_btn base_btn">Register Now</button>
                </div>
            </div>
        </div>
    </form>
</div>

And here’s the javascript.

  $(document).ready(function() {
  $('#loginForm').modal({
    keyboard: false
  });

  $('#loginForm').submit(function(e) {
    e.preventDefault();

    var $form = $(this);
    var $error = $form.find('.error');
    var data = $form.serialize();

    $.ajax({
      url: 'include/login.php',
      type: 'POST',
      data: data,
      dataType: 'json',
      success: function(resp) {
        if (resp.success) {
          //$('.mfp-close').click();
          //window.location.href = "https://www.google.com";
          location.reload();
          //$('#loginForm').modal('hide');
        } else {
          //$error.text(resp.error).removeClass('d-none');
          $("#errors").text("resp.error");
        }
      },
      error: function(xhr, status, error) {
        console.error(xhr);
      }
    });
  });
  
  $('#registerForm').modal({
    keyboard: false
  });

  $('#registerForm').submit(function(e) {
    e.preventDefault();

    var $form = $(this);
    var $error = $form.find('.error');
    var data = $form.serialize();

    $.ajax({
      url: 'include/register.php',
      type: 'POST',
      data: data,
      dataType: 'json',
      success: function(resp) {
        if (resp.success) {
          //$('.mfp-close').click();
          //window.location.href = "https://www.google.com";
          location.reload();
          //$('#loginForm').modal('hide');
        } else {
          //$error.text(resp.error).removeClass('d-none');
          $("#errors").text("resp.error");
          console.error("resp.error");
        }
      },
      error: function(xhr, status, error) {
        console.error(xhr);
      }
    });
  });
});

Not sure what I’m missing. I’ve tried everything I can think of but no matter what I do, the POST request is empty based on the var_dump I’m doing in the PHP. Please help.

user registration plugin Uncaught SyntaxError: Unexpected token ‘o’, …” [closed]

I have a problem in my wordpress theme that causes the user registration plugin to not work and give an error when submit it and doesn’t create user.

It works on wordpress seventeen theme and the problem is related to my theme.

this is the console log in below:

Uncaught SyntaxError: Unexpected token 'o', ..."




object(WP_"... is not valid JSON
    at JSON.parse (<anonymous>)
    at Object.complete (user-registration.min.js?ver=3.3.4.1:1:17060)
    at c (jquery.min.js?ver=3.7.1:2:25304)
    at Object.fireWith (jquery.min.js?ver=3.7.1:2:26053)
    at l (jquery.min.js?ver=3.7.1:2:77910)
    at XMLHttpRequest.<anonymous> (jquery.min.js?ver=3.7.1:2:80265)

What I did but did not work:
I disabled all the plugins and the problem was not solved.
In the footer, I deleted all the symbols.
I deleted all the styles in the header.
I deleted all the elements on the page.php once and tried it.

this is the response of network XHR below:

object(WP_User)#5105 (8) {
  ["data"]=>
  object(stdClass)#5122 (10) {
    ["ID"]=>
    string(2) "83"
    ["user_login"]=>
    string(7) "bkb.kbj"
    ["user_pass"]=>
    string(34) "$P$BMLXX3lAsV92ELDzi8d/MZghcIHx0n."
    ["user_nicename"]=>
    string(7) "bkb-kbj"
    ["user_email"]=>
    string(17) "[email protected]"
    ["user_url"]=>
    string(0) ""
    ["user_registered"]=>
    string(19) "2024-11-11 19:06:59"
    ["user_activation_key"]=>
    string(0) ""
    ["user_status"]=>
    string(1) "0"
    ["display_name"]=>
    string(7) "bkb.kbj"
  }
  ["ID"]=>
  int(83)
  ["caps"]=>
  array(1) {
    ["subscriber"]=>
    bool(true)
  }
  ["cap_key"]=>
  string(16) "app_capabilities"
  ["roles"]=>
  array(1) {
    [0]=>
    string(10) "subscriber"
  }
  ["allcaps"]=>
  array(3) {
    ["read"]=>
    bool(true)
    ["level_0"]=>
    bool(true)
    ["subscriber"]=>
    bool(true)
  }
  ["filter"]=>
  NULL
  ["site_id":"WP_User":private]=>
  int(1)
}
{"success":true,"data":{"username":"bkb.kbj","success_message_positon":"1","form_login_option":"default","redirect_timeout":2000}}

this is functions.php :

<?php

define('DOIT_URL', get_template_directory_uri() . '/');
define('DOIT_PATH', get_template_directory() . DIRECTORY_SEPARATOR);
define('DOIT_APP', DOIT_PATH . 'app' . DIRECTORY_SEPARATOR);
define('DOIT_ASSET_URL', DOIT_URL . 'assets');


add_action('after_setup_theme', 'DOIT_setup');


function DOIT_setup()
{ 

    add_theme_support('title-tag');
    add_image_size('blog_index_thumbnail', 730, 430);
    add_theme_support('post-thumbnails');
    add_theme_support('woocommerce');
    add_theme_support('elementor');
    add_theme_support('user-registration');
    

    //register sidebars
    register_sidebar(array(
        'name'          => 'Blog Sidebar',
        'id'            => 'doit-blog-sidebar',
        'description'   => __('a sidebar for theme blog page'),
        'before_widget' => '',
        'after_widget'  => '',
        'before_title'  => '',
        'after_title'   => '',
        ));
    
    register_nav_menu('top', 'Top Menu');
        
}

function calb_comment($comment, $args, $depth)
{
    ?>
                                    <li class="comment">
                                    <article class="comment-body">
                                        <footer class="comment-meta">
                                            <div class="comment-author ">
                                                <?php echo get_avatar($comment, '128'); ?>
                                                <?php printf( __( '<b class="fn">%s</b> <span class="says">says:</span>' ), get_comment_author_link() ); ?>
                                            </div><!-- .comment-author -->

                                            <div class="comment-metadata">
                                                <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ); ?>">
                                                <?php
                                                /* translators: 1: date, 2: time */
                                                printf( 
                                                    __('%1$s at %2$s'), 
                                                    get_comment_date('l,Y,m'),  
                                                    get_comment_time() 
                                                ); ?>
                                                </a>
                                            </div><!-- .comment-metadata -->

                                        </footer><!-- .comment-meta -->


                                        <div class="comment-content">
                                        <?php comment_text(); ?>
                                        </div><!-- .comment-content -->

                                        <div class="reply">
                                            <?php 
                                            comment_reply_link( 
                                                array_merge( 
                                                    $args, 
                                                        array( 
                                                            'add_below' => 'comment',
                                                            'depth'      => $depth,
                                                            'max_depth' => $args['max_depth']
                                                        ) 
                                                )
                                            ); ?>
                                        </div>
                                    </article><!-- .comment-body -->
                                </li><!-- #comment-## -->
    <?php
}



add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );

function new_loop_shop_per_page( $cols ) {
  // $cols contains the current number of products per page based on the value stored on Options -> Reading
  // Return the number of products you wanna show per page.
  $cols = 8;
  return $cols;
}












// Add support for category thumbnails
if ( ! function_exists('category_thumbnail_setup') ) {
    function category_thumbnail_setup() {
        // Adds the category thumbnail field in the category edit screen
        if ( ! taxonomy_exists('category') ) return;
        add_action('category_add_form_fields', 'add_category_thumbnail', 10, 2);
        add_action('category_edit_form_fields', 'edit_category_thumbnail', 10, 2);
        add_action('edited_category', 'save_category_thumbnail', 10, 2);
        add_action('created_category', 'save_category_thumbnail', 10, 2);
    }

    function add_category_thumbnail($taxonomy) { ?>
        <div class="form-field">
            <label for="category_thumbnail"><?php _e('Category Image', 'text-domain'); ?></label>
            <input type="text" name="category_thumbnail" id="category_thumbnail" value="" />
            <p class="description"><?php _e('Enter the URL of the category image.', 'text-domain'); ?></p>
            <button class="button upload_image_button"><?php _e('Upload Image', 'text-domain'); ?></button>
        </div>
    <?php }

    function edit_category_thumbnail($category) {
        $thumbnail_id = get_term_meta($category->term_id, 'category_thumbnail', true); ?>
        <tr class="form-field">
            <th scope="row" valign="top"><label for="category_thumbnail"><?php _e('Category Image', 'text-domain'); ?></label></th>
            <td>
                <input type="text" name="category_thumbnail" id="category_thumbnail" value="<?php echo esc_attr($thumbnail_id); ?>" />
                <p class="description"><?php _e('Enter the URL of the category image.', 'text-domain'); ?></p>
                <button class="button upload_image_button"><?php _e('Upload Image', 'text-domain'); ?></button>
            </td>
        </tr>
    <?php }

    function save_category_thumbnail($term_id) {
        if (isset($_POST['category_thumbnail'])) {
            update_term_meta($term_id, 'category_thumbnail', sanitize_text_field($_POST['category_thumbnail']));
        }
    }

    add_action('init', 'category_thumbnail_setup');
}
function enqueue_category_upload_scripts() {
    wp_enqueue_media();
    wp_enqueue_script('category-upload-script', get_template_directory_uri() . '/js/category-upload.js', array('jquery'), '', true);
}
add_action('admin_enqueue_scripts', 'enqueue_category_upload_scripts');
































if(is_admin()) {

    include DOIT_APP . 'admin/admin.php';
    include DOIT_PATH . 'options-panel/index.php';
}
include DOIT_PATH . 'options-panel/functions.php';
include DOIT_PATH . 'options-panel/frontend.php';
include DOIT_APP . 'user/user.php';
include DOIT_PATH . 'wc-customize.php';