Twilio Conversations twilsock.InitRegistration() is not a constructor

Given this, im getting this output…

import { Client } from '@twilio/conversations';

... crap....

this.client = new Client(this.token);
      this.client.on('stateChanged', state => {
        if (state === 'initialized') {
          this.ready = true;
          this.emitter.emit('ready');

... more stuff....
browser.js?edd1:6945 Uncaught (in promise) TypeError: twilsock.InitRegistration is not a constructor
at new Client (browser.js?edd1:6945:1)
at _class._createSuperInternal (browser.js?7253:148:1)
at new _class (browser.js?7253:239:1)
at eval (TwilioProvider.js?d6b9:149:1)
at new Promise (<anonymous>)
at TwilioProvider.start (TwilioProvider.js?d6b9:135:1)
at eval (start.js?e8a3:39:1)
at Object.eval [as dispatch] (index.js?4dd3:11:1)
at dispatch (<anonymous>:10607:80)
at eval (redux.js?a67e:483:1)

I’ve stopped the debugger at that line and this is the value of twilsock on that line… any suggestions?

debug value

If, else not setting value as expected [duplicate]

I’ve written some basic JS to set the value of a field if the conditions have been met but I’m finding that the first two lines work i.e. the value sets as I expect but condition 3 and 4 default to conditions 1 and 2 respectively.

So, if all the conditions of the first line are met then the field ‘le_queue’ is set to Office 1 – Cash but if all the conditions of line 3 are met then then value of the ‘le_queue’ is not set to Office 1 – Client Cash but instead set to the value stated in line 1

if ('sel_paybasis',label === 'Section 12'&&'sel_paymethod',label === 'Cash'&&'sel_payoffice',label === 'Office 1') 
    {
        KDF.setVal('le_queue','Office 1 - Cash');
    }
    else if ('sel_paybasis',label === 'Section 17a'&&'sel_paymethod',label === 'Cash'&&'sel_payoffice',label === 'Office 2') 
    {
        KDF.setVal('le_queue','Office 2 - Cash');
    }
    else if ('sel_paybasis',label === 'Corporate Appointee'&&'sel_paymethod',label === 'Cash'&&'sel_payoffice',label === 'Office 1) 
    {
        KDF.setVal('le_queue','Office 1 - Client Cash');
    }
    else if ('sel_paybasis',label === 'Corporate Appointee'&&'sel_paymethod',label === 'Cash'&&'sel_payoffice',label === 'Office 2') 
    {
        KDF.setVal('le_queue','Office 2 - Client Cash');
    }
    else 
        KDF.setVal('le_queue','');

Checking between time range

I’m stuck on solving this.

On my database I have a field of start time and end time, some goes overnight so it would look like 20:00 – 05:00 and some are 01:00 – 13 :00

Are there any built in function on this on jquery?
I’ve been having problems with nested ifs on this one.

Why my secont event listerner won’t work after the first one

So I have a profile page and there is an edit button, when I click the edit button you can edit the information on the page, the thing is the second event listener won’t work, when I click the button done which is appeared after clicking the edit button, nothing changes

editButton.addEventListener('click', e => {
  textBox.removeAttribute('readonly');
  textArea.removeAttribute('readonly');
  textBox.style.borderBottom = '1px gray solid';
  pwbox.style.display = "flex";
  doneButton.style.display = "block";
  editButton.style.display = 'none';
  dateBox.style.display = "none";
});

doneButton.addEventListener('click', e => {
  textBox.setAttribute("readonly");
  textBox.style.removeProperty('background color');
  textBox.style.removeProperty('border-bottom');
  pwbox.style.display = "none";
  doneButton.style.display = "none";
  editButton.style.display = 'block';
  dateBox.style.display = "flex";
});
<div class="infobox">
  <input type="text" name="uname" class="uname txt-box" value="<?php echo $usersName ?>" readonly autocomplete="off">
  <input type="text" name="email" class='email' value="<?php echo $usersEmail ?>" readonly>
  <div class="pw-box">
    <label for="password">Password</label>
    <input type="password" name="password" class="password">
    <label for="confirmPassword">Confirm Password</label>
    <input type="password" name="conf-password" class="conf-password">
  </div>
  <div class=" date-joined">
    <small>Date Joined</small>
    <div>01/01/01</div>
  </div>

</div>
<div class="description-box">

  <textarea name="description" class="description" cols="30" rows="10" placeholder="Let me describe you!" readonly></textarea>
  <button class='edit-btn'>Edit</button>
  <button class="done-btn">Done</button>

</div>

How do I access the values of JS Objects by keys without storing in a variable?

So, I ran into a weird bug in javascript.

const obj1 = await chartService.callAPIConversion({ unix_timestamp: Math.floor(activity[0].createdAt.getTime() / 1000) })

console.log(obj1.usd_price);
//THIS WORKS -> returns proper value

console.log(await (chartService.callAPIConversion({ unix_timestamp: Math.floor(activity[0].createdAt.getTime() / 1000) })).usd_rate);
//THIS DOESNOT WORK -> returns undefined

Why am I not able to get the key without using a variable?

Apply caption/text to a container outside of JS carousel using data attr?

I have a carousel, currently Keen Slider JS – open to changing if what I’m after is easier to achieve with another plugin or simple/custom JS.

Basically I want a simple fading carousel that autoplays and loops (might add left/right arrows later), has a caption for each slide and numbered fraction pagination. For example “1 / 5” to indicate what slide we’re on.

Due to my layout (see CodePen) I thought might be best achieved using a data attribute as I want to display the caption and pagination outside/way from the carousel. Ideally the text fading slightly as it changes.

Open to other solutions but this is the only way I could think of it working with the caption outside of the slider/plugin?

I have added my code into the post but it doesn’t display very well so it might be best checking the CodePen: https://codepen.io/moy/pen/KKywKXN

Also, if you spot my really high value of 5000000 for the duration of the fade …it doesn’t seem to do anything no matter what value I add? Any idea why?

Thanks in advance!

var slider = new KeenSlider("#my-keen-slider", {
   loop: true,
   defaultAnimation: {
      duration: 500000
   },
   detailsChanged: (s) => {
      s.slides.forEach((element, idx) => {
         element.style.opacity = s.track.details.slides[idx].portion
      })
   },
   renderMode: "custom"
})
html {
  background: white;
  font-size: 62.5%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: white;
  -webkit-text-size-adjust: 100%;
}

/**
 * Base `body` styling.
 */
 
body {
  background-color: transparent;
  color: black;
  font-variant-ligatures: common-ligatures discretionary-ligatures historical-ligatures;
  font-size: 1.8rem;
  font-weight: 500;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  text-rendering: optimizeLegibility;
}

h1 {
  font-size: 3.6rem;
  font-weight: inherit;
  line-height: 1;
  margin: 0 0 24px;
  padding: 0;
}

p {
  margin: 0 0 24px;
  padding: 0;
}

img {
  border: 2px solid black;
  height: auto;
  max-height: 100%;
  width: auto;
  max-width: 100%;
}

.grid__item {
  box-sizing: border-box;
  padding: 24px 24px 0;
}

.gallery {
  box-sizing: border-box;
}

.grid__item-footer {
  display: flex;
  margin-top: auto;
}
.grid__item-footer p {
  display: flex;
  align-items: center;
  flex: 1 1 0%;
}

.grid__item-footer .align-right {
  justify-content: flex-end;
}

@media only screen and (min-width: 1000px) {
  .grid {
    background-color: black;
    display: grid;
    grid-column-gap: 2px;
    grid-template-columns: repeat(12, 1fr);
    height: 100vh;
    margin: 0 64px;
  }

  .grid__item {
    background-color: white;
    display: flex;
    flex-direction: column;
    grid-column: span 6;
    height: 100vh;
  }

  .grid__item-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    margin-bottom: 24px;
    overflow: hidden;
    width: 100%;
  }

  .grid__item-main--gallery {
    box-sizing: border-box;
    align-items: center;
    justify-items: center;
    align-self: center;
    justify-self: center;
    text-align: center;
    overflow: hidden;
  }

  .gallery {
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
  }

  .gallery__inner {
    box-sizing: border-box;
    height: 100%;
    width: auto;
  }

  .grid__item-footer {
    border-bottom: 2px solid black;
    box-sizing: border-box;
    height: 64px;
    padding: 0 24px;
    position: fixed;
    bottom: -64px;
    left: 0;
    transform: rotate(-90deg);
    transform-origin: top left;
    width: 100vh;
  }
  .grid__item-footer p {
    margin-bottom: 0;
  }

  .grid__item--gallery {
    padding: 24px;
  }
  .grid__item--gallery .grid__item-main {
    height: 100%;
    margin-bottom: 0;
  }
  .grid__item--gallery .gallery {
    height: 100%;
  }
  .grid__item--gallery .grid__item-footer {
    left: auto;
    right: 0;
    transform: rotate(90deg);
    transform-origin: top right;
  }

  img {
    box-sizing: border-box;
    height: auto;
    max-height: 100%;
    width: auto;
  }

  img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: unset;
  }
}
/* Carousel CSS */
.fader {
  height: 50vw;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  .fader {
    height: 300px;
  }
}
.fader__slide {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  opacity: 0;
  display: flex;
  align-items: center;
  align-self: center;
  justify-content: center;
}

.fader img {
  width: 100%;
  height: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateY(-50%) translateX(-50%);
  -webkit-transform: translateY(-50%) translateX(-50%);
}
<script src="https://cdn.jsdelivr.net/npm/keen-slider@latest/keen-slider.js"></script>

<div class="grid grid--alt aspect">

  <div class="grid__item">

    <div class="grid__item-main">
      <h1 class="brand-name">Brand Name</h1>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
    </div>

    <div class="grid__item-footer">
      <p class="contrast"><span class="contrast__switch"></span>Contrast</p>
    </div>

  </div>

  <div class="grid__item grid__item--gallery">

    <div class="grid__item-main">

      <div class="gallery">

        <div id="my-keen-slider">
          <div class="fader__slide keen-slider__slide" data-caption="product name 1" data-slide="1">
            <img src="https://www.fillmurray.com/900/1200" data-caption="product name 1" data-slide="1" />
          </div>
          <div class="fader__slide keen-slider__slide">
            <img src="https://www.fillmurray.com/g/900/1200" data-caption="product name 2" data-slide="2" />
          </div>
        </div>

        <div class="grid__item-footer">
          <p>Name of Project</p>
          <p class="gallery-count align-right"><span class="current">1</span>&nbsp;/&nbsp;2</p>
        </div>

      </div>

Get unkown children of node from a JSONPath in Javascript

I am currently building a tool that should extract the Core Web Vitals metrics of a URL.

With the API i can receive a JSON object wich i can access with JSONPath.

I would like to use a forEach loop to input the data into the HTML-fields.

Now my question is, how can i access child nodes of a JSON without using their names.

document.querySelectorAll('[data-section^="cww"]').forEach((nodes, index) => {
    console.log(values.body.record.metrics);
});
{
    "key": {
        "origin": "https://developer.mozilla.org"
    },
    "metrics": {
        "cumulative_layout_shift": {
            "histogram": [
                {
                    "start": "0.00",
                    "end": "0.10",
                    "density": 0.9377813344003197
                },
                {
                    "start": "0.10",
                    "end": "0.25",
                    "density": 0.039611883565069506
                },
                {
                    "start": "0.25",
                    "density": 0.022606782034610366
                }
            ],
            "percentiles": {
                "p75": "0.01"
            }
        },
        "first_contentful_paint": {
            "histogram": [
                {
                    "start": 0,
                    "end": 1800,
                    "density": 0.9419767907162874
                },
                {
                    "start": 1800,
                    "end": 3000,
                    "density": 0.03741496598639458
                },
                {
                    "start": 3000,
                    "density": 0.02060824329731889
                }
            ],
            "percentiles": {
                "p75": 841
            }
        },
        "first_input_delay": {
            "histogram": [
                {
                    "start": 0,
                    "end": 100,
                    "density": 0.9863863863863849
                },
                {
                    "start": 100,
                    "end": 300,
                    "density": 0.008308308308308296
                },
                {
                    "start": 300,
                    "density": 0.0053053053053052955
                }
            ],
            "percentiles": {
                "p75": 5
            }
        },
        "largest_contentful_paint": {
            "histogram": [
                {
                    "start": 0,
                    "end": 2500,
                    "density": 0.9460068054443531
                },
                {
                    "start": 2500,
                    "end": 4000,
                    "density": 0.03467774219375491
                },
                {
                    "start": 4000,
                    "density": 0.019315452361889692
                }
            ],
            "percentiles": {
                "p75": 1135
            }
        }
    }
}

Getting a blank page when deploying react nodejs app on heroku with these errors

Refused to execute inline script because it violates the following Content Security Policy directive: “script-src ‘self'”. Either the ‘unsafe-inline’ keyword, a hash (‘sha256-Zddhh56x44NMbPzNMovPr5UnNjRCyKyQNh0SJiuYnsw=’), or a nonce (‘nonce-…’) is required to enable inline execution.

Failed to load resource: the server responded with a status of 500 (Internal Server Error) /favicon.ico:1

[index.html page][1]

Cannot change font color and box width in chart

I would like to change the font color and the box width in my chart but it doesn’t work.
I tried it a lot of way but cant solve it.

Also it must be better solution to edit borderColor, pointRadius, etc. then set it in every label.

Sorry for my stupid question, i am beginner.

Here is my chart component:

<script>
import { defineComponent } from 'vue'
import { Line } from 'vue3-chart-v2'

export default defineComponent({
  name: 'ChanceChart',
  extends: Line,
  props: {
    chartData: {
      type: Object,
      required: true
    },
    chartOptions: {
      type: Object,
      required: false,
    },
  },
  mounted () {
    this.renderChart(this.chartData, this.chartOptions)
  }
})
</script>

And here is my app:

<template>
    <div id="chart">
      <ChanceChart :chartData="chartData" />
    </div>
</template>

<script>
import ChanceChart from "../components/ChanceChart.vue";

export default {
  components: {
    ChanceChart
  },

  computed: {
    chartData() {
      return {
        labels: this.enemysCards.map((x, index) => index + 1),
        datasets: [
          {
            label: "Enemy's Chance",
            borderColor: "#1161ed",
            borderWidth: 2,
            pointRadius: 0,
            color: "#fff",
            data: this.enemysCards,
            defaultFontColor: "#fff",
          },
          {
            label: "My Chance",
            borderColor: "#f87979",
            borderWidth: 2,
            pointRadius: 0,
            data: this.myCardsFilled,
          },
          {
            label: "Enemy's Avarage",
            borderColor: "rgb(238, 255, 0)",
            borderWidth: 2,
            pointRadius: 0,
            data: this.avgArray,
          },
          {
            label: "Enemy's Median",
            borderColor: "rgb(255, 0, 191)",
            borderWidth: 2,
            pointRadius: 0,
            data: this.medianArray,
          },
          {
            label: "Standard Deviation",
            borderColor: "#fff",
            borderWidth: 2,
            pointRadius: 0,
            data: this.upDev,
          },
          {
            label: "Standard Deviation",
            borderColor: "#fff",
            borderWidth: 2,
            pointRadius: 0,
            data: this.downDev,
          },
        ],
        options: {
          plugins: {
            legend: {
              labels: {
                boxWidth: 0,
                font: {
                  color: "#fff",
                },
              },
            },
          },
        },
      };
    },
  },

Can anyone help me?

Visual Code Function “Insert Between Code” ? Is this exist?

anyone of you coder know about a extension like this?

For example: i Have this code multiplied for 100

 plan: <?= $this->user->plan_id ?>,
 trial: <?= $this->user->plan_trial_done ?>,
 email: "<?= $this->user->email ?>",

I need to replace
$this->user->plan_id
to
isset($$this->user->plan_id) ? $this->user->plan_id : “”

For example a tool if i select this code: isset({X}) ? {X} : “”
Automaticaly replace all {X} with the previously selected code?

I hope you understand, if not exist i will create it lol.

From Array to individual string in Jquery?

there is a problem with my code I try to split array values to single individual strings that contains part of links.

I tried with dele.join() , but still the output is single string with coma separation

$(function () {

            $("#selectedel").click(function () {
                var dele =[]; // Array look like this  ["/delete.php?id=1","/delete.php?id=2","/delete.php?id=3"]
                $.each($("input:checkbox[name='dele']:checked"), function () {
                    dele.push($(this).val());

                });
                console.log(dele.toString());
                console.log(dele.join(","));
            })


        });

output of this code is

/delete.php?id=1,/delete.php?id=2,/delete.php?id=3

The output that i want is

/delete.php?id=1
/delete.php?id=2
/delete.php?id=3

Which in the end i want to open this links with window.open() at once .

Thank you in advance

How to Call a Javascript function onclick event inside jinja template?

 {% for person in teacher %}
                            <tr class="bg-gray-100 border-b">
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"></td>
                                <td class="p-0 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
                                    <img src="{{person.customuser.profile_pic.url}}" class="rounded-lg w-32"
                                        alt="Avatar" />
                                </td>
                                <td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
                                    <p>{{person.customuser.first_name}} {{person.customuser.last_name}}</p>
                                </td>
                                <td class="text-sm text-gray-900 font-light px-4 py-4 whitespace-nowrap">
                                    {% for item in person.subjects.all %}
                                    <p>{{item.name}}</p>
                                    {% endfor %}
                                </td>
                                <td class="text-sm text-gray-900 font-light px-4 py-4 whitespace-nowrap">

                                    <div class="flex items-center justify-center">
                                        <div id="btnView" class="inline-flex shadow-md hover:shadow-lg focus:shadow-lg"
                                            role="group">
                                            <button type="button"
                                                class="rounded-l inline-block px-6 py-2.5 bg-[#4951bf]  text-white font-medium text-xs leading-tight uppercase hover:bg-blue-700 focus:bg-blue-700 focus:outline-none focus:ring-0 active:bg-blue-800 transition duration-150 ease-in-out">Edit</button>
                                            <button onclick='viewDetails()'
                                                    type="button"
                                                    class=" inline-block px-6 py-2.5 bg-[#4951bf]  text-white font-medium text-xs leading-tight uppercase hover:bg-green-700 focus:bg-green-700 focus:outline-none focus:ring-0 active:bg-green-800 transition duration-150 ease-in-out">View</button>
                                            <button type="button"
                                                class=" rounded-r inline-block px-6 py-2.5 bg-[#4951bf]  text-white font-medium text-xs leading-tight uppercase hover:bg-red-700 focus:bg-red-700 focus:outline-none focus:ring-0 active:bg-blue-800 transition duration-150 ease-in-out">Delete</button>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            {% endfor %}

I want to call a javascript function viewDetails({{person.id}}) inside onclick event when the user presses the button.I want the value {{person.id}} to be passed as an argument which is coming from the for loop in jinja tag. Is it possible?

react js and node Can’t see img of new user

When I try to register a new user all data are passed except “avatar”, even if that avatar is regularly uploaded on my Cloudinary.

Don’t even know what is the problem in and tried to find answer on google but unsuccessfully, so any help is very welcome 😀

Here is some code, if need more tell me in a comment and I’ll send you

Cannot finish my site, don’t know what to do…

// frontend Register component
import React, { Fragment, useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';

import MetaData from '../layout/MetaData';

import { useAlert } from 'react-alert';
import { useDispatch, useSelector } from 'react-redux';
import { register, clearErrors } from '../../actions/userActions';

const Register = () => {
  const navigate = useNavigate();

  const [user, setUser] = useState({
    name: '',
    email: '',
    password: '',
  });

  const { name, email, password } = user;

  const [avatar, setAvatar] = useState('');
  const [avatarPreview, setAvatarPreview] = useState(
    '/images/default_avatar.jpg'
  );

  const alert = useAlert();
  const dispatch = useDispatch();

  const { isAuthenticated, error, loading } = useSelector(
    (state) => state.auth
  );

  useEffect(() => {
    if (isAuthenticated) {
      navigate('/');
    }

    if (error) {
      alert.error(error);
      dispatch(clearErrors());
    }
  }, [dispatch, alert, isAuthenticated, error, navigate]);

  const submitHandler = (e) => {
    e.preventDefault();

    const formData = new FormData();
    formData.set('name', name);
    formData.set('email', email);
    formData.set('password', password);
    formData.set('avatar', avatar);

    dispatch(register(formData));
  };

  const onChange = (e) => {
    if (e.target.name === 'avatar') {
      const reader = new FileReader();

      reader.onload = () => {
        if (reader.readyState === 2) {
          setAvatarPreview(reader.result);
          setAvatar(reader.result);
        }
      };

      reader.readAsDataURL(e.target.files[0]);
    } else {
      setUser({ ...user, [e.target.name]: e.target.value });
    }
  };

  return (
    <Fragment>
      <MetaData title={'Register User'} />

      <div className='row wrapper'>
        <div className='col-10 col-lg-5'>
          <form
            className='shadow-lg'
            onSubmit={submitHandler}
            encType='multipart/form-data'
          >
            <h1 className='mb-3'>Register</h1>

            <div className='form-group'>
              <label htmlFor='email_field'>Name</label>
              <input
                type='name'
                id='name_field'
                className='form-control'
                name='name'
                value={name}
                onChange={onChange}
              />
            </div>

            <div className='form-group'>
              <label htmlFor='email_field'>Email</label>
              <input
                type='email'
                id='email_field'
                className='form-control'
                name='email'
                value={email}
                onChange={onChange}
              />
            </div>

            <div className='form-group'>
              <label htmlFor='password_field'>Password</label>
              <input
                type='password'
                id='password_field'
                className='form-control'
                name='password'
                value={password}
                onChange={onChange}
              />
            </div>

            <div className='form-group'>
              <label htmlFor='avatar_upload'>Avatar</label>
              <div className='d-flex align-items-center'>
                <div>
                  <figure className='avatar mr-3 item-rtl'>
                    <img
                      src={avatarPreview}
                      className='rounded-circle'
                      alt='Avatar Preview'
                    />
                  </figure>
                </div>
                <div className='custom-file'>
                  <input
                    type='file'
                    name='avatar'
                    className='custom-file-input'
                    id='customFile'
                    accept='iamges/*'
                    onChange={onChange}
                  />
                  <label className='custom-file-label' htmlFor='customFile'>
                    Choose Avatar
                  </label>
                </div>
              </div>
            </div>

            <button
              id='register_button'
              type='submit'
              className='btn btn-block py-3'
              disabled={loading ? true : false}
            >
              REGISTER
            </button>
          </form>
        </div>
      </div>
    </Fragment>
  );
};

export default Register;
// backend  Register a user => /api/v1/register
exports.registerUser = catchAsyncErrors(async (req, res, next) => {
  const result = await cloudinary.v2.uploader.upload(req.body.avatar, {
    folder: 'avatars',
    width: 150,
    crop: 'scale',
  });

  const { name, email, password } = req.body;

  const user = await User.create({
    name,
    email,
    password,
    avatar: {
      public_id: result.public_id,
      url: result.secure_url,
    },
  });

  sendToken(user, 200, res);
});

How do I use the return value of a function in React? [duplicate]

I have a basic React application. I want to show a list of links, and in the right column I want to show their status.

I have a .json file that has my urls:

[
    {
        "name": "Google",
        "url": "www.google.com"
    },
    {
        "name": "Bing",
        "url": "www.bing.com"
    },
    etc.
]

and I have a basic React component that reads it, builds a table with two rows:

  • <a href=url>name</a>
  • the status of this url

table

Here is the code:

import React from 'react'
import Table from 'react-bootstrap/Table'
import data from './data/urls.json'

function returnStatus (url) {
    fetch(url)
        .then(function(response) {
            return response.status
         })
        .catch(err => {
            console.log('Error: ',err)
        })
}

function Urls() {
    const urls = data.map(url => (
        <tr>
            <td>
                <a href={url.url} target='_blank'>{url.name}</a>
            </td>
            <td>{returnStatus(url.url)}</td>  ----> THIS IS THE LINE THAT DOESN'T WORK
        </tr>
    ))

    return (
        <div>
            <Table>
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Status</th>
                    </tr>
                </thead>
                <tbody>{urls}</tbody>
            </Table>
        </div>
    )
}

export default Urls

I know well Java and Python, and IMO it should work. But it doesn’t! Can you guys please help me 🙂

2D bounding rect from a mesh

I’m trying to figure out how to get the rect coords of a mesh for 2D projection.

I need X, Y, Width and Height.

After reading many SO posts and various blogs, it seems like none of them work with latest modern Three.JS and the documentation doesn’t have a function for it.

How is this achieved?

Currently, I’m looking at using a Box3 and then project the Box3 to screen.

My code looks like this

var bbox = new THREE.Box3().setFromObject(mesh);

Unfortunately I don’t know what else to provide.

I’m lost.