I’m using LightningChart JS to display live spectrogram using HeatmapScrollingGridSeriesIntensityValues.
I am drawing rectangles on the live heatmap using RectangleSeries, I want to make the rectangle corners round.
Is there a way to do it?
Thanks
Blancer.com Tutorials and projects
Freelance Projects, Design and Programming Tutorials
Category Added in a WPeMatico Campaign
I’m using LightningChart JS to display live spectrogram using HeatmapScrollingGridSeriesIntensityValues.
I am drawing rectangles on the live heatmap using RectangleSeries, I want to make the rectangle corners round.
Is there a way to do it?
Thanks
Im trying to build a Title component that takes in a text prop that gets split using the text.split(” “) JS method. This array of words is then looped over and rendered in wathever heading tag that gets passed to the component. The issue is when the loop renders the title there is no spacing in between words. But when i manualy put the divs inside the tag the spacing is there. Am I missing something or is this intended behavior?
The components in use:
<Title
Tag="h2"
text="This is an example"
/>
And the component code with the loop:
---
interface Props {
Tag: string
text: string
class?: string
line?: boolean
highlight?: number[]
}
const { Tag, text, class: className, line, highlight } = Astro.props
const splitTitle = text.split(" ")
---
<Tag class:list={["c-title", className]}>
{splitTitle.map((word, index) => <div>{word}</div>)}
</Tag>
<style is:global lang="scss">
.c-title {
--title-color: var(--scheme-contrast);
color: var(--title-color);
div {
display: inline-block;
}
}
</style>
renders to this:
Thisisanexample
And the component code without the loop:
---
interface Props {
Tag: string
text: string
class?: string
line?: boolean
highlight?: number[]
}
const { Tag, text, class: className, line, highlight } = Astro.props
const splitTitle = text.split(" ")
---
<Tag class:list={["c-title", className]}>
<div>This</div>
<div>is</div>
<div>an</div>
<div>example</div>
</Tag>
<style is:global lang="scss">
.c-title {
--title-color: var(--scheme-contrast);
color: var(--title-color);
div {
display: inline-block;
}
}
</style>
renders the intended behavior:
This is an example
The rendered DOM for both methods is the exact same so I don’t get why it would behave differently.
fetchFileApi(src).then((response: AxiosResponse) => {
try {
const blob = new Blob([response.data], {
type: response.headers["content-type"],
});
const imageUrl = URL.createObjectURL(blob);
setImageSrc(imageUrl);
} catch (error) {
console.log(error);
}
});
I’ve checked that it works well with fetching the image data with fetchFileApi.
I guess something goes wrong when getting blob.
What should I do to work this well?
The sourceURL property is set automatically by Chrome. Is it possible to override this and set it to a different value?
For debugging, I’d like to set sourceURL to a specific value. But I don’t even know if it is possible to affect the clipboard content before “Startfragment”.
I made such a code, everything works correctly in Visual Studio Code, when transferring it to the LeetCode interpreter, it gives completely different results, why can this be?Thanks in advance for the reply.Link to the task:task
var addTwoNumbers = function(l1, l2) {
// I determine the largest array of the two, then I will add the overall result to it
let big_array = (l1.length == l2.length) ? l1 : (l1.length>l2.length) ? l1 : l2
let small_array = (l1.length == l2.length) ? l2 : (l1.length>l2.length) ? l2 : l1
for(let i = 0; i < big_array.length ; i++){
// I iterate over the array numbers and add them together in the big_array array.
if(small_array[i] != undefined) big_array[i] += small_array[i]
if(big_array[i] >= 9 && i == big_array.length-1){
/*
If the number in a certain place is greater than 0, then I will create a new array element in front of it, into which dozens from the previous element were stuffed and reduce it by these tens*10
*/
big_array.push((big_array[i] - (big_array[i] % 10))/10)
big_array[i] = big_array[i] % 10
} else if(big_array[i] >= 9){
// It's a similar procedure, but I won't create a new element, I'll just add it to an existing one
big_array[i+1] += ((big_array[i] - (big_array[i] % 10))/10)
big_array[i] = big_array[i] % 10
}
}
return big_array
};
console.log("First test ",addTwoNumbers([2,4,3],[5,6,4]))
console.log("Second test ",addTwoNumbers([0],[0]))
console.log("Third test: ",addTwoNumbers([9,9,9,9,9,9,9],[9,9,9,9]) )
My Results in VSC and LeetCode
VSC
LeetCode testing
I tried to edit the code somehow and so on. I expect that everything will work the same way as I have in Visual Studio.
i didnt find where to change these where the Username and Password are i didnt find em on the code
i looked in the register-doctor.html but i didnt find anything, i have looked in the python code too and nothing
{% load static %}
<!DOCTYPE html>
<html lang="en">
<!-- doccure/doctor-register.html 30 Nov 2019 04:12:15 GMT -->
<head>
<meta charset="utf-8" />
<title>Cure</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=0"
/>
<!-- Favicons -->
<link
type="image/x-icon"
href=" {% static 'HealthStack-System/images/Normal/Cure-noBG-icon.png' %}"
rel="icon"
/>
<!-- Bootstrap CSS -->
<link
rel="stylesheet"
href="{% static 'HealthStack-System/css/Normal/bootstrap.min.css' %}"
/>
<!-- Fontawesome CSS -->
<link
rel="stylesheet"
href="{% static 'HealthStack-System/plugins/Normal/fontawesome/css/fontawesome.min.css' %}"
/>
<link
rel="stylesheet"
href="{% static 'HealthStack-System/plugins/Normal/fontawesome/css/all.min.css' %}"
/>
<!-- Main CSS -->
<link
rel="stylesheet"
href="{% static 'HealthStack-System/css/Normal/style.css' %}"
/>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="assets/js/html5shiv.min.js"></script>
<script src="assets/js/respond.min.js"></script>
<![endif]-->
</head>
<body class="account-page">
<!-- Main Wrapper -->
<div class="main-wrapper">
<!-- Header -->
<header class="header">{% include 'navbar_home.html' %}
</header>
<!-- /Header -->
<!-- Page Content -->
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-8 offset-md-2">
<!-- Account Content -->
<div class="account-content">
<div class="row align-items-center justify-content-center">
<div class="col-md-7 col-lg-6 login-left">
<img
src="{% static 'HealthStack-System/images/Normal/login-banner.png' %}"
class="img-fluid"
alt="Login Banner"
/>
</div>
<div class="col-md-12 col-lg-6 login-right">
<div class="login-header">
<h3>
Inscription du médecin
<a href="{% url 'patient-register' %}">Pas un médecin?</a>
</h3>
</div>
<!-- Register Form -->
<form action="{% url 'doctor-register' %}" method="POST">
{% csrf_token %}
{% include 'message.html' %}
{% comment %} {% if messages %}
<ul class="messages">
{% for message in messages %}
<li {% if message.tags %} class="{{ message.tags }}" {% endif %}>{{ message }}</li>
{% endfor %}
</ul>
{% endif %} {% endcomment %}
{% for field in form %}
<div class="form-group form-focus">
{{field}}{{ field.errors }}
<label class="focus-label">{{ field.label }}</label>
</div>
{% endfor %}
<div class="text-right">
<a class="forgot-link" href="{% url 'doctor-login'%}"
>Vous avez déjà un compte?</a
>
</div>
<button
class="btn btn-primary btn-block btn-lg login-btn"
type="submit"
>
S'inscrire
</button>
</form>
<!-- /Register Form -->
</div>
</div>
</div>
<!-- /Account Content -->
</div>
</div>
</div>
</div>
<!-- /Page Content -->
<!-- Footer -->
{% include 'footer.html' %}
<!-- /Footer -->
</div>
<!-- /Main Wrapper -->
<!-- jQuery -->
<script src="{% static 'HealthStack-System/js/Normal/jquery.min.js' %}"></script>
<!-- Bootstrap Core JS -->
<script src="{% static 'HealthStack-System/js/Normal/popper.min.js' %}"></script>
<script src="{% static 'HealthStack-System/js/Normal/bootstrap.min.js' %}"></script>
<!-- Custom JS -->
<script src="{% static 'HealthStack-System/Outside_assets/js/script.js' %}"></script>
{% if messages %}
<script>
{% for message in messages %}
$(document).ready(function () {
$('.toast').toast('show');
});
{% endfor %}
</script>
{% endif %}
</body>
</html>
I am trying to use javascript to set a url path to use with a variable but the path for my image is behaving strangely.
The path used for the src attribute produces empty images but the one used inside tailwind and others like it work fine. This problem also applies with using the style attribute, so I doubt its src attribute, style attribute or the path at fault. The src attribute also works with absolute link to images online, but it is just relative links that do not work.
The content of each subpage isn’t showing up on the webpage. It seems to be a routing problem where the linking of the page to the app.js isn’t done correctly. I’ve tried a few variations with changing the name of the subpages and with the routing, still stuck.
Here’s the App.js
import Home from './pages/Home.js'
import Dashboard from './pages/Dashboard.js'
import OnBoarding from './pages/OnBoarding.js'
import { BrowserRouter , Routes , Route} from 'react-router-dom'
const App = () => {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<Home/>}/>
<Route path="/dashboard" element={<Dashboard/>}/>
<Route path="/onboarding" element={<OnBoarding/>}/>
</Routes>
</BrowserRouter>
)
}
export default App
index.js
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
)
Home.js:
import Nav from '../components/Nav'
const Home = () => {
const authToken= true
const handleClick = () => {
console.log('clicked')
}
return (
<>
<Nav/>
<div className="home" >
<h1>Swipe Right</h1>
<button className="primary-button" OnClick={handleClick}>
{authToken ? 'Signout' : 'Create Account'}
</button>
</div>
</>
)
}
export default Home
Dashboard.js:
const Dashboard = () => {
return (
<div>Dashboard</div>
)
}
export default Dashboard
Onboarding.js:
const OnBoarding = () => {
return (
<div> Onboarding </div>
)
}
export default OnBoarding
I’m new to react and this is my first project. Thank you for your help in advance.
My KafkaConfig.js
const { Kafka, Partitioners} = require('kafkajs');
class KafkaConfig {
constructor() {
this.kafka = new Kafka({
clientId: "BOOKING_SERVICE",
brokers: ['127.0.0.1:39092', '127.0.0.1:29092'],
});
this.producer = this.kafka.producer({ createPartitioner: Partitioners.LegacyPartitioner});
this.consumer = this.kafka.consumer({ groupId: "test-group" });
this.consumerRunning = false;
}
async produce(messages, topic) {
try {
await this.producer.connect();
await this.producer.send({
topic: topic,
messages: [{ value: messages }],
});
} catch (error) {
console.error(error);
} finally {
await this.producer.disconnect();
}
}
async consume(callback) {
try {
await this.consumer.connect();
await this.consumer.subscribe({ topics: ['driver_history', 'Booking_Modal', 'Drivers_stats', 'DRIVER_GPS_DATA'], fromBeginning: true });
await this.consumer.run({
eachMessage: async ({ topic, partition, message }) => {
const value = JSON.parse(message.value);
callback(value);
},
});
} catch (error) {
console.error(error);
}
}
}
module.exports = { KafkaConfig };
I am trying to use it like this but its trying to connect, subscribe and running a new consumer in every new request to /bookingSSE which leads to errors
router.get("/bookingSSE", (req, res) => {
if (!bookingId) {
res.status(400).send("Error: bookingId parameter is missing.");
return;
}
res.setHeader("Content-Type", "text/event-stream");
res.setHeader("Cache-Control", "no-cache");
res.setHeader("Connection", "keep-alive");
res.write(`data: Connected!!nn`);
kafkaConfig.consume((value) => {
console.log(value);
if (value.documentKey && value.documentKey._id === bookingId) {
console.log('YES THE CHANGE IS BELONGS TO THIS USER');
res.write(`data: ${JSON.stringify(value)}nn`);
}
});
req.on("close", () => {
console.log("Client connection closed.");
});
});
I want to run only one Kafka consumer to listen to all messages. Regardless of the number of clients connected to my SSE endpoint, I want to ensure that only one Kafka consumer is utilized. Every user should use this single Kafka consumer.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Question Form Generator</title>
<style>
label {
display: block;
margin-bottom: 10px;
}
#timer {
position: fixed;
top: 10px;
right: 10px;
background-color: white;
padding: 5px;
border: 1px solid #ccc;
border-radius: 5px;
}
</style>
</head>
<body>
<h1>Question Form Generator</h1>
<div id="formContainer">
<label for="numQuestions">Number of Questions:</label>
<input type="number" id="numQuestions" min="1">
<br>
<label for="timeLimit">Time Limit (in minutes):</label>
<input type="number" id="timeLimit" min="1">
<br>
<button onclick="generateForm()">Generate Form</button>
</div>
<script>
var timerInterval;
function generateForm() {
var numQuestions = parseInt(document.getElementById("numQuestions").value);
var timeLimit = parseInt(document.getElementById("timeLimit").value);
var formContainer = document.getElementById("formContainer");
formContainer.innerHTML = "";
for (var i = 1; i <= numQuestions; i++) {
var questionDiv = document.createElement("div");
questionDiv.innerHTML = "<h3>Question " + i + "</h3>";
var questionTypeSelect = document.createElement("select");
questionTypeSelect.name = "questionType" + i;
questionTypeSelect.innerHTML = `
<option value="single">Single Correct</option>
<option value="multiple">Multiple Correct</option>
<option value="integer">Integer/Numerical Type</option>
<option value="matrix">Matrix Match</option>
`;
questionDiv.appendChild(questionTypeSelect);
formContainer.appendChild(questionDiv);
}
var generateFormButton = document.createElement("button");
generateFormButton.textContent = "Generate Question Form";
generateFormButton.onclick = generateQuestionForm;
formContainer.appendChild(generateFormButton);
// Start the timer after generating the question form
startTimer(timeLimit);
}
function generateQuestionForm() {
var formContainer = document.getElementById("formContainer");
var questionDivs = formContainer.getElementsByTagName("div");
var formHTML = "";
for (var i = 0; i < questionDivs.length; i++) {
var questionTypeSelect = questionDivs[i].querySelector("select");
var questionType = questionTypeSelect.value;
formHTML += "<h3>Question " + (i + 1) + "</h3>";
if (questionType === "single") {
formHTML += '<label><input type="radio" name="question' + (i + 1) + '" value="a"> A</label>';
formHTML += '<label><input type="radio" name="question' + (i + 1) + '" value="b"> B</label>';
formHTML += '<label><input type="radio" name="question' + (i + 1) + '" value="c"> C</label>';
formHTML += '<label><input type="radio" name="question' + (i + 1) + '" value="d"> D</label>';
} else if (questionType === "multiple") {
formHTML += '<label><input type="checkbox" name="question' + (i + 1) + '" value="a"> A</label>';
formHTML += '<label><input type="checkbox" name="question' + (i + 1) + '" value="b"> B</label>';
formHTML += '<label><input type="checkbox" name="question' + (i + 1) + '" value="c"> C</label>';
formHTML += '<label><input type="checkbox" name="question' + (i + 1) + '" value="d"> D</label>';
} else if (questionType === "integer") {
formHTML += '<label>Enter Answer: <input type="number" name="question' + (i + 1) + '" step="0.01"></label>';
} else if (questionType === "matrix") {
var table = '<table border="1">';
for (var j = 1; j <= 4; j++) {
table += '<tr>';
for (var k = 1; k <= 4; k++) {
table += '<td><input type="checkbox" name="question' + (i + 1) + '_row' + j + '" value="' + k + '"></td>';
}
table += '</tr>';
}
table += '</table>';
formHTML += table;
}
}
formContainer.innerHTML = formHTML;
var submitButton = document.createElement("button");
submitButton.textContent = "Submit";
submitButton.onclick = submitForm;
formContainer.appendChild(submitButton);
}
function disableFormInputs() {
var inputs = document.querySelectorAll('input, select');
inputs.forEach(function(input) {
input.disabled = true;
});
}
function submitForm() {
clearInterval(timerInterval); // Stop the timer
displayResponses();
var submitButton = document.querySelector('button');
submitButton.style.display = 'none'; // Hide the submit button
}
function displayResponses() {
var responseContainer = document.createElement("div");
responseContainer.innerHTML = "<h2>Participant Responses</h2>";
var formContainer = document.getElementById("formContainer");
var questionDivs = formContainer.getElementsByTagName("div");
console.log(questionDivs.length);
for (var i = 0; i < questionDivs.length; i++) {
var questionTypeSelect = questionDivs[i].querySelector("select");
var questionType = questionTypeSelect.value;
var response = "<p><strong>Question " + (i + 1) + ":</strong><br>";
if (questionType === "single") {
var selectedOption = formContainer.querySelector('input[name="question' + (i + 1) + '"]:checked');
response += selectedOption ? selectedOption.value.toUpperCase() : "DID NOT ATTEMPT";
} else if (questionType === "multiple") {
var selectedOptions = formContainer.querySelectorAll('input[name="question' + (i + 1) + '"]:checked');
if (selectedOptions.length > 0) {
selectedOptions.forEach(function(option) {
response += option.value.toUpperCase() + ", ";
});
response = response.slice(0, -2); // Remove the last comma and space
} else {
response += "DID NOT ATTEMPT";
}
} else if (questionType === "integer") {
var enteredValue = formContainer.querySelector('input[name="question' + (i + 1) + '"]').value;
response += enteredValue ? enteredValue : "DID NOT ATTEMPT";
} else if (questionType === "matrix") {
response += "Matrix Match Response:<br>";
for (var j = 1; j <= 4; j++) {
var rowName = String.fromCharCode(65 + j - 1); // Convert to letters A, B, C, D
var matchFound = false;
for (var k = 1; k <= 4; k++) {
if (document.querySelector('input[name="question' + (i + 1) + '_row' + rowName + '"]:nth-of-type(' + k + ')').checked) {
response += rowName + " -> " + k + "<br>";
matchFound = true;
break;
}
}
if (!matchFound) {
response += rowName + " -> DID NOT ATTEMPT<br>";
}
}
}
response += "</p>";
responseContainer.innerHTML += response;
}
formContainer.innerHTML = responseContainer.innerHTML;
}
function startTimer(duration) {
var timer = duration * 60,
minutes, seconds;
timerInterval = setInterval(function () {
minutes = parseInt(timer / 60, 10);
seconds = parseInt(timer % 60, 10);
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
document.getElementById('time').textContent = minutes + ":" + seconds;
if (--timer < 0) {
timer = duration * 60;
alert("Time's up! Your responses will no longer be accepted.");
submitForm(); // Automatically submit the form when time is up
}
}, 1000);
}
</script>
<div id="timer">Time Remaining: <span id="time">--:--</span></div>
</body>
</html>
My question : After the submit is clicked in the Question UI page, the participant responses is empty. questionDiv.length is also coming as 0 in the console while debugging. What am I missing here?
context: this is the UI of an exam attempting thing I need and the way I am collecting responses is through iterating the entire page and collecting the responses but that is showing 0 divs collected why so.
Sorry for the possibly stupid question, but I’m stuck
I have two files app.jsx and header.jsx. In header.jsx i have nav-bar with navigation panel with links to sections that are located in app.jsx. And when we click on these links in nav-bar, the page will vertical scroll to the desired section. When we scroll vertically through the page and reach a certain section, the link in the navigation bar is assigned the active class. But I need the active section to automatically horizontal scroll in the navigation bar. How to implement this?
Application screenshot:enter image description here
app.jsx
import { useEffect } from 'react';
import Header from './Components/Header/Header';
function App() {
return (
<>
<div className='header__container'>
<Header/>
</div>
<section id='section1' className='title__categories'>Breakfast</section>
<section id='section2' className='title__categories'>Burgers</section>
<section id='section3' className='title__categories'>Salads</section>
</>
)
}
header.jsx
import React, { useEffect, useState } from 'react';
import './Header.css';
const Header = () => {
const [activeLink, setActiveLink] = useState('');
useEffect(() => {
const sections = ['section1','section2','section3','section4','section5','section6',
'section7','section8','section9','section10','section11','section12'];
const handleScroll = () => {
const currentScrollPosition = window.scrollY;
for (let i = 0; i < sections.length; i++) {
const section = document.getElementById(sections[i]);
if (section && currentScrollPosition < section.offsetTop) {
setActiveLink(`link${i}`);
break;
}
}
};
document.addEventListener('scroll', handleScroll);
return () => document.removeEventListener('scroll', handleScroll);
}, []);
return (
<div className='header'>
<a href='#section1' className={activeLink === 'link1' ? 'active' : 'nav-bar'}>Breakfast</a>
<a href='#section2' className={activeLink === 'link2' ? 'active' : 'nav-bar'}>Burgers</a>
<a href='#section3' className={activeLink === 'link3' ? 'active' : 'nav-bar'}>Salads</a>
</div>
);
};
export default Header;
i have wrote a blog using quill editor. and everything was fine.. but after extracting the whole blog in the string form.. i wanted to display the whole blog in their respected pages..
{{% blog.content | safe %}}
whole style of quill is not working for my blog…
all the style went blank(not-working) and all the content comes at left side..
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"
integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/remixicon/4.2.0/remixicon.css"
integrity="sha512-OQDNdI5rpnZ0BRhhJc+btbbtnxaj+LdQFeh0V9/igiEPDiWE2fG+ZsXl0JEH+bjXKPJ3zcXqNyP4/F/NegVdZg=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<!-- Include stylesheet -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/quill.snow.css" rel="stylesheet" />
<link rel="stylesheet" href="{% static 'css/style.css' %}" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/quill.js"></script>
quill style and js are working fine for rich text editor but it is not working for the blog page.
I am going to merge the React website with the Next.js website and getting title error in console and terminal this is the error:
index.js:683 Uncaught Error: Page “/[[…slug]]/page” is missing param “/” in “generateStaticParams()”, which is required with “output: export” config. at DevServer.renderToResponseWithComponentsImpl (file://F:NEXT.JSvpatomicnode_modulesnextdistserverbase-server.js:1032:27)
This is what I followed a document Migrating from Create React App in react src folder I created a app folder In app folder I created layout.js and [[…slug]] folder in [[…slug]] folder created client.js and page.js file.
client.js:
import dynamic from "next/dynamic";
const App = dynamic(() => import("../../App"), { ssr: false });
export function ClientOnly() {
return <App />
page.js:
import { ClientOnly } from "./client";
export function generateStaticParams() {
return [{ slug: [""] }];
}
export default function Page() {
return <ClientOnly />;
}
and app.js:
import "./index.css";
import "./Apps.css";
import { Routes, Route } from "react-router-dom";
import Home from "./Pages/Home";
import AboutUs from "./Pages/AboutUs";
import ContactUs from "./Pages/ContactUs";
import Services from "./Pages/Services";
import Blog from "./Pages/Blog";
import NavBar from "./Components/NavBar";
import ServicesSingle from "./Services/ServicesSingle";
import Footer from "./Components/Footer";
// import ScrollToTop from "./Components/ScrollToTop";
import ThankYou from "./Components/ThankYou";
import { Helmet } from "react-helmet";
import Error from "./Components/404";
const App = () => {
return (
<>
{/* <ScrollToTop /> */}
<NavBar />
<Helmet>
<title>Home</title>
<meta name="description" content="All About VPAtomic" />
</Helmet>
<div className="app-main">
<Routes>
<Route exact path="/" element={<Home />} />
<Route exact path="/About-us" element={<AboutUs />} />
<Route exact path="/Contact-us" element={<ContactUs />} />
<Route exact path="/Contact-us/thank-you" element={<ThankYou />} />
<Route exact path="/Services" element={<Services />} />
<Route exact path="/Blog" element={<Blog />} />
<Route
exact
path="/Services/:serviceId"
element={<ServicesSingle />}
/>
<Route exact path="*" element={<Error />} />
</Routes>
</div>
<Footer />
</>
);
};
export default App;
next.config.mjs:
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
distDir: "./dist",
};
export default nextConfig;
how to solve this error ?
I am using PayPal sandbox to play with the payment method.
I have an order component that has the configuration for the button render. I have created a script tag on index.html with my client’s ID too.
This is the code inside the order component that has the config for the button and the button that takes you to PayPal’s popup window.
const paypal = useRef()
useEffect(() => {
window.paypal
.Buttons({
createOrder: (data, actions, err) => {
return actions.order.create({
intent: "CAPTURE",
purchase_units: [
{
description: "Cool looking table",
amount: {
currency_code: "USD",
value: 650.0,
},
},
],
});
},
onApprove: async (data, actions) => {
const order = await actions.order.capture();
console.log(order);
},
onError: (err) => {
console.log(err);
},
})
.render(paypal.current);
}, [])
return(
.
.
.
<div ref={paypal}></div>
...)
On the PayPal popup window, I manage to successfully login then very briefly get the pay button before it abruptly goes away and then I get this message.
“We are unable to process your payments using your PayPal account at this time. Please return to the merchant and try to use another payment method.”
After inspecting elements, it seems there is an error on the popup window where PayPal is creating a script tag that adds an event listener on an element that doesn’t exist and it’s returning an undefined error.
<script nonce>
if ('undefined') {
document.getElementById('cancelLink').addEventListener('click', function() {
window.close()
})
}
Attempting to make a connect 4 game. Currently trying to work on the vertical win condition:
for (let i = 0; i < columns; i++) {
let currentColumn = [];
for (let j = 0; j < rows; j++) {
currentColumn.push(board[j][i]);
//tried to check what prints here due to error
console.log(j, i);
}
if (currentColumn.includes(currentPlayer) && currentColumn.length >= 4) {
gameOver = true;
displayWinner();
break;
}
}
Getting the error after piece is placed on board as this function is called to check for a winner.
Tried to update my playPiece() function to include
const indexRow = [...columnCell].indexOf(lowestCell);
board[indexRow][index] = currentPlayer;
But this just gives me the same error but at an earlier line.
Feel like I’ve attempted everything my brain can think of right now.
Let me know if you need to see any additional code for more information, I assume this would be needed but didn’t want to post everything at once.