how to append zmmtg-root inside meetingSDKElement DOM

I am implementing zoom meeting inside my website. I am using zoom meeting SDK. Everything works well but DOM is appending just above the closing </html> tag. HOwever, In my view, I have defined DOM as per zoom instruction.

I am using Codeigniter, jQuery. Below is my code

//This is view

<div id="meetingSDKElement"></div>

//This is footer
<script src="https://source.zoom.us/2.18.2/lib/vendor/react.min.js"></script>
<script src="https://source.zoom.us/2.18.2/lib/vendor/react-dom.min.js"></script>
<script src="https://source.zoom.us/2.18.2/lib/vendor/redux.min.js"></script>
<script src="https://source.zoom.us/2.18.2/lib/vendor/redux-thunk.min.js"></script>
<script src="https://source.zoom.us/2.18.2/lib/vendor/lodash.min.js"></script>
<script src="https://source.zoom.us/zoom-meeting-2.18.2.min.js"></script>
<script type="text/javascript" src="<?php echo base_url('assets/js/client-view.js'); ?>?v=<?php echo VERSION; ?>"></script>

//This is Javascript
$(document).ready(function(){
   getSignature();
});
function getSignature() {
  fetch(authEndpoint, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      meetingNumber: meetingNumber,
      role: role,
      password:passWord
    })
  }).then((response) => {
    return response.json()
  }).then((data) => {
    console.log(data)
    startMeeting(data.signature)
  }).catch((error) => {
    console.log(error)
  })
}

function startMeeting(signature) {
$(".meeting-loader").css("visibility", "hidden");
  document.getElementById('zmmtg-root').style.display = 'block'

  ZoomMtg.init({
    leaveUrl: leaveUrl,
    success: (success) => {
      console.log(success)
      ZoomMtg.join({
        signature: signature,
        sdkKey: sdkKey,
        meetingNumber: meetingNumber,
        passWord: passWord,
        userName: userName,
        userEmail: userEmail,
        tk: registrantToken,
        zak: zakToken,
        success: (success) => {
          console.log(success)
        },
        error: (error) => {
          console.log(error)
        },
      })
    },
    error: (error) => {
      console.log(error)
    }
  })
}

I want zmmtg-root to be appended inside meetingSDKElement.

Start script missing eror when running npm start

I’m receiving this error when trying to debug my node application using the npm start command.

Error:

npm ERR! Missing script: "start"
npm ERR! 
npm ERR! Did you mean one of these?
npm ERR!     npm star # Mark your favorite packages
npm ERR!     npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in: C:UsersEzioriaAppDataLocalnpm-cache_logs2023-12-26T12_43_00_567Z-debug-0.log

I’m really stuck here, help me. I have installed package.json too

hiding submit button using jquery function not working?

I have created a django crispy form. I want to hide the submit button until every field has been entered i found some solution using jQuery but it is not showing the submit button after entering every field, i need your help to proceed further.

I have added two images,
before hiding submit button and trying jquery,
form without hiding the submit button

after trying jquery the submit button is not visible even after entering every field.
and another screenshot after trying.

below are my codes for respective files,

forms.py

class AppForm(forms.ModelForm):
    
        class Meta:
            model = App
            fields = ('__all__')

        def __init__(self, *args, **kwargs):
            super(AppForm, self).__init__(*args, **kwargs)
            self.helper = FormHelper()
            self.helper.form_show_labels = False

            defualt_image_path = '/media/photo.png'
            self.fields['appicon'].widget.attrs['placeholder'] = defualt_image_path
            self.fields['appicon'].widget.attrs['classs']= 'appicon-field'
            self.fields['appname'].widget.attrs.update({'placeholder': 'Apps Name', 'class':'appname-field'})
            self.fields['link'].widget.attrs.update({'placeholder':'App Link','class':'link-field'})
            self.fields['category'].widget.attrs.update({'placeholder':'App Category', 'class': 'catg-field'})
            self.fields['subcategory'].widget.attrs.update({'placeholder':'Sub Category', 'class': 'subcatg-field'})
            self.fields['points'].widget.attrs.update({'placeholder':'ADD POINTS', 'class': 'points-field'})

html file, (submit button)

<div class="submit-div">
     <button type="submit" class="submitform-button" id="submitform-button">Submit</button> 
</div>

html file, script part

$(document).ready(function() {
    // Function to check if all fields are filled
        function checkFields() {
            var imageInput = $('.appicon-field')[0].files.length > 0;
            var charInput1 = $('.appname-field').val().trim() !== '';
            var charInput2 = $('.link-field').val().trim() !== '';
            var charInput3 = $('.catg-field').val().trim() !== '';
            var charInput4 = $('.subcatg-field').val().trim() !== '';
            var charInput5 = $('.points-field').val().trim() !== '';

            // Show/hide submit button based on input status
            document.querySelector('.submitform-button').style.display = imageInput && charInput1 && charInput2 && charInput3 && charInput4 && charInput5 ? 'inline-block' : 'none';
        }

        // Trigger checkFields on input change
        $('.appicon-field, .appname-field, .link field, .catg-field, .subcatg-field, .points-field').on('change', function() {
            checkFields();
        });

        // Initial check on page load
        checkFields();
    });

style.css, (submit button css)

.submitform-button{
    display: none;
    padding: 10px 75px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    text-decoration: none;

    background-color: #f3c19d;
    color: #293845;
    border: 2px solid #ec975b;
}

base.html,(cdn link)

<head>
 ...
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
</head>

please comment if you need anything else from my side.

Prevent multiple files downloading after click on button

I am doing a download functionality by jquery and laravel.

I have an anchor tag in the loop.

    <a href="#" name="cite" class="popover-trigger" data-placement="top" download data-target="#downloadModal" data-video-id="{{ Crypt::encrypt($video_list->id) }}">Cite</a>

This anchor tag is in loop and there are multiple anchor tag based on the loop.

below is the modal.


    <div class="modal fade" id="downloadModal" tabindex="-1" role="dialog" aria-labelledby="downloadModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="downloadModalLabel">Download Confirmation</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                Are you sure you want to download the BibTeX file?
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
                <button type="button" class="btn btn-primary" id="confirmDownload">Confirm Download</button>
            </div>
        </div>
    </div>
    </div>

By clicking on the anchor tag, related modal will be open and if I click on the button the only single file should be downloaded.

js is:

    <script>
    $(document).ready(function() {
    var downloadInProgress = false;
    var currentVideoId = null;

    // Handle popover click to show modal
    $('.popover-trigger').on('click', function(e) {
        e.preventDefault();
        var videoId = $(this).data('video-id');
        currentVideoId = videoId;
        $('#downloadModal').modal('show');
    });

    // Handle confirm download button click
    $('#confirmDownload').on('click', function() {
        // Check if a download is already in progress
        if (downloadInProgress || currentVideoId === null) {
            return;
        }

        // Set the download flag to true
        downloadInProgress = true;

        // Disable the Confirm Download button to prevent multiple clicks
        $(this).prop('disabled', true);

        // Make an AJAX request to your Laravel route
        var videoId = currentVideoId;
        var url = "{{ route('export.bibtex', ':videoId') }}";
        url = url.replace(':videoId', videoId);
        $.ajax({
            url: url,
            method: 'GET',
            success: function(response) {
                var filename = response.filename;
                var content = response.content;

                // Create a Blob with the response content
                var blob = new Blob([content], { type: 'text/plain' });

                // Create a link element and trigger a download
                var link = document.createElement('a');
                link.href = window.URL.createObjectURL(blob);
                link.download = filename + '.bib';
                document.body.appendChild(link);
                link.click();
                document.body.removeChild(link);
            },
            error: function(error) {
                console.error('Error downloading BibTeX:', error);
            },
            complete: function() {
                // Re-enable the Confirm Download button after the request is complete
                $('#confirmDownload').prop('disabled', false);

                // Set the download flag to false
                downloadInProgress = false;

                // Reset the currentVideoId variable
                currentVideoId = null;

                // Close the modal after download
                $('#downloadModal').modal('hide');
            }
        });
    });

    // Handle modal close event to reset the download flag
    $('#downloadModal').on('hidden.bs.modal', function() {
        downloadInProgress = false;
    });
    });
    </script>

My controller is:


public function export_bibtex($video_id)
{
    $video_id = Crypt::decrypt($video_id);
    $corr_authors = DB::table('coauthors')
                        ->where('videoupload_id',$video_id)
                        ->where('authortype_id','3') // 3 for corresponding author
                        ->get();
    
    foreach($corr_authors as $corr_authors_value)
    {
        $name = '';
        $surname = '';
        if(!empty($corr_authors_value->name))
        {
            $name = $corr_authors_value->name;
        }
        if(!empty($corr_authors_value->surname))
        {
            $surname = ' '.$corr_authors_value->surname;
        }
        $corr_author_array[] = $name.$surname;
        $corresponding_author_data = implode(", ",$corr_author_array);  
    }
            
    $video_details = single_video_details($video_id);
    $rvoi_link = generate_rvoi_link($video_details->short_name,$video_details->historycurrentstatus_created_at,$video_details->unique_number);
    $entries = [
        [
            'video_unique_id' => $video_details->unique_number,
            'author' => $corresponding_author_data,
            'title' => $video_details->video_title,
            'journal' => 'ResearchVideos',
            'year' => Carbon::parse($video_details->historycurrentstatus_created_at)->year,
            'month' => Carbon::parse($video_details->historycurrentstatus_created_at)->format('F'),
            'doi' => $rvoi_link
        ],
    ];
    $bibtex = $this->convertToBibTeX($entries);
    $filename = 'RV'.$video_details->unique_number;
    $response = Response::make($bibtex);
    $response = ['filename'=>$filename, 'content'=>$response->getContent()];

    return response()->json($response);
}

After clicking on the modal button it downloads multiple same files. And in the inspector I checked multiple same ajax is calling at the same time.

article slider does not work twice on the same page

I have in my website a slider with articles. He has 9 cells.
But I need 9 more cells, and I want them below the first slide. But when I duplicate on index the second slider doesn’t work.

  <section class="slider">
    <div class="card">
        <div class="card-content slider-content">
            <img src="images/FotosDestaque/IMG1.png" alt="" class="card-img">
            <h1 class="card-title">Caixa Cartão Bolo Rei 28x28x7,5</h1>
            <div class="card-body">
                <p class="card-price">0,53€* / caixa</p>
            </div>
            <div class="card-footer slider-footer">
                <button onclick="window.location.href='catalogo.php'" class="btn btn-success button-slider">Comprar</button>
            </div>
        </div>
    </div>
    <div class="card">
        <div class="card-content">
            <img src="images/FotosDestaque/IMG2.png" alt="" class="card-img">
            <h1 class="card-title">Guardanapo Natal PPP 40x40 Nova Era 24 maços </h1>
            <div class="card-body">
                <p class="card-price">19,93€* / caixa</p>
            </div>
            <div class="card-footer slider-footer">
              <button onclick="window.location.href='catalogo.php'" class="btn btn-success button-slider">Comprar</button>
            </div>
        </div>
    </div>
    <div class="card">
        <div class="card-content">
            <img src="images/FotosDestaque/IMG3.png" alt="" class="card-img">
            <h1 class="card-title">Saco plástico alça Natal medida 50x55</h1>
            <div class="card-body">
                <p class="card-price">2,50€* / Kg</p>
            </div>
            <div class="card-footer slider-footer">
              <button onclick="window.location.href='catalogo.php'" class="btn btn-success button-slider">Comprar</button>
            </div>
        </div>
    </div>
    <div class="card">
        <div class="card-content">
            <img src="images/FotosDestaque/IMG4.png" alt="" class="card-img">
            <h1 class="card-title">Saqueta Bolo Rei 26+8x42 c/ 500 sacos</h1>
            <div class="card-body">
                <p class="card-price">0,11€* / Saco</p>
            </div>
            <div class="card-footer slider-footer">
              <button onclick="window.location.href='catalogo.php'" class="btn btn-success button-slider">Comprar</button>
            </div>
        </div>
    </div>
    <div class="card">
        <div class="card-content">
            <img src="images/FotosDestaque/IMG5.png" alt="" class="card-img">
            <h1 class="card-title">Lava Loiça Profissional Fairy 5 Lts Ultra</h1>
            <div class="card-body">
                <p class="card-price">8,99€* / uni</p>
            </div>
            <div class="card-footer slider-footer">
              <button onclick="window.location.href='catalogo.php'" class="btn btn-success button-slider">Comprar</button>
            </div>
        </div>
    </div>
    <div class="card">
        <div class="card-content">
            <img src="images/FotosDestaque/IMG6.png" alt="" class="card-img">
            <h1 class="card-title">Esfregão Saponificado Favir c/6 Unds</h1>
            <div class="card-body">
                <p class="card-price">0,49€* / uni</p>
            </div>
            <div class="card-footer slider-footer">
              <button onclick="window.location.href='catalogo.php'" class="btn btn-success button-slider">Comprar</button>
            </div>
        </div>
    </div>
    <div class="card">
        <div class="card-content">
            <img src="images/FotosDestaque/IMG8.png" alt="" class="card-img">
            <h1 class="card-title">Bloco Sanitário Senses 60 Grs</h1>
            <div class="card-body">
                <p class="card-price">0,48€* / uni</p>
            </div>
            <div class="card-footer slider-footer">
              <button onclick="window.location.href='catalogo.php'" class="btn btn-success button-slider">Comprar</button>
            </div>
        </div>
    </div>
    <div class="card">
        <div class="card-content">
            <img src="images/FotosDestaque/IMG7.png" alt="" class="card-img">
            <h1 class="card-title">Toalha de mão 21x22 Amoos c/2800 fls</h1>
            <div class="card-body">
                <p class="card-price">10,46€* / caixa</p>
            </div>
            <div class="card-footer slider-footer">
              <button onclick="window.location.href='catalogo.php'" class="btn btn-success button-slider">Comprar</button>
            </div>
        </div>
    </div>
    <div class="card">
      <div class="card-content">
          <img src="images/FotosDestaque/IMG9.png" alt="" class="card-img">
          <h1 class="card-title">Tira Nódoas Fun Clorossan Roupa Branca/cor 800grs</h1>
          <div class="card-body">
              <p class="card-price">10,46€* / caixa</p>
          </div>
          <div class="card-footer slider-footer">
            <button onclick="window.location.href='catalogo.php'" class="btn btn-success button-slider">Comprar</button>
          </div>
      </div>
  </div>
    

    <span class="arrow left">&#129120;</span>
    <span class="arrow right">&#129122;</span>
  </section>

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

This is the index, and when I do copy paste this section the second slider doesn’t work.

:root {
  --primary: #ffffff;
  /* --primary: #fff; */
  --secondary: #13533A;
  --bg: #0e1523;
  /* --bg: #f5f5f5; */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body{
  /*background-color: var(--bg);*/
  overflow-x: hidden;
}

.slider {
  /*background-color: var(--bg);*/
  padding: 1rem;
  height: 100%;
  margin: 7rem auto;
  display: flex;
  /*display: grid;
  grid-template-columns: repeat(4, 1fr);
  place-items: center;
  grid-gap: 2rem;*/

 /* font: normal 1rem sans-serif;*/
}

.card {
  position: relative;
  left: 0;

  min-width: 17rem;
  height: 23rem;
  background-color:var(--primary);
  color: #fff;
  border-radius: 1rem;
  border: .1rem solid transparent;
  overflow: hidden;
  box-shadow: 0 .2rem .6rem #0003;
  transition: .5s ease-in-out;
}

@media screen and (max-width: 768px) {
  .card {
      min-width: 21rem;
  }
}

.card:not(:first-child){
  margin-left: 2rem;
  border: .1rem solid var(--secondary);
}

.card:first-child{
  margin-left: .4rem;
  border: .1rem solid var(--secondary);
}

.card:hover {
  border: .2rem solid var(--secondary);
  transform: scale(1.05);
}

.card .card-top-img{
  margin-top: 2rem;
}

.card::before, .card::after {
  position: absolute;
 /* content: "";
  background-color: var(--secondary);
  border-radius: 50%;
  transition: .5s ease-in-out;*/
  z-index: 100;
}

.card::before {
  top: -6%;
  right: -6%;
  width: 9rem;
  height: 9rem;
}

.card::after {
  bottom: -6%;
  left: -6%;
  width: 5rem;
  height: 5rem;
}

.card:hover::before {
  transform: scale(1.8);
}

.card:hover::after {
  transform: scale(0);
}

.card-content {
  position: absolute;
  top:0;
  left:0;
  width: 100%;
  height: 100%;

  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  z-index: 200;
}

.card-content img {
  margin-top: 2rem;
}

.card-img, 
.card-title {
  transform: translateY(4rem);
  transition: .5s ease-in-out;
  color: #13533A;
  font-size: 18px;
  text-align: center;
}

.card-img {
  width: auto;
  height: 9.5rem;
}

.card-title {
  text-transform: capitalize;
  transition-delay: .1s;
  color: #13533A;
    font-size: 18px;
}

.card-body, 
.card-footer {
  transform: translateY(10rem);
  padding: 0;
  transition: .5s ease-in-out;
}

.card-body {
  width: 100%;

  display: flex;
  justify-content: space-around;
  align-items: center;

  transition-delay: .2s;
}

.card:hover .card-img,
.card:hover .card-title,
.card:hover .card-body,
.card:hover .card-footer {
  transform: translateY(0);
}

.card-footer {
  transition-delay: .3s;
}

.button-slider {
  width: max-content;
  padding: 1rem 1rem;
  text-wrap: nowrap;
  font-size: 0.8rem;
}

.slider-footer {
  width: 100%;
  display: flex;
  justify-content: space-around;
}

.card-body p {
  margin-bottom: 0;
  color: #111;
}




.card-price {
  font: bolder 1.5rem sans-serif;
}

.btn {
  padding: 1rem 2rem;
  background-color: unset;
  border: none;
  outline: none;
  border-radius: 2rem;
  color: #fff;
  cursor: pointer;
}

.btn-success {
  background-color: var(--secondary);
}

.btn-border {
  border: .1rem solid var(--secondary);
}

.arrow{
  position: absolute;
  /* top: 50%; */
  align-self: center;
  /* transform: translateY(-50%); */

  width: 3rem;
  height: 3rem;
  background-color: #fff;
  color: #000;

  border-radius: 50%;
  font: 800 1.5rem sans-serif;
  text-align: center;
  line-height: 3rem;
  user-select: none;
  
  cursor: pointer;
  z-index: 300;
}

.arrow:active {
  background-color: #ddd;
}

.left{
  left: 1rem;
}

.right{
  right: 1rem;
}
const cards = document.querySelectorAll('.card');
const right_arrow = document.querySelector('.arrow.right');
const left_arrow = document.querySelector('.arrow.left');

let left = 0;
let card_size = 25.4;
let total_card_size = cards.length * card_size - card_size * 4;

if(window.matchMedia('(max-width: 768px)').matches){
    card_size = 52;
    total_card_size = cards.length * card_size - card_size * 2;
}

if(window.matchMedia('(max-width: 568px)').matches){
    card_size = 52;
    total_card_size = cards.length * card_size - card_size * 2;
}

left_arrow.onclick = () => {
    left -= card_size;

    if(left <= 0) left = 0;
    moveCards(left);
    checkArrowVisibility(left);
}

left_arrow.style.opacity = '0';


right_arrow.onclick = () => {
    left += card_size;

    if(left >= total_card_size) left = total_card_size;
    moveCards(left);
    checkArrowVisibility(left);
}

function moveCards(left) {
    for(card of cards) {
        card.style.left = -left + "%";
    }
}


function checkArrowVisibility(pos){
    if(pos == 0 ) {
        left_arrow.style.opacity = '0';
    }else {
        left_arrow.style.opacity = '1';
    }
    if(pos >= total_card_size ) {
        right_arrow.style.opacity = '0';
    }else {
        right_arrow.style.opacity = '1';
    }
}

And this is JavaScript.

I have other small thing’s on bootstrap too.

I try to copy paste the code on index.
I was expecting the code duplicate and work fine.

(REACT) Setting a default value to a Dropdown field

I am making a simple frontend to showcase CRUD RESTful API behavior. One of the requirements is, when the option “GET” is selected, to set as a default at the Dropdown field shown in the picture “Order-by” the value “Name”. However, for all the other options, the value should be default “None”.

This is how the specific part of the frontend looks.

const [selectedOrder, setSelectedOrder] = React.useState('');

const handleOrderChange = (event) => { setSelectedOrder(event.target.value); }

So far, the attribute “selected” doesn’t work because the state of the field changes. Setting the defaultValue to name also doesn’t work.

`

Order-by: &nbsp;

<select name="order-by" value={selectedOrder} onChange={handleOrderChange}>

    <option value="">None</option>

    <option value="name" disabled={!isOptionDisabled("GET")}>Name</option>

    <option value="iso" disabled={!isOptionDisabled("GET")}>ISO</option>

    <option value="year" disabled={!isOptionDisabled("GET", "GET emission")}>Year</option>

    <option value="population" disabled={!isOptionDisabled("GET energy per capita")}>Population</option>

</select>

`

(@walletconnect/ethereum-provider)You may need an appropriate loader to handle this file type, currently no loaders are configured to process

this is package.json file configuration

 "next": "9.5.5"
 "next-images": "^1.6.2",
 "next-videos": "^1.4.0",
 "webpack": "^4.42.0"
 "react-relay": "^10.1.2",

these versions are working properly but when I add an updated version of “@walletconnect/ethereum-provider”: from “2.8.5” to “^2.11.0”( Latest ),

it gives me unexpected token errors and does not use the appropriate loader error.

showing some file

tsconfig.js

{
  "compilerOptions": {
    "target": "es6",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": false,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "module": "esnext",
    "moduleResolution": "node",
    "isolatedModules": true,
    "noImplicitAny": false,
    "jsx": "preserve",
    "esModuleInterop": true,
    "resolveJsonModule": true
  },
  "include": [
    "next-env.d.ts",
    "./node_modules/web3-typescript-typings/index.d.ts",
    "**/*.ts",
    "**/*.tsx"
  ],
  "exclude": [
    "**/__generated__/**",
    "**/*.graphql.ts",
  ]
}

next.config.js

const withImages = require("next-images");
const withVideos = require("next-videos");

module.exports = withVideos(
  withImages({
    fileExtensions: ["jpg", "jpeg", "png", "gif", "svg"],
    env: {},
    webpack(config, options) {
      if (!options.isServer) {
        config.resolve.alias["@sentry/node"] = "@sentry/browser";
      }
      if (!options.isServer) {
        config.node = {
          fs: "empty",
        };
      }
      config.module.rules.push({
        test: /node_modules[\/]@walletconnect/,
        loader: require.resolve('esbuild-loader'),
      });
      config.module.rules.push({
        test: /node_modules[\/]@metamask/,
        loader: require.resolve('esbuild-loader'),
      });
      config.module.rules.push({
        loader: require.resolve('babel-loader'),
        test: '/.(js|jsx|tsx)$/',
        exclude: /node_modules/,
      });
      return config;
    },
    pageExtensions: ['tsx', 'jsx', 'js']
  })
);

and in package.json added babel-loader also

 "babel": {
    "presets": [
      "react-app"
    ],
    "plugins": [
      [
        "styled-components",
        {
          "ssr": true,
          "displayName": true,
          "preprocess": false
        }
      ],
      [
        "relay"
      ],
      [
        "@babel/plugin-transform-react-jsx",
        {
          "runtime": "automatic"
        }
      ]
    ]
  }

here is webpack.config.js file

{
  module: {
    rules: [
      {
        test: /.scss$/,
        uese: {
          loader: "sass-loader",
          options: {
            includePaths: [
              path.resolve("../node_modules"), 
            ],
          },
        },
      },
      {
        test: require.resolve('jquery/dist/jquery.slim'),
        use: [{
          loader: 'expose-loader',
          options: 'jQuery'
        },{
          loader: 'expose-loader',
          options: '$'
        }]
      }
    ];
  }
}

I am building a predictive model web app for heart disease and i need help addressing these issues

So as I ran localhost 127.0.0.1:5000 I encountered these errors:

127.0.0.1 – – [26/Dec/2023 12:13:46] “POST / HTTP/1.1” 500 –

127.0.0.1 – – [26/Dec/2023 12:13:46] “GET /static/css/soft-ui-dashboard.css HTTP/1.1” 404 –

127.0.0.1 – – [26/Dec/2023 12:13:46] “GET /static/js/api.js HTTP/1.1” 404 –

127.0.0.1 – – [26/Dec/2023 12:13:46] “GET /static/js/soft-ui-dashboard.js HTTP/1.1” 404 –

127.0.0.1 – – [26/Dec/2023 12:13:46] “GET /static/img/ivancik.jpg HTTP/1.1” 404 –

I checked all that needs to be checked and im expecting a user interface where patient’s data can be inputed for predictions

How to keep a loggedin session continued across all the pages of my react app?

I am using firebase email and password as authorization please help!!

This is my App.js. I have tried with navigate but this only works in a single page have but i want to add multiple pages for different classes and there whenever a user is logged in it will redirect me to my home page instead of redirecting to the page of i intended to go to…
I would appreciate that if you can suggest me any other method than using navigate() for home page.
I want to continue my login session across my whole app

App.js code snippet 1
App.js code snippet 2

Data is not updated in react when used useState

I am new to ReactJs .I’m trying to use the useState hook in react function base component but the value of the state is not getting updated when I am calling the function. When receiving data via websocket, it is not possible to update the data on the line graph using the construct useState and useEffect.

client receives data via websocket:

const myWs = new WebSocket('ws://localhost:8000');
// обработчик проинформирует в консоль когда соединение установится
myWs.onopen = function () {
    console.log('подключился');
};

// обработчик сообщений от сервера
myWs.onmessage = function (message) {
    const jsonParse = JSON.parse(message.data);      
    try {   
      
      let temp = {x:setInterval((counter) =>{
        if(mockLineData[0].data.length >= 50){
          mockLineData[0].data.shift();
          counter++
        }
        else{
          counter++
        }
      }, 3000), y:jsonParse[0]['value_state']};
      mockLineData[0].data.push(temp);
      console.log(mockLineData[0].data);

    } catch (error) {
        console.log('Error: ', error);
    }
};




export const mockLineData = [
  {
    id: "ИБП Uвх",
    color: tokens("dark").redAccent[200],
    data: [
      {
        x: 0,
        y: 0
      },
      
    ],
  },
];

Next I’m trying to update data in a table using the construct useState and useEffect

const LineChart = ({ isCustomLineColors = false, isDashboard = false }) => {
  const theme = useTheme();
  const colors = tokens(theme.palette.mode);
  const [state, setState] = useState();
  
  useEffect(() => {
    setInterval(()=>{
      setState(data);
    },1000)
  }, []);


  return (
    <ResponsiveLine
      data={state}
      theme={{
        axis: {
          domain: {
            line: {
              stroke: colors.grey[100],
            },
          },
          legend: {
            text: {
              fill: colors.grey[100],
            },
          },
          ticks: {
            line: {
              stroke: colors.grey[100],
              strokeWidth: 1,
            },
            text: {
              fill: colors.grey[100],
            },
          },
        },
        legends: {
          text: {
            fill: colors.grey[100],
          },
        },
        tooltip: {
          container: {
            color: colors.primary[500],
          },
        },
      }}
      colors={isDashboard ? { datum: "color" } : { scheme: "nivo" }} // added
      margin={{ top: 50, right: 110, bottom: 50, left: 60 }}
      enableGridX={false}
      enableGridY={false}
      pointSize={8}
      pointColor={{ theme: "background" }}
      pointBorderWidth={2}
      pointBorderColor={{ from: "serieColor" }}
      pointLabelYOffset={-12}
      useMesh={true}
      legends={[
        {
          anchor: "bottom-right",
          direction: "column",
          justify: false,
          translateX: 100,
          translateY: 0,
          itemsSpacing: 0,
          itemDirection: "left-to-right",
          itemWidth: 80,
          itemHeight: 20,
          itemOpacity: 0.75,
          symbolSize: 12,
          symbolShape: "circle",
          symbolBorderColor: "rgba(0, 0, 0, .5)",
          effects: [
            {
              on: "hover", //hover
              style: {
                itemBackground: "rgba(0, 0, 0, .03)",
                itemOpacity: 1,
              },
            },
          ],
        },
      ]}
    />
  );
};

export default LineChart;

but the data is not updated

React Native: Issue with State Update – Component Not Re-rendering

I’m currently facing an issue in my React Native project related to state updates and component re-rendering. Even though I’m updating the state, the component doesn’t re-render as expected. Here’s a simplified version of my code:

import React, { useState } from 'react';
import { View, Text, Button } from 'react-native';

export default function MyComponent() {
  const [count, setCount] = useState(0);

  const handleIncrement = () => {
    setCount(count + 1);
    console.log('Count:', count); // Logs the correct incremented value
  };

  return (
    <View>
      <Text>Count: {count}</Text>
      <Button title="Increment" onPress={handleIncrement} />
    </View>
  );
}

Although the setCount function updates the state correctly, the component doesn’t re-render immediately, and the logged count value remains the same. I’ve tried using useEffect, but it doesn’t resolve the issue.

Can someone please provide guidance on how to troubleshoot and resolve this problem with state updates not triggering an immediate re-render of the component? Any help or insights would be appreciated. Thank you!

Is there a way of inserting data to database with manay to many relantionship in Prisma?

**These are my models:**
model Category {
  id      Int       @id @default(autoincrement())
  name    String    @unique @db.VarChar(50)
  product Product[]

  @@map("categories")
}

model Product {
  id         Int         @id @default(autoincrement())
  name       String      @unique @db.VarChar(35)
  barcode    String      @unique @db.VarChar(35)
  sell  Decimal     @db.Decimal(12, 2)
  shop Decimal     @db.Decimal(12, 2)
  quantity Int
  expiresIn String
  createdAt  DateTime    @default(now())
  updatedAt  DateTime    @updatedAt
  categoryId Int
  category   Category    @relation(fields: [categoryId], references: [id], onDelete: Cascade, onUpdate: Cascade)
  sales      SaleOrder[]
  purchases PurchaseProduct[]
  
  @@map("products")
}

model PurchaseProduct{
  name  String    @db.VarChar(50)
  sell  Decimal       @db.Decimal(12, 2)
  shop Decimal        @db.Decimal(12, 2)
  quantity Int
  expiresIn String
  purchaseId Int
  purchase   Purchase    @relation(fields: [purchaseId], references: [id], onDelete: Cascade, onUpdate: Cascade)
  productId Int
  product   Product    @relation(fields: [productId], references: [id], onDelete: Cascade, onUpdate: Cascade)

  @@id([purchaseId, productId])

  @@map("purchaseProducts")
}


model Purchase{
   id   Int     @id @default(autoincrement())
  supplierId Int
  supplier   Supplier    @relation(fields: [supplierId], references: [id], onDelete: Cascade, onUpdate: Cascade)
  createdAt  DateTime @default(now())
  updatedAt  DateTime @updatedAt

  purchases PurchaseProduct[]
  @@map("purchases")
}

model Supplier {
  id          Int       @id @default(autoincrement())
  name        String    @unique @db.VarChar(35)
  email       String?   @unique @db.VarChar(35)`your text`
  contact String?   @unique @db.VarChar(10)
  products    Purchase[]

  @@map("suppliers")
}

**What I have tried:**
export async function create(formData: Purchase){
  const purchase = await db.purchase.create({
    data:   {
      name: formData.name,
      sell: formData.sell,
      shop: formData.shop,
      quantity: formData.quantity,
      supplier: {
                  connectOrCreate:{
                    where:{name: formData.supplierName},
                    create:{name: formData.supplierName, contact: formData.phone, email: formData.email}
                }
              },
      product:{
                connectOrCreate:{where:{name:formData.name}, 
                create:{
                      name: FormData.name,
                      barcode: formData.barcode,
                      sell:formData.sell,
                      shop: formData.shop,
                      quantity: formData.quantity,
                      expiresIn: formData.expiresIn,
                      categoryId: formData.categoryId
                    }}
                }}
              })
              
  return purchase;
}

I have tried using connect and connectOrCreate but it did not work, because for each insertion of purchase it may have many products, so my idea is to insert many products of each purchase.
For example, for each purchase there will have product 1, product 2, product 3 and etc. I want to pass array of data/json containg these products and then insert int the three tables at once.

how to loop adding data the same information as before

const ObjectData =[
    { "foo": "baz", "y": "13" },
    { "foo": "baz", "y": "14" },
    { "foo": "baz", "y": "15" },
    { "foo": "baz", "y": "16" },
    { "foo": "baz", "y": "17" }
    ];
  var list = "";
  for (i = 0; i <= ObjectData.length; i++){
     list += ObjectData[i];
  }

how to loop adding data the same information as before
same information as before