Need help bypassing type errors in floating-ui module. (React JS)

package.json

{
  "name": "lifestyle-monitor-app-ui",
  "version": "0.1.0",
  "private": true,
  "resolutions": {
    "@types/react": "17.0.2",
    "@types/react-dom": "17.0.2", 
    "@babel/plugin-transform-block-scoping": "7.20.9"
  },
  "dependencies": {
    "@emotion/core": "^11.0.0",
    "@emotion/react": "^11.10.6",
    "@emotion/styled": "^11.10.6",
    "@floating-ui/dom": "^1.5.1",
    "@material-ui/core": "^4.12.4",
    "@material-ui/lab": "^4.0.0-alpha.61",
    "@tanstack/react-table": "^8.7.4",
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "@types/history": "^4.7.11",
    "@types/react": "^17.0.38",
    "chart.js": "^3.7.1",
    "getmdl-select": "^2.0.1",
    "hashids": "^2.2.11",
    "material-design-lite": "^1.3.0",
    "mdl-selectfield": "^1.0.4",
    "mui-datatables": "^4.3.0",
    "patch-package": "^8.0.0",
    "react": "^17.0.2",
    "react-calendar": "^4.0.0",
    "react-chartjs-2": "^4.0.1",
    "react-dom": "^17.0.2",
    "react-key-index": "^0.1.1",
    "react-router-dom": "^6.2.1",
    "react-scripts": "^5.0.1",
    "react-select": "^5.7.0",
    "react-table": "^7.7.0",
    "react-uuid": "^2.0.0",
    "typescript": "3.8",
    "uuid": "^9.0.0",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Error in floating-ui library

Steps taken to resolve the error.

  1. Deleted the node_modules folder and reinstalled using npm.
  2. Updated VS Studio.
  3. Changed @floating-ui/core to dom based on the suggestion here:- https://github.com/floating-ui/floating-ui/pull/2513

Need advice on how to proceed further. Any pointers are greatly appreciated.

Issue with React Component Rendering and State Update

Description of the Problem:

I’m building a React component that fetches data from an API and updates the state. However, I’m facing an issue with rendering and state updates.
`import React, { useState, useEffect } from ‘react’;

const MyComponent = () => {
const [data, setData] = useState([]);

useEffect(() => {
    fetchData();
}, []);

const fetchData = async () => {
    try {
        const response = await fetch('https://api.example.com/data');
        const result = await response.json();
        setData(result);
    } catch (error) {
        console.error('Error fetching data:', error);
    }
};

return (
    <div>
        <h1>Data:</h1>
        {data.map(item => (
            <p key={item.id}>{item.name}</p>
        ))}
    </div>
);

};

export default MyComponent;
`

Error Messages:
No specific error messages, but the data is not rendering as expected, or the state is not updating after fetching.

Can’t display animated sprite / gif on a PIXI Tile map

I have this map where I can add different Tiles. Till now all textures are normal Spritesheets. You can select on the editor one Tile Type and add it per click to the map, so that the selected tile displays the chosen tile type.
Map with diffrent addable tile types

So far so good. Now I want to animate the small wind turbine so it’s constantly turning.
I made the following sprite sheet with texture packer:
(There are four frames but I deleted them here so this question doesn’t get too long)

{"frames": {

"wt1.png":
{
    "frame": {"x":0,"y":0,"w":72,"h":72},
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": {"x":0,"y":0,"w":72,"h":72},
    "sourceSize": {"w":72,"h":72}
},
...
},
"animations": {
    "wt": ["wt1.png","wt2.png","wt3.png","wt4.png"]
},
"meta": {
    "app": "https://www.codeandweb.com/texturepacker",
    "version": "1.1",
    "image": "animatedWT.png",
    "format": "RGBA8888",
    "size": {"w":144,"h":144},
    "scale": "1",
    "smartupdate": "$TexturePacker:SmartUpdate:11679a5566d7f64fe2a648dcd7ee9107:cd3569348d06082e95cf14df37fe1bf3:d807192215a8ab88d955d69e2dbe949c$"
}
}

Then I call this function textureLoader.addGIF("animatedWT", app); in my main.js.
The other textures get called like this textureLoader.addSpritesheet("windturbines_big");

The definition of the function looks like this:

addGIF(animatedWT, app) {
    this.app.loader.add(`./textures/${animatedWT}.json`, (resource) => {
      this.textures[animatedWT] = new PIXI.AnimatedSprite(
        resource.spritesheet.animations.wt
      );
      // console.log(this.textures.animatedWT);
// Here I add some deeper laying attributes to the front of the object because i had some issues with //n // later calls on the object
      this.textures.animatedWT["baseTexture"] =
        this.textures.animatedWT._texture.baseTexture;
      this.textures.animatedWT["orig"] = this.textures.animatedWT._texture.orig;
      this.textures.animatedWT["_uvs"] = this.textures.animatedWT._texture._uvs;
// I don't really know what I do here but it's done in this tutorial
// https://youtu.be/FjiQSwohBVs?si=tyc_2JG7jNWziNxq
      app.stage.addChild(this.textures.animatedWT);
      app.ticker.add(this.animate(this.textures.animatedWT, app));
    });
  }
  animate(animatedWT, app) {
    animatedWT.x = app.renderer.screen.width / 2;
    animatedWT.y = app.renderer.screen.height / 2;
  }

the animatedWT object after added to app.stage
or how the animatedSprite looks like:

children: (1) […]
​​​0: {…}
​​​​_anchor: {…}
​​​​_autoUpdate: true
​​​​_bounds: {…}
​​​​_boundsID: 0
​​​​_boundsRect: null
​​​​_cachedTint: 16777215
​​​​_currentTime: 0
​​​​_destroyed: false
​​​​_durations: null
​​​​_enabledFilters: null
​​​​_events: {}
​​​​_eventsCount: 0
​​​​_height: 0
​​​​_isConnectedToTicker: false
​​​​_lastSortedIndex: 0
​​​​_localBounds: null
​​​​_localBoundsRect: null
​​​​_mask: null
​​​​_playing: false
​​​​_previousFrame: 0
​​​​_roundPixels: false
​​​​_texture: {…}
​​​​_textureID: -1
​​​​_textureTrimmedID: -1
​​​​_textures: (4) […]
​​​​_tint: 16777215
​​​​_tintRGB: 16777215
​​​​_transformID: -1
​​​​_transformTrimmedID: -1
​​​​_uvs: {…}
​​​​_width: 0
​​​​_zIndex: 0
​​​​alpha: 1
​​​​animationSpeed: 1
​​​​baseTexture: {…}
​​​​blendMode: 0
​​​​children: []
​​​​filterArea: null
​​​​filters: null
​​​​indices: Uint16Array(6)
​​​​isMask: false
​​​​isSprite: true
​​​​loop: true
​​​​onComplete: null
​​​​onFrameChange: null
​​​​onLoop: null
​​​​orig: {…}
​​​​parent: {…}
​​​​pluginName: "batch"
​​​​renderable: true
​​​​sortDirty: false
​​​​sortableChildren: false
​​​​tempDisplayObjectParent: null
​​​​transform: {…}
​​​​updateAnchor: false
​​​​uvs: Float32Array(8)
​​​​vertexData: Float32Array(8)
​​​​vertexTrimmedData: null
​​​​visible: true
worldAlpha: 1
<prototype>: {…}
//to add a normal Sprite the function looks like this
  addSpritesheet(name) {
    this.app.loader.add(`./textures/${name}.json`, (resource) => {
      this.textures[name] = resource.textures;
    });
  }

In the next step the Tiles are rendered

For normal sprites it’s done like this:

  renderWaterTile(x, y) {
// a random texture is chosen from the spritesheet
    const textureNumber = 1 + Math.round(this.randomizedTerrain[y][x] * 8);
// the texture from the TextureTile[][] is set to the new texture
    this.getTextureTile(x, y).texture =
      this.textures.water[`water-0${textureNumber}`];
    this.getTextureTile(x, y).visible = true;
  }

a this.TextureTile[][] normally loks like this:

_anchor: {…}
​​​_bounds: {…}
​​​_boundsID: 159
​​​_boundsRect: null
​​​_cachedTint: 16777215
​​​_destroyed: false
​​​_enabledFilters: null
​​​_events: {}
​​​_eventsCount: 0
​​​_height: 72
​​​_lastSortedIndex: 0
​​​_localBounds: null
​​​_localBoundsRect: null
​​​_mask: null
​​​_roundPixels: true
​​​_texture: {…}
​​​_textureID: 1
​​​_textureTrimmedID: -1
​​​_tint: 16777215
​​​_tintRGB: 16777215
​​​_transformID: 2
​​​_transformTrimmedID: -1
​​​_width: 72
​​​_zIndex: 0
​​​alpha: 1
​​​blendMode: 0
​​​children: []
​​​filterArea: null
​​​filters: null
​​​indices: Uint16Array(6)
​​​isMask: false
​​​isSprite: true
​​​parent: {…}
​​​pluginName: "batch"
​​​renderable: true
​​​sortDirty: false
​​​sortableChildren: false
​​​tempDisplayObjectParent: null
​​​transform: {…}
​​​uvs: Float32Array(8)
​​​vertexData: Float32Array(8)
​​​vertexTrimmedData: null
​​​visible: true
​​​worldAlpha: 1

TextureTile[][] is a matrix and is previously defined like this in the constructor:

this.textureTiles = Array2D.create(
      this.city.map.width,
      this.city.map.height,
      null
    );

this.city.map.allCells().forEach(([x, y]) => {
      const bgTile = new PIXI.Graphics();
      bgTile.x = x * MapView.TILE_SIZE;
      bgTile.y = y * MapView.TILE_SIZE;
      this.bgTiles[y][x] = bgTile;

// here it's predefined as new PIXI.Sprite maybe that's part of the problem
      const textureTile = new PIXI.Sprite();
      textureTile.x = x * MapView.TILE_SIZE;
      textureTile.y = y * MapView.TILE_SIZE;
      textureTile.width = MapView.TILE_SIZE;
      textureTile.height = MapView.TILE_SIZE;
      textureTile.roundPixels = true;
      this.textureTiles[y][x] = textureTile;
      this.renderTile(x, y);
    });

For my animated tile I tried several things:

Normally only the texture attribute of the object is updated but the PIXI.sprite object and the PIXI.animatedSprite Object are different from each other. So I tried it like this: this.textureTiles[y][x] = this.textures.animatedWT; instead of this:
this.getTextureTile(x, y).texture = this.textures.water[water-0${textureNumber}];

here is the whole function:

  renderWindTurbineSmallTile(x, y) {
    let animatedWT = this.textures.animatedWT;
    // app.stage.addChild(img);

    animatedWT.animationSpeed = 1;
    animatedWT.play();

    animatedWT.onLoop = () => {
      console.log("loop");
    };
    animatedWT.onFrameChange = () => {
      console.log("currentFrame", animatedWT.currentFrame);
    };
    animatedWT.onComplete = () => {
      console.log("done");
    };
    // here is the important bit I think
    this.textureTiles[y][x] = this.textures.animatedWT;
    this.getTextureTile(x, y).visible = true;

with this I get no errors in the console and it prints the loops and frame changes etc.
but I don’t see the animated sprite just the grey tile

I also tried this: `this.getTextureTile(x, y).texture = this.textures.animatedWT.texture;
It displays one frame of the animated sprite and if I add another windturbine it changes the frame but on all windturbines I set. I also have the feeling that the animation speed influences the change of the frames.
enter image description here
enter image description here

the texture object of the animatedWt looks like this:

_events: {}
​_eventsCount: 0
​_frame: {…}
​_rotate: 0
​_updateID: 1
​_uvs: {…}
​baseTexture: {…}
​defaultAnchor: {…}
​noFrame: false
​orig: {…}
​textureCacheIds: (1) […]
​trim: null
​uvMatrix: null
​valid: true
​<prototype>: {…}

I also tried this cause I thought maybe it doesn’t work because in the constructor TextureTiles[][] is only defined as Sprite: this.textureTiles[y][x] = new PIXI.AnimatedSprite( this.textures.animatedWT.textures );
but again only a grey tile and no animatedSprite.

The Frame changes are constantly printed in all tries.

If anyone has an idea what I might be doing wrong, it would be nice to hear or if you have an example for a similar problem so I could have look 🙂 also if anyone can tell me what app.ticker does, that would be great too.

React Native Touch Through Flatlist

For
"react-native": "^0.70.5"

Requirement:

  • Flatlist as an overlay above Clickable elements
  • Flatlist header has a transparent area, with pointerEvents="none" to make the elements below clickable and yet allow the Flatlist to scroll.
    enter image description here

Issues with some possible approaches

  1. pointerEvents="none" doesn’t work with Flatlist, as internally how Flatlist is built it will block the events at all values of pointerEvents. It’s the same with Scrollview as well.
  2. react-native-touch-through-view (the exact library I need) doesn’t work with RN 0.70.2, library is outdated. After fixing the build issues, touch events are not propagating to the clickable elements.
  3. Created a custom component ScrollableView, as pointerEvents with View work well. With this adding pointerEvents to none on parts of the children, lets the touch event to propagate to elements below.
  • This is working well on Android, but failing on iOS.
  • Also the scrolling of the view is not smooth.
  • Requires further handling for performance optimisation for long lists
import React, { useState, useRef } from 'react';
import { View, PanResponder, Animated } from 'react-native';

const ScrollableView = ({children, style, onScroll}) => {
    const scrollY = useRef(new Animated.Value(0)).current;
    const lastScrollY = useRef(0);
    const scrollYClamped = Animated.diffClamp(scrollY, 0, 1000);

    const panResponder = useRef(
        PanResponder.create({
            onStartShouldSetPanResponder: () => true,
            onPanResponderMove: (_, gestureState) => {
                scrollY.setValue(lastScrollY.current + gestureState.dy);
            },
            onPanResponderRelease: (_, { vy, dy }) => {
                lastScrollY.current += dy;
                Animated.spring(scrollY, {
                    toValue: lastScrollY.current,
                    velocity: vy,
                    tension: 2,
                    friction: 8,
                    useNativeDriver: false,
                }).start();
            },

        })
    ).current;

    const combinedStyle = [
        {
            transform: [{ translateY: scrollYClamped }],
        },
        style
    ];

    return (
        <Animated.View
            {...panResponder.panHandlers}
            pointerEvents="box-none"
            style={combinedStyle}
        >
            {children}
        </Animated.View>
    );
};

export default ScrollableView;

Any solution to any of the above three approaches is appreciated.

cannot install type script on Mac on visual studio code

when I type:
npm install typescript -g

on visual studio code it gives me this error:

code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/typescript
npm ERR! dest /usr/local/lib/node_modules/.typescript-U1UXj10a
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename ‘/usr/local/lib/node_modules/typescript’ -> ‘/usr/local/lib/node_modules/.typescript-U1UXj10a’
npm ERR! [Error: EACCES: permission denied, rename ‘/usr/local/lib/node_modules/typescript’ -> ‘/usr/local/lib/node_modules/.typescript-U1UXj10a’] {
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘rename’,
npm ERR! path: ‘/usr/local/lib/node_modules/typescript’,
npm ERR! dest: ‘/usr/local/lib/node_modules/.typescript-U1UXj10a’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: /Users/eitan/.npm/_logs/2023-12-05T16_23_00_361Z-debug-0.log

when I try to rename the typescript file to .typescript-U1UXj10a the Mac says that I cannot use a name with .dot because these name are preserved for the system

please help me install type script on visual studio code

How to display all players in an online game node.js + socket.io + phaser 3?

The first player can see the second player and his movement. The second player can’t see the first player, let alone the movement. If you reload, they change places and so on ad infinitum. I don’t have any errors, I think the error is in the algorithm. I use node.js, socket.io, phaser 3, express and so on. I want all players to see each other and their movement.

Part of the code on the server

    io.on('connection', (socket) => {
        console.log('A user connected');

        socket.on('createPlayer', async () => {
            try {
                const userId = socket.handshake.session.user.id;
                socket.emit('currentUserId', userId);

                const [rows] = await pool.query('SELECT * FROM users WHERE id = ?', [userId]);

                if (rows.length > 0) {
                    let playerData = {
                        playerId: userId,
                        x: rows[0].x_position,
                        y: rows[0].y_position,
                    };

                    socket.broadcast.emit('newPlayer', playerData);

                    io.emit('playerCreated', playerData);
                } else {
                    io.to(socket.id).emit('playerCreationError', 'Игрок не найден.');
                }
            } catch (error) {
                console.error(error);
                io.to(socket.id).emit('playerCreationError', 'Error');
            }
        });

    socket.on('playerMovement', async (data) => {
        try {
            const userId = socket.handshake.session.user.id;
            const { x, y } = data;

            await pool.query('UPDATE users SET x_position = ?, y_position = ? WHERE id = ?', [x, y, userId]);

            socket.broadcast.emit('playerMoved', { playerId: userId, x, y });
        } catch (error) {
            console.error(error);
        }
    });

Сode on the client

const socket = io();

class BaseScene extends Phaser.Scene {
    constructor(key) {
        super({ key });
        this.currentUserId = null;
        this.currentPlayers = {};
    }

    preload() {
        this.load.image('player', 'assets/player.png');
    }

    create() {

        const self = this;

        this.cursors = this.input.keyboard.createCursorKeys();

        socket.emit('createPlayer');

        socket.on('currentPlayers', (players) => {
            this.currentPlayers = players;
        });

        socket.on('currentUserId', (userId) => {
            console.log('Current user ID:', userId);
            this.currentUserId = userId;
        });

        socket.on('playerCreationError', (message) => {
            console.log(message);
        });

        socket.on('playerCreated', (playerData) => {
            if (playerData.playerId === this.currentUserId) {
                
                this.player = this.physics.add.image(playerData.x, playerData.y, 'player').setDisplaySize(200, 200);
                this.add.existing(this.player);
            } else {
                
                const otherPlayer = this.physics.add.image(playerData.x, playerData.y, 'player').setDisplaySize(200, 200);
                this.add.existing(otherPlayer);
                this.currentPlayers[playerData.playerId] = { sprite: otherPlayer };
            }
        });

        socket.on('playerMoved', (playerData) => {
            if (this.currentPlayers[playerData.playerId]) {
                const otherPlayer = this.currentPlayers[playerData.playerId].sprite;
                if (otherPlayer) {
                    otherPlayer.x = playerData.x;
                    otherPlayer.y = playerData.y;
                    otherPlayer.setPosition(playerData.x, playerData.y);
                }
            }
        });

        socket.on('newPlayer', (playerData) => {
        
        });

    }

    update() {
        if (this.player) {
            let moved = false;

            if (this.cursors.left.isDown) {
                this.player.setVelocityX(-160);
                moved = true;
            } else if (this.cursors.right.isDown) {
                this.player.setVelocityX(160);
                moved = true;
            } else {
                this.player.setVelocityX(0);
            }

            if (this.cursors.up.isDown) {
                this.player.setVelocityY(-160);
                moved = true;
            } else if (this.cursors.down.isDown) {
                this.player.setVelocityY(160);
                moved = true;
            } else {
                this.player.setVelocityY(0);
            }

            if (moved) {
                socket.emit('playerMovement', { x: this.player.x, y: this.player.y });
            }
        }

    }
}

Change the color of keywords and locate their position when deleting part of a text

For example, write an SQL statement: SELECT field1, field2 FROM table, for example, as you write the word SELECT it is painted blue, then field1 and field2 are painted black, when writing FROM it is painted blue.
If I delete a letter from the word SELECT, leaving SLECT, it loses its blue color and turns black and the editor pointer remains in position 2 because I have deleted the first letter E.
With TinyMCE is it possible?

In the editor’s KEYUP event, when it detects a space, I take the edited content through GETNODE, I detect that it is a keyword, I delete INNERTEXT content, I assign OUTERHTML content to it, sometimes I cannot have control with the pointer. Sometimes GETNODE returns part of the previous existing text, selection.getRng().startOffset returns a value that is related to what was modified and not the text that comes in the GETNODE… This makes it difficult to manipulate the editor

Change materials of fragments in IFC.js? [closed]

I’m trying to implement a transparency mode in a ifc.js viewer component. But when i try to change the material, only IfcSpaces are affected.

My approach to solving this problem was to loop over all fragments and change their material. Am i doing something wrong? Is a matrial change of fragments not desired?

Web Worker doesn’t seem to be working on Production

I have been trying to use web worker on my React application, and pretty much succeeded in doing so locally. But, after deploying it to docker-container and EC2 instance afterward, I’m getting the next issue which is closely related to Web Worker: tick

CreateWebWorker.js

export default class CreateWebWorker {
  constructor(worker) {
    let code = worker.toString();
    code = code.substring(code.indexOf('{') + 1, code.lastIndexOf('}'));

    const blob = new Blob([code], { type: 'application/javascript' });
    return new Worker(URL.createObjectURL(blob));
  }
}

FetchingImagesWorker.js

export default function FetchingImagesWorker() {
  const getImage = async (imageName, accessToken) => {
    const headers = {
      'Content-Type': 'application/json',
      Authorization: `Bearer ${accessToken}`,
    };

    const requestOptions = {
      method: 'GET',
      headers,
    };

    const apiUrl = `${process.env.REACT_APP_API_URL}/api/flight-reports/all/images/${encodeURIComponent(imageName)}`;
    const response = await fetch(apiUrl, requestOptions);

    return response.blob();
  };

  self.onmessage = async (event) => {
    const downloadQueue = [];
    const { imageNames, accessToken, maxConcurrentRequests } = event.data;

    const handleImageDownload = async (imageName) => {
      const response = await getImage(imageName, accessToken);
      self.postMessage(response);
    };

    // eslint-disable-next-line no-restricted-syntax
    for (const imageName of imageNames) {
      downloadQueue.push(handleImageDownload(imageName));

      if (downloadQueue.length >= maxConcurrentRequests) {
        // eslint-disable-next-line no-await-in-loop
        await Promise.all(downloadQueue);
        downloadQueue.length = 0;
      }
    }

    if (downloadQueue.length > 0) {
      await Promise.all(downloadQueue);
    }
  };
}

And the way I’m using it in one of React components:

const worker = new CreateWebWorker(FetchingImagesWorker);

Would be much appreciated on any information.

Intersection Observer is not working properly with position set to sticky

I have created a very simple vertical scroll slider which contains 5 “slides”.

Each slide contains a data attribute in the HTML name “data-index” ranging from 0 to 4 which will be used along side the “intersection observer” to detect which “slide” + its “index” we’re currently on.

Furthermore, I was able to make each slide “snap” to “center” through CSS.

However, it seems that the “intersection observer” was not able to detect the data attribute whenever I scroll up.

Theoretically, the “data-index’ should decrement as I scroll up to the previous slide & increment as I scroll down.

Is this due to “position” being set to “sticky”

I wasn’t able to find much on this issue over the internet. Has anyone encounter this problem? If so, what was the solution? Any feedback will be greatly appreciated.

const slides = document.querySelectorAll('.slide');

function update(entries) {
  entries.forEach((entry) => {
    if (!entry.isIntersecting) return;
    const i = entry.target.dataset.index;
    console.log(i)
  });
}

function detect(slide) {
  const options = {threshold:0.2};
  const io = new IntersectionObserver(update,options);
  io.observe(slide);
}

const init = () => slides.forEach(detect);

window.addEventListener('load',init,false);
:root {
  --height: 50vh; 
}

body { scrollbar-width: none; }

::-webkit-scrollbar { display: none; }

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

main {
  position: relative;
  font: 0.85rem helvetica,sans-serif;
}

.slider {
  height: var(--height);
  border: 1px solid #000;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  
  & .slide {
    position: sticky;
    top: 0;
    scroll-snap-align: center;
    height: inherit;
    border: 1px solid #000;
    padding: 1rem;
    background-color: white;
  }
}
<main>
  <ul class='slider'>
    <li class='slide' data-index='0'>0</li>
    <li class='slide' data-index='1'>1</li>
    <li class='slide' data-index='2'>2</li>
    <li class='slide' data-index='3'>3</li>
    <li class='slide' data-index='4'>4</li>
  </ul>
</main>

How to handle input from switch in Node js

I’m using express and I am completely lost how can I get input from switch,
I want to create something like real time application when I toggle the switch, something happens on the server side.
I use bootstrap so here is piece of html that I`m using

    <form action="/apps" method="post">    
        <div class="form-check form-switch">
            <input class="form-check-input" type="checkbox" role="switch" id="Switch">
            <label class="form-check-label" for="flexSwitchCheckDefault">Default switch checkbox input</label>
        </div>
    </form>

Here is my code in Node js

app.post('/apps', bodyParser.urlencoded({ extended: true }), (req, res, next) => {
    console.log("Shit is working")
});

But nothing seems to happen when I toggle the switch.
I appreciate any response or help because I`m new at Node js.

What things to remember while making a portfolio website?

I am a full-stack web developer aspirant, and I want to create a portfolio website. I want some beginner tips to start the process.

I didn’t tried making the website just wanted some tips and tricks to start with. I have experience of making websites, as far I’ve made book recommendation and review website and tours & travels website. Can I include projects and past experience in it? what else do I need to have in it? Just need some guidance so that I can go further.

How to save Updated and New information to another sheet, based on multiple criteria?

I’m trying to create a Bank Reconciliation tool in Google Sheets.
I have a list, Rec_FormWS, that is pulls data from Data_EntryWS. Rec_FormWS filters rows with status considered outstanding. From Rec_FormWS, I put “x” next to each items that I have received. How do I write a code that can save the “x” for those items from Rec_FromWS back to Data_EntryWS? The criteria that can help match the transactions back to Data_EntrytWS are GL codes and certian bank accounts.
Rec_FormWS
Data_EntryWS
Here is what I have currently coded. Sometimes the execution times out without completing the task.I am open to approaching to a solution through other approaches. I just want the “x” saved back to the Data_EntryWS.

Webpack Compilation Error after running the test and querying the table in the database

I need to run an automated test (Cypress) that connects to my database (mysql) and does a select (lib mysql2).
I am unable to run my test successfully.

I’m getting the following error:

Error: Webpack Compilation Error
./node_modules/lru-cache/dist/mjs/index.js 48:8
Module parse failed: Unexpected token (48:8)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| }
| class Stack {
>     heap;
|     length;
|     // private constructor
 @ ./node_modules/mysql2/lib/parsers/parser_cache.js 3:12-32
 @ ./node_modules/mysql2/promise.js

I imagined it would be something related to node_modules. I deleted and installed everything again.
However, the error remains.

Could anyone help me?

> My file db.js below:

var mysql = require('mysql2/promise');

var pool = mysql.createPool({
    host: "for-qa-dblibsmetricsinformation.clmii4vy3haa.us-east-1.rds.amazonaws.com",
    user: "usr_test",
    password: "usr-test",
    database: "db_test",
    connectionLimit: 10 // maximum number of connections in the pool
});

module.exports = pool;

> My file .spec.js below

const pool = require('../../../../../../../../db.js');

describe('Test DB', () => {
  it('should consult a new user', () => {
    const result = pool.execute('select user_name from table_test');
    cy.log(result);
  });
});

Thanks in advance!!

multiple circular progress bar getting same options using jquery

I am trying to create progress bar which require multiple progress bar to overlap i am doing this using HTML , CSS and jquery. the problem is that both getting same parameters although i have assigned different parameters to both.

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./style.css">
    <link rel="stylesheet" href="./grasp_mobile_progress_circle-1.0.0.css">
</head>
<body>
    <div class="main-container">
        <div id="outer-progress-bar">
            <div class="dashed">

            </div>
        </div>
        <div id="my-progress-bar">

        </div>

    </div>
    
</body>
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>

    <script src="./grasp_mobile_progress_circle-1.0.0.js"></script>
    <script src="./index1.js"></script>
    <script src="./index2.js"></script>
</html>

CSS:

body {
  }
  .main-container{
    width: 200px;
    height: 200px;
    background-color: blue;
    position: relative;
  }
    .outer-progress-bar{
    border-radius: 50%;
    display: flex;
    align-items: center;
    position: absolute;
    left: -20px;
    top: -20px;

    

  }
  .dashed{
    width: 170px;
    height: 170px;
    border: 2px dashed red;
    position: absolute;
    left: 37px;
    
    border-radius: 50%;
  }
  .my-progress-bar {
    position: absolute;
    left: 0%;
    z-index: 1;
    /* transform: translate(-50%, -50%); */
  }

index1.js:

$(document).ready(function () {
    var options1 = {
        line_width: 5,
        color: "green",
        starting_position: 0,
        width: "120px",
        height: "120px",
        text: "",
        percent: 0,
    };

    var progress_circle1 = $("#my-progress-bar").gmpc(options1);
progress_circle1.gmpc('animate', 80, 500);
});

index2.js:

 var a=$(document).ready(function () {
    var options2 = {
        line_width: 12,
        color: "red",
        starting_position: 0,
        percent: 0,
        width: "300px",
        height: "300px",
        text: "",
        percentage: true,
    };
    
    var progress_circle2 = $("#outer-progress-bar").gmpc(options2);
    progress_circle2.gmpc('animate', 70, 500); 
});

This is the result of this code:

enter image description here

I want to achieve this result:

enter image description here