shadcn card – semantic HTML

when using card.tsx from shadcn I see that’s a div styled with tailwind (the card itself). Should I change it to section instead of div for semantic HTML? should I change also the footer (adding footer for example), header (adding header tag) for semantic HTML ?

const Card = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
  ({ className, ...props }, ref) => (
    <div
      ref={ref}
      className={cn(
        "rounded-xl border bg-card text-card-foreground shadow-md",
        className,
      )}
      {...props}
    />
  ),
);

const CardHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
  ({ className, ...props }, ref) => (
    <div
      ref={ref}
      className={cn("flex flex-col space-y-1.5 p-6", className)}
      {...props}
    />
  ),
);

const CardTitle = forwardRef<
  HTMLParagraphElement,
  HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
  <h3
    ref={ref}
    className={cn("font-semibold leading-none tracking-tight", className)}
    {...props}
  />
));

const CardDescription = forwardRef<
  HTMLParagraphElement,
  HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
  <p
    ref={ref}
    className={cn("text-sm text-muted-foreground", className)}
    {...props}
  />
));

const CardContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
  ({ className, ...props }, ref) => (
    <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
  ),
);
CardContent.displayName = "CardContent";

const CardFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
  ({ className, ...props }, ref) => (
    <div
      ref={ref}
      className={cn("flex items-center p-6 pt-0", className)}
      {...props}
    />
  ),
);
CardFooter.displayName = "CardFooter";

JavaScript: animate z-index of an element with element animate() method

On a web page, I have an element I would like to animate its z-index.

Here is my code:

myElement.animate({
    opacity: [0.1, 1.0, 0.1, 0],
    background: ["red", "green", "red"],
    z-index: [0, 128, 0]
}, {
    fill: 'forwards',
    timeline: new ViewTimeline({
        subject: animationTrigger

    }),
    rangeStart: {rangeName: 'entry', offset: CSS.percent(4)},
    rangeEnd: {rangeName: 'exit', offset: CSS.percent(64)},
});

I have tried z-index, zindex, but nothing works.

Apparently, I am using the wrong property name.

Any help or a hint will be appreciated.

jest javascript unit test issue. How to test class if class initialise is in the same file

I have something like that

import {firstTableSettings} from "./firstTableSettings.js"
import {secondTableSettings} from "./secondTableSettings.js"

export default class CreateADTable {
  constructor(settings) {
   ...
  }
  ...
}

let tablesSettings = [firstTableSettinhs, secondsTableSettings] 

function createTable() {
  for(let setting of tablesSettings) {
    new CreateADTable(setting)
  }
}
createTable() //during jest test it generate problem, but I need it here

Because in JavaScript, import immediately calls the createTable method, the class is created with the original data. firstTableSettings and secondTableSettings contain calls to endpoints using axios, and many other things that prevent the test environment from being isolated (at least that’s how it looks). I would like to have full control over what is pushed to the class during test. And even if my test passes fine, I see that the method calling the class with the original methods is run anyway. Is it possible to somehow suppress the createTable method so that it doesn’t get called at all? What should the test architecture be for such a case? Or maybe I shouldn’t worry about errors related to the fact that the class with the original data is called first?

I tried some mock, but always was something wrong or mock looked like not working.

How to run OnlyOffice server repo and web-app repo on my local machine using ubuntu

Hi i am trying to run https://github.com/ONLYOFFICE/web-apps.git https://github.com/ONLYOFFICE/server.git these to repo of onlyoffice for backend and frontend on my local machine using ubuntu but i am not able to fine any entry point how to run backend of it and also not able to find package.json in web-app can anyone help me in this it will be great help

am using node.js and javascript i tried a lot but not able to find a way how to run it on my machine locally

@onlyOffice

I have tried everything to run these https://github.com/ONLYOFFICE/web-apps.git https://github.com/ONLYOFFICE/server.git frontend and backend repo on local machine but able to find way how to run it locally i am new and using node.js and javascript and i amnot able to find entry point of this project to run on my machine

Best Approach to Implement Automated Login for Electron App without Triggering Antivirus

I’ve built an account manager application using Electron that securely stores usernames and passwords. Now, I want to implement a login feature with the following requirements:

Retrieve the username and password from the Electron app and pass them to a login script.
(Optional) Automatically open the League of Legends client.
Automate the input of the username and password into the client, followed by pressing “Enter”.
I’ve noticed that many people achieve this kind of automation using tools like AutoIt or PyAutoGUI. However, I’m concerned that scripts or executables created with these tools are often flagged as viruses by antivirus software, especially when distributed.

Constraints:

I don’t want to run the entire Electron app with admin rights; I prefer requesting admin rights only once, perhaps during the installation of the automation script.
Signing the program is not an option due to budget constraints—this is a hobby project.
What are my best options to achieve this functionality? Is there a more secure and reliable way to handle this automation without triggering antivirus alerts, or am I overlooking something obvious?

So far, I’ve explored the following options:

AutoIt: I considered using AutoIt for the automation, as it’s commonly used for tasks like this. However, I found that AutoIt scripts are frequently detected as viruses by antivirus software, which would be problematic for distribution.

PyAutoGUI: I also looked into using PyAutoGUI within a Python script to automate the key inputs. However, I expect that compiled Python scripts might face similar antivirus detection issues, especially since they involve automating user input in another application.

making sidebar and navbar responsive in mobile screens in react

so basically sidebar and navbar is both different components in my code i have navbar.jsx and sidebar.jsx and both are being called under student.jsx … now on mobile screens i want that the sidebar also gets into that hamburger icon in the navbar when on mobile screens and that user can navigate different pages such as dashboard counselling etc when clicked on the icon which contains the sidebar and its different pages

i tried to hide the sidebar in mobile screen my putting the css display none in mobile screens and tried using usestate hook and toggle logic but i cant put the sidebar in the navbar and i want them to be different just in mobile screens they should be together this is what its looking like right now

Web animation API composite accumulate

I’m trying to understand if it’s possible to accumulate animations with the Web API animation and I can’t seem to figure it out.

//move element very fast to 100,100 with no duration
el.animate([{transform: 'translate(100px, 100px'}], {duration: 0, fill: 'forwards'});

//add another movement after that with duration
el.animate([{transform: 'translateX(300px)'}], {duration: 0, fill: 'forwards', composite: 'accumulate'});

Everything happens properly, the box moves to 100,100 then the animation starts. The problem is, at the end of the animation, the boxes moves up like it has suddenly lost the Y transform. It is possible to keep the Y transform at the end? I thought fill: 'forwards' + composite : 'accumulate' would do that …

Note: once in a while, it does behave properly so I’m not sure what’s going on

const el = document.querySelector('.box');

el.animate([{transform: 'translate(100px, 100px'}], {duration: 0, fill: 'forwards'});

el.animate([{transform: 'translateX(200px)'}], {duration: 2000, fill: 'forwards', composite: 'accumulate'});
.container{
  display: block;
  height: 100vh;
  overflow: hidden;
}
.box{
  position: absolute;
  width: 300px;
  height: 200px;
  background-color: brown;
 }
<div class="container">
  <div class="box">  
  </div>
</div>

JsFiddle

How can I obtain a URL to share my react project built using EXPO

I have built a small project and I want to share it with my friend that have both ios and android devices however the npx expo publish command doesnt work cause it has been deprecated.

I have also built the project using EAS update and I have uploaded the project to the expo store

I dont want to publish my app neither on App-Store nor on Play-Store

I only get this console message after building the project using eas update --branch development --platform android


Branch             development
Runtime version    1.0.0
Platform           android, ios
Update group ID    fea6d627-d9d2-49cb-9516-be6f25fbf713
Android update ID  5cb94dcd-fee0-4767-85ec-31741744790f
iOS update ID      0f396149-f63f-494d-8f7b-d0a8305c0fc3
Message            Initial commit
Commit             05203e1673112b0c5bb13b938ad8934bb08d2fc1*
EAS Dashboard      https://expo.dev/accounts/manfomaiva/projects/native-react/updates/fea6d627-

How can i check the properties inside an object accessed by it’s own function?

I’m trying out things to understand how it works.. not sure how would i be able to get the ID for example?

const opciones = [{
        id: 0,
        texto: "Inicio",
        descripcionTitulo: "Bienvenido al programa de carga de Viajes",
        descripcion: "Selecciona lo que quieras hacer",
        icon: <FaCheckCircle />,
        next: function next() {
                console.log(this.id)
        },
        contenido: <Inicio setToggle={setToggle} />,
        botonSiguiente: "Nuevo Viaje"
    },
    {
        id: 1,
        texto: "Descripción",
        descripcionTitulo: "Descripcion",
        descripcion: "detalles importantes",
        icon: <FaBookOpen />,
        next: function next() {

        },
        contenido: <Descripcion setToggle={setToggle} />,
        botonSiguiente: "Siguiente"

    }
    ]

i have a function inside my object and i’m trying to log it’s ID inside it’s own function if it makes sense.. i’m not sure how do I access it?
I’m getting undefined onclick if i try to log “this.id”

How to decide Function chaining priority

I have a problem link

Where I have only 3 requirements:

  1. Create a function that logs a message with whatever passed in arguements
  2. Chain mutiple methods on it.
  3. Give priority in execution of method chaining (e.g. here we need to give priority to sleepFirst, irrespective of its order.)
const LazyMan = (name, logFn)=>{
    logFn(`Hi, I'm ${name}.`)
    return []
}
Array.prototype.sleepFirst = function (time) {
    console.log(`Wake up after ${time} seconds.`)
    return this;
}

Array.prototype.eat = function (food){
    console.log(`Eat ${food}`)
    return this;
}

Array.prototype.sleep = function (second){
    console.log(`Wake up after ${second} seconds.`)
    return this;
}


LazyMan('Ashish', console.log).eat('apple').sleep(10).sleepFirst(20)

Current Output:

Hi, I’m Ashish.

Eat apple

Wake up after 10 seconds.

Wake up after 20 seconds.

Expected Output:

Wake up after 20 seconds.

Hi, I’m Ashish.

Eat apple

Wake up after 10 seconds.

Scroll Event Listener Not Working in Vue 3 Component

Question:

I’m working on a Vue 3 component where I want to add a scroll event listener to change the header’s style when the user scrolls down the page. However, the event listener doesn’t seem to work, and no console logs appear when I scroll.

Here is a simplified version of my code:

<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue';

const isScrolled = ref(false);

const handleScroll = () => {
  if (window.scrollY > 50) {
    isScrolled.value = true;
  } else {
    isScrolled.value = false;
  }
  console.log('isScrolled', isScrolled.value);
};

onMounted(() => {
  console.log('Mounted and adding scroll listener');
  window.addEventListener('scroll', handleScroll);
});

onUnmounted(() => {
  console.log('Removing scroll listener');
  window.removeEventListener('scroll', handleScroll);
});
</script>

Problem:

The scroll event listener is added in onMounted, but it doesn’t trigger when I scroll the page. There’s no console output, and the isScrolled value doesn’t change.

What I’ve Tried:

Verified that the component mounts correctly (logs appear in the console during mounting).
Simplified the event listener to just log to the console, but still no success.

Onchange for with size value

You can notice that if you put size into select – onchange stops working. There is “onfocus” even but it doesn’t work either because you have to click outside select every time.
Is there a way to make a working “onchange” event for select with size?

<select name="fruits" size="5">
  <option>banana</option>
  <option>cherry</option>
  <option>strawberry</option>
  <option>durian</option>
  <option>blueberry</option>
</select>