How can I access and match selected flavor options to create a custom product and add it to the cart in WordPress? [closed]

I’m working on a WordPress site and I need to create a feature where customers can choose from different flavors for a custom product. Once the customer selects their desired options, they should be able to add the customized product to their car and order the product of their own choice

I added this code, and it works perfectly, but I am stuck after selecting different flavors how can I access the entire product information? I need to get the data where the user selected the flavour and made a customized product.

I tried using custom JS and CSS.

nginx server after crash not able to access file [closed]

I have nodejs and reactjs project on nginx server in this server both project working well but suddenly all pm2 process are deleted now i have restart all thing and i am accessing file from react public folder previous it will work but after crash i am able to acccess previous file but not newly added i have also check that file permision which has 777 i am accessing like this

i have done this things:
restart nginx server
restart all pm2 process
reboot server
check permission for all file and also try to give 777 permission

so old file are access but newly added file after crash are not able to access

Vuex is not working on Laravel 10 and Vue Js 3

working with Laravel 10 and Vue Js 3 project as well and Installed Vuex 4 with the project. I have following comA.vue file

<template>
    <div>
        <h1>I am com A and the counter is : {{ $store.state.counter  }}</h1>
    </div>
</template>

and My store.js is

import { createStore } from 'vuex';

const store = createStore({
    state : {
        conuter : 1000, 
        deleteModalObj : {
            showDeleteModal: false, 
            deleteUrl : '', 
            data : null, 
            deletingIndex: -1, 
            isDeleted : false,

        }, 
        user: false, 
    }, 
    getters: {
        getCounter(state){
           return state.conuter
        }, 
       },

    mutations: {
        changeTheCounter(state, data){
            state.conuter += data
        }, 
        
    }, 
actions :{
        changeCounterAction({commit}, data){
            commit('changeTheCounter', data)
        }
    }

});

export default store;

but in my usecom.vue file counter not working and comA.vue enconted following error messege
Property '$store' does not exist on type '{ $: ComponentInternalInstance; $data: {}; $props: Partial<{}> & Omit<{} & VNodeProps &

how to fix this problem here?

How to disappear Proxy Auth Popup

chrome.webRequest.onAuthRequired.addListener(
    function(details, callbackFn) {
        // Fetch credentials dynamically
        getAuthCredentials().then(authCredentials => {
            callbackFn({
                authCredentials: {
                    username: authCredentials.username,
                    password: authCredentials.password
                }
            });
        }).catch(error => {
            console.error("Error fetching credentials: ", error);
            callbackFn(); // Proceed without credentials if there's an error
        });
    },
    { urls: ["<all_urls>"] }, // You can customize this for specific proxy URLs
    ['asyncBlocking']
);

I have a Proxy VPN Chrome extension built in pure JavaScript. Occasionally, when a user connects to a location, an authentication popup appears, although the connection remains active and works fine. I added the username and password using Chrome’s built-in callback, but the popup still shows up in rare cases. While it only appears once or twice, it’s still an issue for me. I’m trying to understand why this happens.

Please suggest a solution for removing this authentication popup? The connection works fine, but I want to hide the popup. If I can prevent it from appearing, my issue will be resolved. Is there a method to hide this built-in popup in a Chrome extension?

How to render a component in a fresh page in react app

I have all the components with me and the links were also working. Below is the code for App.jsx

import { useState } from 'react';
import Home from "./Components/Home";
import Secondquestion from "./Components/Secondquestion";
import Nextquestion from './Components/Nextquestion';
import {Link,Route, Routes } from 'react-router-dom'; 
import './App.css';

function App() {  
  return (
    <div>
      <ul>
        <li>
          <Link to="/home">Home</Link>
        </li>
        <li>
          <Link to="/next">Nextquestion</Link>
        </li>
        <li>
          <Link to="/second">Secondquestion</Link>
        </li>
      </ul>
      <Routes>
        <Route path="/home" element={<Home></Home>}></Route>
        <Route path="/next" element={<Nextquestion/>}></Route>
        <Route path="/second" element={<Secondquestion/>}></Route>
      </Routes>
    </div>
  );
}

export default App

code for main.jsx

import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import App from './App.jsx'
import { BrowserRouter } from 'react-router-dom'
import './index.css'

createRoot(document.getElementById('root')).render(
  <StrictMode>
    <BrowserRouter>
    <App />
    </BrowserRouter>
  </StrictMode>,
)

The links were working but it was rendering in the same page. But i want to get them in a fresh page. How to do that.

useNavigate inside Router but still throws error

I’m using useNavigate from react-router-dom to redirect users to different pages of website. I’m passing useNavigate as a prop to my Components so I can evaluate it later when user clicks on a button. all of my components are inside a BrowserRouter Component from react-router-dom but it still throws an error. here is my App component:

function App() {
  const navigate = useNavigate();
    return (
        <BrowserRouter>
            <main dir="rtl" lang="fa">
                <header>
                    <NavBar />
                </header>
                <Routes>
                    <Route index element={<ElectricalPanel onClick={() => navigate("efuse/")} />} />
                    <Route path="duct/" element={<Duct onClick={() => navigate("wiresho/")} />} />
                    <Route path="efuse/" element={<EFuse onClick={() => navigate("duct/")} />} />
                    <Route path="rail/" element={<Rail onClick={() => navigate("shemsh/")} />} />
                    <Route path="screw/" element={<Screw onClick={() => navigate("/")} />} />
                    <Route path="shemsh/" element={<Shemsh onClick={() => navigate("terminal/")} />} />
                    <Route path="slamp/" element={<SignalLamp onClick={() => navigate("screw/")} />} />
                    <Route path="terminal/" element={<Terminal onClick={() => navigate("slamp/")} />} />
                    <Route path="wiresho/" element={<WireSho onClick={() => navigate("rail/")} />} />
                </Routes>
            </main>
        </BrowserRouter>
    );
}

This is one of my components(all components have same/similar handleSubmit functions):

const Screw = ({onClick}) => {
    const [count, setCount] = useState(null);
    const handleSubmit = () => {
        onClick();
    }
    return (
        <div>
            <h1>پیچ</h1>
            <div className="fuse-container">
                <div
                    className="fuse-option"
                    onChange={(e) => setCount(parseInt(e.target.value))}
                >
                    <label htmlFor="count">تعداد بسته پیچ را وارد کنید:</label>
                    <input type="number" id="count" />
                </div>
            </div>
            <div>{count > 0 && <button onClick={handleSubmit}>تایید</button>}</div>
        </div>
    );
};

As you can see I have some Routes inside a Routes component inside a BrowserRouter Component. But it still says my navigate is not inside BrowserRouter.

How can I create this effect with Vue3? [closed]

I am trying to apply the effect shown in the image below on Vue3 but I was not successful. Can you help me? If it is in a way that I can see the js etc. logic or codes, I can translate it for Vue3 myself. It will work without transition buttons. I can set it to transition once a second.

enter image description here

How to get the information from the multiple API?

For an API url as below

const URL = "apiaddress.com/n"

where n is the number of posts and one number is added each time, how can I get the data?

I have an API as below:

const URL = "https://myapiaddress.com/1"

After some time, in addition to having the above API address and receiving information from it, I also want to receive information from the following API address:

const URL = "https://myapiaddress.com/2"

And so on

const URL = "https://myapiaddress.com/3"

And the information of each of these APIs is displayed on a separate page. The question is, can I get all of these in one file using fetch or do I have to call and fetch the API separately for each page?

Embedding ICC profile to an image

As usual, I’m displaying image thumbnails for uploaded files. Some uploaded images were in CMYK color, thus the color of generated thumbnail will be off because GD strips the color profile of the original image upon processing. This would not be a problem if ImageMagick is used for resampling the image, however the server that is hosting the project is limited to GD. So now I have to add the color profile back to the thumbnail image. The problem is, all the methods I can find involves using ImageMagick to embed the color profile. Is there a way of detecting and embedding color profiles (perhaps by editing the binary data?), or converting the image’s color space, without using third-party extensions? I’m also open to client-side Javascript workarounds that could restore the image color either by embedding the ICC profile or converting the color space of the image.

How to display a text into a HTML DIV tag [closed]

I am working on a project that requires text included within a HTML DIV tag to be displayed with the splitFlap effect, I found the following example in codepen, however I cannot replicate the example.

I have the following text into a HTML div:

<div class="do-splitflap">102.521,70TL</div>

from the URL:

https://codepen.io/filiz137/pen/gMNNyg

What is missing so that the text inside the div is displayed with the splitflap display effect?

I want to replicate the example, how ever I am getting an error.

The result I get is a continuous display of letters instead of the text that should be displayed. For example, the text that must be displayed is a four-digit shift number, for example 0056, but the flipflap effect is always present and does not stop.

enter image description here

After implementing Harsh’s recommendation:

enter image description here

Any guide to fix the error would be greatly appreciated,

Thanks,

Visual Glitch When Opening Menu in React + Ant Design Layout

I’m experiencing a visual glitch when opening the Menu component in my React application that uses Ant Design. Specifically, the issue occurs in a layout with a collapsible sidebar. Here is a brief overview of the relevant code and the problem:


const PageLayout: React.FC<LayoutProps> = (props: LayoutProps) => {
  // component code...
  
  return (
    <Layout>
      <Sider
        trigger={null}
        collapsible
        collapsed={collapsed}
        width={250}
        style={{
          position: windowWidth < 770 ? 'fixed' : 'sticky',
          display: collapsed && windowWidth < 770 ? 'none' : 'block',
        }}
        className="nav-side-bar"
      >
        <div className="btn-collapse-smallscreen">
          <Button
            type="text"
            icon={collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
            onClick={() => {
              dispatch(toggleCollapsed());
            }}
            className="btn btn-mobile"
          />
        </div>
        {!collapsed && (
          <div className="logo">
            <img src={Logo} alt="nora logo" width="100%" />
          </div>
        )}
        <Menu
          theme="light"
          style={{ background: '#ffff' }}
          mode="inline"
          onClick={handleRouteChange}
          selectedKeys={[location.pathname]}
          openKeys={openKeys}
          onOpenChange={handleOpenChange}
          items={routeUrl}
        />
      </Sider>

      <div className="main-content" style={{ width: '100%' }}>
        <Layout>
          <Header style={{ padding: 0, background: colorBgContainer }}>
            {/* Header content */}
          </Header>
          {breadCrumbs.length > 0 && (
            <div style={{ marginLeft: windowWidth < 770 ? '1rem' : '1.5rem' }}>
              <Space style={{ marginTop: 15, marginLeft: 15 }}>
                <Breadcrum itemList={breadCrumbs} />
              </Space>
            </div>
          )}

          <Content
            style={{
              margin: '24px 16px',
              padding: 24,
              height: '100vh',
              marginLeft: windowWidth < 770 ? '1rem' : '1.5rem',
              overflow: 'hidden',
              overflowY: 'scroll',
              overflowX: 'scroll',
              background: colorBgContainer,
              borderRadius: borderRadiusLG,
            }}
          >
            {children}
          </Content>
        </Layout>
      </div>
    </Layout>
  );
};

const MemoizedPageLayout = memo(PageLayout);
MemoizedPageLayout.displayName = 'PageLayout';

export default MemoizedPageLayout;

Issue: When the sidebar menu is closed and opened, there is a noticeable visual glitch on submenu of Entity.

What I’ve Tried:
Checking the conditionally rendered styles and ensuring they apply as expected.

Vuetify, v-data-table-virtual nested scroll bug

I’m trying to implement a virtual data table where when a row is clicked, it shows another embedded data table. However, with the row expanded, when you attempt to scroll the outer table, it gets stuck and keeps reloading the expanded row to the top…unless I’m doing something wrong…

this question also have in discord but not work
https://discord.com/channels/340160225338195969/954061264865349652/1237142832083632159
here is my playground

I tried to make style max height and also give item height, but scroll always return to top

Firebase Emulator: “Path segment cannot be empty” error when deploying Firestore/Storage rules

I’m running into an issue when trying to test Firestore and Storage rules locally using the Firebase Emulator Suite. I receive the following error:

⚠  Unexpected rules runtime error: java.lang.IllegalArgumentException: Path segment cannot be empty
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:151)
    at com.google.firebase.rules.runtime.utils.PathUtils.parse(PathUtils.java:129)
    ...
Error: Failed to send Cloud Storage rules request due to rules runtime not available.
error Command failed with exit code 1.

I’m trying to emulate Firestore and Cloud Storage with the following setup:
firebase.json:

{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "functions": {
    "predeploy": "npm --prefix "$RESOURCE_DIR" run build",
    "source": "functions",
    "runtime": "nodejs20"
  },
  "emulators": {
    "auth": {
      "port": 9099
    },
    "firestore": {
      "port": 8080
    },
    "functions": {
      "port": 5003
    },
    "storage": {
      "port": 9199
    },
    "ui": {
      "enabled": true,
      "port": 4000
    },
    "singleProjectMode": true
  },
  "storage": {
    "rules": "storage.rules"
  }
}

Firestore Rules (firestore.rules):

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /partners/{partnerID}/documents/{documentID} {
      allow read: if request.auth != null;
    }

    function canAccessPartner(partnerID) {
      return partnerID in request.auth.token.partners;
    }

    match /partners/{partnerID} {
      allow get, update: if canAccessPartner(partnerID);
    }
    
    // other rules...
  }
}

Storage Rules (storage.rules):

rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if request.auth != null;
    }
  }
}

Problem:
When I run my backend node.js I encounter the error Path segment cannot be empty when i try to use my frontend.
It seems like the error is being thrown when deploying or testing rules, but I can’t figure out where an empty path is being generated.
I’m using the Firebase Emulator Suite for local testing, and the UI is enabled on port 4000.
Additionally, I get this error: Error: read EIO, which might be related to Node.js or emulator issues.

What I Tried:
Verified that all path segments ({partnerID}, {documentID}) are not empty in my Firestore and Storage rules.
Reinstalled node_modules and cleaned the cache, thinking it could be a local environment issue.
Tried using both Node.js v18 (LTS) and v20 to see if it was a Node version compatibility issue.
Ran the emulator with detailed logs, but I couldn’t find any specific Firestore or Storage requests causing the issue.

Question:
What could be causing this “Path segment cannot be empty” error in my Firebase Emulator setup, and how can I debug or resolve this issue?
Is there anything wrong with my Firestore or Storage rules that could be triggering this error?
Could the issue be related to the emulator configuration or Node.js version?
Any help or insights would be greatly appreciated!

WheelEvent deltaX/Y and resulting scroll direction

I know this has been asked before but there’s no definitive answer on that question.

MDN says:

Even when the wheel event does trigger scrolling, the delta* values in the wheel event don’t necessarily reflect the content’s scrolling direction.

However, the spec says:

If a user agent scrolls as the default action of the wheel event then the sign of the delta SHOULD be given by a right-hand coordinate system where positive X, Y, and Z axes are directed towards the right-most edge, bottom-most edge, and farthest depth (away from the user) of the document, respectively.

And the full-page example in this question that reported the opposite behaviour in Edge seems to now give expected sign of delta* suggesting it indeed was a bug that was fixed in Edge.

Also, on a discussion about this on Bugzilla, a comment by a representative, suggests that the spec is clear and that the sign of delta* should indeed indicate the direction of the resulting (if any) scroll event in the expected way (negative deltaX means left, positive means right; negative deltaY means down, positive means up).

So my questions are:

  • Why does the MDN page says that the sign of the delta* values doesn’t necessarily reflect scrolling direction? Am I misunderstanding what they mean in the sentence above? Is it because the spec says “SHOULD” rather than “MUST”?
  • As developers, can we safely assume that signs of delta* reflect the direction of the would-be scroll action? gsap seems to assume this