HTML height of DIV to fit content of a expandable card with transition

Hey I implemented this expandable card element and I want to set the height of the expanded card to fit the content of the profile__data.

If I set the height of the .profile.profile--expanded and of the keyframes to fit-conten or auto. it just bugs out.

function expand(card) {
    card.classList.toggle('profile--expanded');
    // If card is not expanded after toggle, add 'unexpanded' class
    if (!card.classList.contains('profile--expanded')) card.classList.toggle('profile--unexpanded');
    // Else if card is expanded after toggle and still contains 'unexpanded' class, remove 'unexpanded'
    else if (card.classList.contains('profile--expanded') && card.classList.contains('profile--unexpanded')) card.classList.toggle('profile--unexpanded');
        }
.profile {
    background-color: var(--primary-bg);
    border-radius: 8px;
    height: 180px;
    width: 350px;
    position: relative;
    overflow: hidden;
    transition: height 0.2s ease;
    border: 2px solid black;
    /* */
    display: inline-block;
    margin: 8px;
    vertical-align: top;
}
    .profile:hover {
        cursor: pointer;
    }
    .profile.profile--expanded {
        height: fit-content;
        animation: expand 0.5s ease;
     
    }
    .profile__banner {
        display: block;
        height: 70px;
        width: 100%;
        background-color: rgb(175, 105, 175);
        border-top-right-radius: inherit;
        border-top-left-radius: inherit;

    }

    .profile__info {
        width: 100%;
        text-align: center;
        position: absolute;
        top: 104px;
    }
        .profile__info-display, .profile__info-username {
            display: block;
            width: 100%;
        }
        .profile__info-display {
            font-size: 1.5rem;
            font-weight: bold;
        }
        .profile__info-username {
            color: var(--gray-text);
        }
    .profile__data {
        opacity: 0;
    }
        .profile--unexpanded > .profile__data, .profile--expanded > .profile__data {
            width: 100%;
            text-align: center;
            padding-top: inherit;
            height: 66px;
            position: absolute;
            top: 168px;
            display: flex;
            flex-wrap: nowrap;
            justify-content: space-around;
        }
        .profile--unexpanded > .profile__data {
            opacity: 0;
            animation: unreveal 0.2s ease;
        }
        .profile--expanded > .profile__data {
            opacity: 1;
            animation: reveal 0.7s ease;
        }
        .profile__data > * > * {
            display: block;
        }
        .profile__data > * > *:first-child {
            font-size: 1.2rem;
            font-weight: bold;
        }
        .profile__data > * > *:nth-child(2) {
            font-size: 0.9rem;
        }

@keyframes reveal {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes unreveal {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}
@keyframes expand {
    0% {
        height: 180px;
    }
    100% {
        height: fit-content;
    }
}
@keyframes unexpand {
    0% {
        height: fit-content;
    }
    100% {
        height: 180px;
    }
}
<div class="profile" onclick="expand(this)">
    <div class="profile__banner" style="background-color: rgb(153,255,204);"/>
        <div>
            <div class="profile__info">
                <span class="profile__info-display">Name</span>
                <span class="profile__info-username">Subtitle</span>
            </div>
        </div>
        <div class="profile__data">
        <span>
            Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
        </span>
    </div>
</div>

Socket.io Emits are not actually emitted

I made a server.js express server where essentially I wanna emmit stuff through socket.io library. The fact is the frontend client side (React) is not receiving any emit from the server, so I’m asking why.
Here’s the express server simplified:

const express = require('express')
const app = express()
const { Server } = require('socket.io')
const server = require('http').createServer(app)
const cors = require('cors')

const io = new Server(server, {
    cors: {
        origin: 'http://localhost:3000',
        methods: ['GET', 'POST']
    }
})

app.use(cors())

io.on('connection', socket => {
    socket.emit('test', 'this is actually a test')
})

server.listen(5000, '127.0.0.1', () => {
    console.log('Server started at: http://127.0.0.1:5000')
})

and this is the frontend:

// Socket
import io from 'socket.io-client'

const socket = io.connect('http://localhost:5000')
console.log(socket)

function App() {

    useEffect(() => {
        socket.on('test', test => {
            console.log(test)
        })
    }, [])

    return (
        <>
        </>
    );
}

export default App;

I also run a peerjs server but works as well

JS code breaks HTML checkbox element functionality

I have a custom select list which I did with checkbox and label elements.
Then I added a little JS script that changes options on click.
It works perfectly, except you can’t close it on click outside of it or its child elements.
I tried to use event listener(commented in snippet) to track if the click was done outside and if it is – change checkbox status on ‘false’ and it kinda worked, however, it breaks the original checkbox functionality and you can’t now close it in any way except for clicking outside of it. Is there a way I can fix this?

//SELECT FROM LIST
function selectList(id) {
    let selected = document.getElementById('selected');
  selected.innerHTML = id;
}

//BREAKS CHECKBOX
//window.addEventListener('mouseup', function(event){
//  let checkbox = document.getElementById('checkbox');
//  if (event.target != checkbox && event.target.parentNode != checkbox){
//    checkbox.checked = false;
//  }
// });
.btn {
  display: block;
  width: 100px;
  height: 50px;
  text-align: center;
  color: white;
  background: black;
  border-radius: 15px;
  line-height: 50px;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.btn:active {
  background: grey;
}

.btn ul {
  display: none;
  list-style: none;
  color: black;
  flex-direction: column;
  margin: 0;
  padding: 2.5px 5px;
  left: 0;
  top: 50px;
  background: grey;
  border-radius: 15px;
  position: absolute;
}

.btn ul li {
  display: block;
  width: 90px;
  height: 35px;
  line-height: 35px;
  background: black;
  border-radius: 15px;
  color: white;
  margin: 2.5px 0;
}

.btn ul li:active {
  background: grey;
}

/* CHECKBOX CHEKCED */
#checkbox:checked + .btn ul {
  display: flex;
}
<input type="checkbox" id="checkbox">
<label class="btn" for="checkbox">
  <span id="selected">SELECT</span>
  <ul>
    <li onclick="selectList('Opt1')">Opt1</li>
    <li onclick="selectList('Opt2')">Opt2</li>
    <li onclick="selectList('Opt3')">Opt3</li>
  </ul>
</label>

Can not mock $route and $roter for jest unit tests

I have question. I have unit test and I want to mock $route and $router
According docs I must not use localVue.use(VueRouter) So I did not used it. But then I apply unit test it is not working
“compiler# throws error
image

I mocked components what are used in TeamCalendarCard(see pic1) but still by some means router is added to unit test.

I checked i do not add anywhere else in unit test localVue.use(VueRouter)

Full code could be find here

The imports and other stuff for unit tests to work
imports of unit tests
The unit test in question
unit test what rises error

So what have I tried remove localVue.use(Route) according docs and answered questions in stackoverflow

Any suggestions how to mock route or wouldbe better tool/aproach to where search in code where localVue.use(Route) is added.

Dynamic routing using react-native

I’m making a news app using react native, now I need that whenever i click on an article, it sends me to a screen that has more infos about that article, ofc i wouldn’t want to do that to every single article manually it’d be impossible, any way in react native to do that?

Page A have iframe if I click on page B and go back to page A , the iframe disappear

I’m using Next.js
you can check the website here https://joe-mechlinski.vercel.app/
The iframe in the index page, try to go to another page and go back to the index page
you will see the Twitter iframe disappear.

// TwitterFrame Component
import Script from "next/script";

const TwitterFrame = () => {
  return (
    <>
      <section className="twitter-sec flex flex-col mt-20 items-center justify-center   bg-[#110b57]">
        <div className="pt-16 md:w-1/2 loadIframe">
          <a
            className="twitter-timeline"
            data-height="500"
            data-theme="light"
            href="https://twitter.com/joemechlinski?ref_src=twsrc%5Etfw"
          >
            Tweets by joemechlinski
          </a>
          <iframe
            id="twitter-widget-0"
            scrolling="no"
            frameBorder="0"
            allowFullScreen={true}
            className="twitter-timeline twitter-timeline-rendered"
            data-widget-id="profile:joemechlinski"
            title="Twitter Timeline"
          />
          <Script
            src="https://platform.twitter.com/widgets.js"
            charSet="utf-8"
            strategy="afterInteractive"
            onError={(e) => {
              console.error("Script failed to load", e);
            }}
            onLoad={(e) => console.log(e)}
          ></Script>
        </div>
        <a
          href="https://twitter.com/joemechlinski?ref_src=twsrc%5Etfw"
          className="text-white font-normal text-base bg-[#5541D9] py-4 px-8 -mt-12 mb-12"
        >
          Follow Along
        </a>
      </section>
    </>
  );
};

export default TwitterFrame;

Get filename from route

I have route like /gcp/filename

import downloadGCP from './controllers/downloadGCP';
router.route('/gcp')
    .get(downloadGCP);

inside downloadGCP.js, how should I get the filename? Below is code for downloadGCP.js

export default async (req, res) => {
//<--To get filename
}

Return Prefix if exist in array (take first element as prefix)

Here I am trying to return prefix if found else ‘no Prefix’ message. but my prefixResolver() returning undefined. please help me understand what I am doing wrong

  1. let arr = [“ab”, “abc”, “abcd”, “abd”];

the expected output is ‘ab’;

  1. let arr = [“zb”, “abc”, “abcd”, “abd”];

the expected output is ‘no Prefix’.

let arr = ["ab", "abc", "abcd", "abd"];

function prefixResolver(pattern) {
  if (!pattern) {
    return "no Prefix";
  }
  if (arr.every((item) => item.startsWith(pattern))) {
    return pattern;
  } else {
    pattern = pattern.slice(0, -1);
    prefixResolver(pattern);
  }
}
console.log(prefixResolver(arr[0]));

Is there a way to replace a value in an array result of a custom search on Suitescripts?

I am trying to replace a value in a search.create function with a filter. the filter returns one or more objects, and i store them in an array. On accessing the array, i want to replace a certain value with 0, if a certain field ‘lastinv’ is empty. here is my code below;

if (a == null || a == '') { //a is lastinv
            todate = format.format({
            value: todate,
            type: format.Type.DATE
        });

        var reading = search.create({ //creates a custom search on a record with specific filters
            type: 'customrecord_ew_meterreading_form',
            columns: ['name','id','custrecord_ew_mr_metername','custrecordmeternumber','custrecord_ew_mr_site','custrecord1','custrecord_ew_meterreading_value'],
            filters: [{
                name: 'custrecord_ew_mr_site',
                operator: search.Operator.IS,
                values: site
            },{
                name: 'custrecord1',
                operator: search.Operator.ON,
                values: todate
            }] // end of filter*/
        });
        //gets a custom search for the readings of a site on the firstdate/lastdate of the month and stores in a array called ar_readings 
        reading.run().each(function(result){

            ar_reading.push(result); 
            return true;
        });
        return ar_reading;
    }

And this next part is me trying to replace the value on a certain index;

for (var k = 0; k < firstReading.length; k++) {
                ar_mtrdata[k] = new Array();
                var l_meternumber = firstReading[k].getValue('custrecordmeternumber');
                var mtrdtls = getMeterDetails(l_meternumber);
                ar_mtrdata[k][0] = mtrdtls.getValue('itemid'); // Meternumber
                if (lastinv == '' || lastinv == undefined || lastinv == null) {
                    ar_mtrdata[k][2] = 0;
                } else {
                    ar_mtrdata[k][2] = firstReading[k].getValue('custrecord_ew_meterreading_value'); //previous reading  
                }

detect the unit type of svg path length – JavaScript

I am converting the text to svg to get the path length. But I’m confused which type of unit getTotalLength() function returns for svg, so that i can calculate my other things correctly according to the unit type.
I have googled a lot but didn’t find any perfect answer.
Is it returns px, em , ex , px , pt , pc , cm , mm , in or something else?
Here is my SVG:

<svg class="svgText" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 93 507.7392578125" data-asc="0.8525390625"><path class="glyph glyph-H" d="M21.6 41.9L21.6 41.9Q18.8 41.5 18.5 38.6L18.5 38.6Q18.5 38.2 18.5 37.6L18.5 37.6L18.5 37.3Q18.5 36.4 18.6 35.9L18.6 35.9Q19.3 31.9 22.7 25.9L22.7 25.9Q24.2 23.2 25.7 20.9L25.7 20.9L26.1 20.4L25.5 20.3Q25.1 20.3 24.4 20.2Q23.7 20.1 22.5 19.9L22.5 19.9Q21.9 19.8 21.1 19.7L21.1 19.7Q20.6 19.6 20.1 19.5L20.1 19.5Q19.6 19.5 19.2 19.4Q18.8 19.3 18.7 19.3L18.7 19.3L18.6 19.3L18.6 19.3Q18.6 19.4 18.5 19.4Q18.4 19.5 18.3 19.7Q18.2 19.8 18.0 20.1L18.0 20.1Q17.7 20.5 17.4 20.9Q17.1 21.4 16.8 21.7L16.8 21.7Q15.2 23.8 14.5 24.7Q13.8 25.6 13.5 26.0L13.5 26.0Q13.2 26.4 12.8 26.9Q12.4 27.5 12.0 28.0L12.0 28.0Q10.4 29.9 9.4 31.1Q8.4 32.3 7.4 33.3L7.4 33.3Q7.0 33.7 6.4 34.4Q5.9 35.0 5.4 35.6L5.4 35.6Q4.7 36.3 4.4 36.7Q4.0 37.1 3.8 37.3Q3.6 37.5 3.5 37.5L3.5 37.5Q3.1 37.8 2.3 37.8L2.3 37.8L2.2 37.8Q1.4 37.8 1.0 37.5L1.0 37.5Q1.0 37.4 1.0 37.2L1.0 37.2L1.0 37.1Q1.0 36.9 1.3 36.3Q1.6 35.8 2.3 34.8L2.3 34.8Q2.8 33.9 3.1 33.4Q3.4 33.0 3.7 32.5L3.7 32.5Q4.2 31.4 5.2 30.1L5.2 30.1Q5.9 29.1 7.0 27.6Q8.1 26.0 8.8 25.2L8.8 25.2Q9.4 24.3 10.5 22.9Q11.5 21.4 12.5 19.9L12.5 19.9Q12.6 19.8 12.7 19.7L12.7 19.7Q13.3 18.9 13.3 18.8L13.3 18.8Q13.3 18.7 13.0 18.7L13.0 18.7Q12.9 18.7 12.7 18.7L12.7 18.7L12.5 18.7Q11.4 18.8 10.4 19.1Q9.5 19.3 8.4 19.8L8.4 19.8Q7.7 20.1 7.4 20.2Q7.1 20.2 6.9 20.2L6.9 20.2L6.7 20.2Q5.9 20.1 5.9 19.8L5.9 19.8Q5.9 19.5 6.8 19.0L6.8 19.0Q8.3 18.1 11.0 17.7L11.0 17.7Q11.4 17.6 11.8 17.6Q12.2 17.5 12.9 17.5L12.9 17.5Q13.5 17.5 13.9 17.5Q14.3 17.5 14.3 17.5L14.3 17.5Q14.3 17.4 14.6 17.0Q14.9 16.6 15.3 16.0Q15.6 15.5 15.9 15.0L15.9 15.0Q18.0 11.7 18.1 10.4L18.1 10.4Q18.2 10.2 18.2 10.0L18.2 10.0Q18.2 9.4 17.8 9.1L17.8 9.1Q17.6 9.0 17.1 9.0L17.1 9.0Q16.5 9.0 16.0 9.1L16.0 9.1Q12.7 9.9 8.4 12.6L8.4 12.6Q5.3 14.7 3.2 17.2L3.2 17.2Q2.6 18.0 2.1 18.9Q1.6 19.7 1.5 20.1L1.5 20.1Q1.5 20.3 1.4 20.4Q1.3 20.5 1.1 20.6L1.1 20.6Q1.0 20.6 0.8 20.6L0.8 20.6Q0.7 20.6 0.5 20.6L0.5 20.6Q0.2 20.5 0.1 20.3L0.1 20.3Q0 20.1 0 19.8L0 19.8L0 19.7Q0 19.3 0.1 18.9L0.1 18.9Q0.3 18.6 0.4 18.3Q0.5 18.0 0.8 17.6L0.8 17.6Q1.5 16.5 2.8 15.3L2.8 15.3Q5.2 12.9 8.3 10.9Q11.5 9.0 14.5 8.1L14.5 8.1Q16.3 7.6 17.8 7.6L17.8 7.6Q18.3 7.6 18.9 7.7L18.9 7.7Q20.8 7.9 21.8 9.0L21.8 9.0Q22.5 9.7 22.5 10.9L22.5 10.9Q22.5 11.5 22.4 12.0Q22.2 12.6 21.9 13.4L21.9 13.4Q21.7 14.2 21.0 15.4Q20.3 16.7 19.7 17.7L19.7 17.7Q19.5 17.9 19.5 18.0Q19.4 18.1 19.4 18.2L19.4 18.2Q19.4 18.2 20.2 18.3Q20.9 18.4 22.0 18.5Q23.1 18.7 24.0 18.8L24.0 18.8Q26.5 19.2 26.8 19.2L26.8 19.2L26.8 19.2Q26.9 19.2 27.0 19.0Q27.1 18.8 27.3 18.6L27.3 18.6Q29.6 15.4 31.9 12.8L31.9 12.8Q32.4 12.4 32.6 12.1Q32.9 11.8 33.0 11.7Q33.2 11.5 33.4 11.3L33.4 11.3Q34.0 10.8 34.4 10.6Q34.9 10.4 35.5 10.4L35.5 10.4Q37.2 10.5 37.4 11.4L37.4 11.4Q37.4 11.5 37.4 11.5L37.4 11.5Q37.4 11.7 37.3 11.9L37.3 11.9Q37.2 12.2 36.9 12.7L36.9 12.7Q36.7 13.2 36.1 14.0Q35.6 14.8 34.4 16.5L34.4 16.5Q33.1 18.3 33.1 18.4L33.1 18.4Q33.1 18.4 33.4 18.3Q33.6 18.3 34.0 18.2L34.0 18.2L34.6 18.0Q35.0 17.8 35.2 17.8L35.2 17.8Q35.7 17.7 36.1 17.7L36.1 17.7L36.2 17.7Q36.7 17.7 36.9 17.9L36.9 17.9Q36.9 18.0 36.9 18.1L36.9 18.1Q36.9 18.1 36.9 18.2L36.9 18.2Q36.8 18.3 36.4 18.5L36.4 18.5Q35.1 19.1 32.4 19.8L32.4 19.8L32.0 19.9L31.7 20.3Q31.5 20.5 31.0 21.4Q30.4 22.2 29.8 23.1Q29.2 24.0 29.1 24.3L29.1 24.3Q23.4 33.2 22.5 37.4L22.5 37.4Q22.3 38.2 22.3 38.9L22.3 38.9Q22.3 39.3 22.4 39.6L22.4 39.6Q22.5 40.1 22.7 40.4Q22.9 40.7 23.0 40.7L23.0 40.7L23.0 40.7Q24.9 40.2 28.3 36.7L28.3 36.7Q29.1 35.9 29.7 35.3Q30.2 34.7 31.0 33.8L31.0 33.8Q33.1 31.2 34.4 29.3L34.4 29.3Q34.5 29.1 34.6 29.0Q34.7 28.9 34.9 28.7L34.9 28.7Q35.0 28.5 35.2 28.2L35.2 28.2Q35.9 27.4 36.2 27.0Q36.6 26.6 36.8 26.4Q37.1 26.3 37.4 26.3L37.4 26.3L37.5 26.3Q37.8 26.3 37.9 26.3L37.9 26.3Q38.2 26.4 38.2 26.5L38.2 26.5Q38.2 26.5 38.2 26.6Q38.2 26.6 38.2 26.7Q38.2 26.7 38.1 26.8Q38.0 26.9 37.9 27.1Q37.8 27.2 37.6 27.5Q37.5 27.8 37.2 28.1L37.2 28.1Q36.9 28.6 36.7 28.8Q36.5 29.0 36.4 29.2Q36.3 29.3 36.1 29.6L36.1 29.6Q35.8 30.0 34.9 31.1L34.9 31.1Q34.3 31.8 33.6 32.7Q32.9 33.6 32.4 34.2L32.4 34.2Q31.1 36.0 30.2 37.0Q29.3 38.0 28.4 38.9L28.4 38.9Q26.5 40.7 25.2 41.4L25.2 41.4Q24.4 41.8 23.6 41.9L23.6 41.9Q23.1 42.0 22.8 42.0Q22.4 42.0 22.3 42.0L22.3 42.0Q21.9 42.0 21.6 41.9Z"></path><path class="glyph glyph-e" d="M35.0 29.9L35.0 29.9Q35.7 27.3 37.5 25.0L37.5 25.0Q37.9 24.6 38.5 24.0Q39.1 23.4 39.4 23.1L39.4 23.1Q39.8 22.9 40.2 22.6Q40.6 22.3 40.9 22.2L40.9 22.2Q41.7 21.9 42.6 21.7Q43.5 21.5 44.1 21.5L44.1 21.5Q44.6 21.5 45.1 21.6L45.1 21.6Q46.5 21.9 46.8 22.7L46.8 22.7Q46.9 23.0 46.9 23.3L46.9 23.3Q46.9 23.8 46.6 24.4L46.6 24.4Q46.3 25.3 45.6 26.2Q44.9 27.0 44.3 27.5L44.3 27.5Q42.7 28.7 40.9 28.8L40.9 28.8L40.2 28.8L40.1 29.3Q39.3 31.6 39.3 32.9L39.3 32.9Q39.3 34.0 39.6 34.3Q39.8 34.6 40.2 34.6L40.2 34.6Q40.3 34.6 40.5 34.5L40.5 34.5Q41.0 34.4 41.6 34.1L41.6 34.1Q43.7 32.9 45.3 31.2Q47.0 29.5 48.6 27.7L48.6 27.7Q49.1 27.0 49.7 26.4L49.7 26.4Q49.8 26.3 49.8 26.3Q49.9 26.3 50 26.3Q50.1 26.3 50.3 26.3L50.3 26.3Q50.5 26.3 50.6 26.3Q50.8 26.3 50.8 26.4L50.8 26.4Q51.0 26.4 51.0 26.5L51.0 26.5Q51.0 26.7 50.9 26.7L50.9 26.7Q49.1 28.8 47.2 30.9Q45.2 33.1 43.0 34.6L43.0 34.6Q41.2 35.8 39.3 35.8L39.3 35.8Q39.1 35.8 38.9 35.7L38.9 35.7Q36.8 35.6 35.8 34.4Q34.8 33.1 34.8 31.6L34.8 31.6Q34.8 30.8 35.0 29.9ZM41.5 27.9L41.5 27.9Q42.7 27.6 43.9 26.4L43.9 26.4Q44.3 26.0 44.5 25.6Q44.8 25.3 45.0 24.7L45.0 24.7Q45.2 24.1 45.2 23.7L45.2 23.7Q45.2 23.3 45.0 23.1L45.0 23.1Q44.9 22.9 44.7 22.9L44.7 22.9Q44.3 22.9 43.5 23.5L43.5 23.5Q42.7 24.3 41.8 25.6L41.8 25.6Q41.7 25.8 41.5 26.2Q41.3 26.5 41.1 27.0Q40.9 27.4 40.7 27.7Q40.6 28.0 40.6 28.0L40.6 28.0L40.8 28.0Q40.9 28.0 41.1 28.0Q41.4 27.9 41.5 27.9Z"></path><path class="glyph glyph-l" d="M47.6 35.3L47.6 35.3Q47.5 34.7 47.5 33.8L47.5 33.8Q47.5 32.8 47.6 32.1L47.6 32.1Q48.3 26.5 53.1 19.6L53.1 19.6Q57.2 13.8 60.4 11.3L60.4 11.3Q62.5 9.7 64.6 9.1L64.6 9.1Q66.1 8.6 67.2 8.6L67.2 8.6Q68.4 8.6 69.1 9.2L69.1 9.2Q69.7 9.6 69.7 10.5L69.7 10.5Q69.7 11.6 68.8 13.3L68.8 13.3Q68.5 13.8 68.0 14.6Q67.5 15.4 67.0 16.0L67.0 16.0Q64.1 19.8 60.3 22.2L60.3 22.2Q59.3 22.8 58.1 23.2Q57.0 23.7 56.2 23.8L56.2 23.8Q56.0 23.9 55.9 23.9Q55.8 23.9 55.7 23.9L55.7 23.9Q55.6 24.0 55.1 24.9Q54.6 25.7 54.0 26.9Q53.4 28.1 52.9 29.1L52.9 29.1Q51.5 32.2 51.2 34.6L51.2 34.6Q51.1 35.4 51.1 36.0L51.1 36.0Q51.1 37.3 51.6 37.6L51.6 37.6Q51.8 37.7 52.1 37.7L52.1 37.7Q52.9 37.7 54.4 36.8L54.4 36.8Q56.3 35.5 58.8 33.1L58.8 33.1Q59.7 32.2 60.4 31.4Q61.1 30.6 62.3 29.0L62.3 29.0Q62.7 28.5 63.0 28.2Q63.2 27.9 63.3 27.8L63.3 27.8Q63.8 27.2 64.0 26.9Q64.3 26.6 64.4 26.5Q64.5 26.4 64.6 26.3L64.6 26.3Q64.7 26.3 65.0 26.3L65.0 26.3L65.1 26.3Q65.4 26.3 65.6 26.3L65.6 26.3Q65.7 26.4 65.7 26.5L65.7 26.5Q65.7 26.7 63.7 29.2L63.7 29.2Q63.3 29.7 63.0 30.1Q62.7 30.5 62.2 31.0Q61.7 31.5 61.0 32.3L61.0 32.3Q59.8 33.6 58.8 34.7Q57.7 35.7 57.1 36.3L57.1 36.3Q55.9 37.4 54.5 38.2Q53.1 39.0 51.5 39.0L51.5 39.0L51.2 39.0Q48.3 38.6 47.6 35.3ZM57.9 22.1L57.9 22.1Q60.9 20.7 63.6 17.9L63.6 17.9Q65.7 15.8 66.8 13.5L66.8 13.5Q67.7 11.8 67.7 11.0L67.7 11.0Q67.7 10.7 67.6 10.5L67.6 10.5Q67.5 10.3 67.2 10.3L67.2 10.3Q66.6 10.3 65.1 11.5L65.1 11.5Q62.6 13.6 59.5 18.0L59.5 18.0Q59.2 18.5 58.6 19.3Q58.1 20.0 57.6 20.8Q57.1 21.6 56.7 22.2L56.7 22.2Q56.4 22.7 56.4 22.8L56.4 22.8Q56.4 22.8 56.6 22.7L56.6 22.7Q56.8 22.6 57.2 22.5Q57.5 22.3 57.9 22.1Z"></path><path class="glyph glyph-l" d="M61.7 35.3L61.7 35.3Q61.6 34.7 61.6 33.8L61.6 33.8Q61.6 32.8 61.7 32.1L61.7 32.1Q62.4 26.5 67.3 19.6L67.3 19.6Q71.3 13.8 74.6 11.3L74.6 11.3Q76.6 9.7 78.7 9.1L78.7 9.1Q80.2 8.6 81.3 8.6L81.3 8.6Q82.6 8.6 83.3 9.2L83.3 9.2Q83.9 9.6 83.9 10.5L83.9 10.5Q83.9 11.6 83.0 13.3L83.0 13.3Q82.7 13.8 82.1 14.6Q81.6 15.4 81.2 16.0L81.2 16.0Q78.2 19.8 74.4 22.2L74.4 22.2Q73.4 22.8 72.3 23.2Q71.1 23.7 70.3 23.8L70.3 23.8Q70.1 23.9 70.0 23.9Q69.9 23.9 69.8 23.9L69.8 23.9Q69.7 24.0 69.2 24.9Q68.8 25.7 68.2 26.9Q67.6 28.1 67.1 29.1L67.1 29.1Q65.7 32.2 65.3 34.6L65.3 34.6Q65.2 35.4 65.2 36.0L65.2 36.0Q65.2 37.3 65.7 37.6L65.7 37.6Q66.0 37.7 66.2 37.7L66.2 37.7Q67.1 37.7 68.5 36.8L68.5 36.8Q70.4 35.5 72.9 33.1L72.9 33.1Q73.8 32.2 74.5 31.4Q75.2 30.6 76.5 29.0L76.5 29.0Q76.8 28.5 77.1 28.2Q77.4 27.9 77.5 27.8L77.5 27.8Q77.9 27.2 78.2 26.9Q78.4 26.6 78.5 26.5Q78.7 26.4 78.7 26.3L78.7 26.3Q78.9 26.3 79.1 26.3L79.1 26.3L79.2 26.3Q79.5 26.3 79.7 26.3L79.7 26.3Q79.9 26.4 79.9 26.5L79.9 26.5Q79.9 26.7 77.8 29.2L77.8 29.2Q77.4 29.7 77.1 30.1Q76.8 30.5 76.3 31.0Q75.9 31.5 75.1 32.3L75.1 32.3Q74.0 33.6 72.9 34.7Q71.8 35.7 71.2 36.3L71.2 36.3Q70.0 37.4 68.6 38.2Q67.2 39.0 65.6 39.0L65.6 39.0L65.4 39.0Q62.4 38.6 61.7 35.3ZM72.0 22.1L72.0 22.1Q75 20.7 77.8 17.9L77.8 17.9Q79.8 15.8 81.0 13.5L81.0 13.5Q81.8 11.8 81.8 11.0L81.8 11.0Q81.8 10.7 81.7 10.5L81.7 10.5Q81.6 10.3 81.3 10.3L81.3 10.3Q80.7 10.3 79.3 11.5L79.3 11.5Q76.8 13.6 73.6 18.0L73.6 18.0Q73.3 18.5 72.8 19.3Q72.2 20.0 71.7 20.8Q71.2 21.6 70.8 22.2L70.8 22.2Q70.5 22.7 70.5 22.8L70.5 22.8Q70.5 22.8 70.7 22.7L70.7 22.7Q70.9 22.6 71.3 22.5Q71.7 22.3 72.0 22.1Z"></path><path class="glyph glyph-o" d="M75.2 33.2L75.2 33.2Q75.1 32.6 75.1 32.1L75.1 32.1Q75.1 30.2 76.4 28.2L76.4 28.2Q77.0 27.2 77.8 26.9L77.8 26.9L77.8 26.9Q77.9 26.9 77.9 26.9L77.9 26.9L78.0 26.8Q78.0 26.8 78.0 26.7Q78.0 26.7 78.0 26.5L78.0 26.5Q78.1 26.0 78.3 25.4Q78.5 24.8 78.9 24.4L78.9 24.4Q80.5 22.4 83.1 22.1L83.1 22.1Q83.3 22.0 83.6 22.0L83.6 22.0Q85.0 22.0 86.1 22.8L86.1 22.8Q87.4 23.6 87.8 25.3L87.8 25.3Q87.9 25.8 87.9 26.2L87.9 26.2Q87.9 27.4 87.3 28.7L87.3 28.7Q87.3 28.9 87.2 28.9Q87.2 29.0 87.2 29.1L87.2 29.1Q87.3 29.1 88.0 28.7Q88.7 28.3 89.5 27.8Q90.3 27.4 90.8 27.1L90.8 27.1Q91.0 26.9 91.2 26.8Q91.4 26.7 91.5 26.7L91.5 26.7Q91.7 26.6 92.0 26.6L92.0 26.6L92.2 26.6Q92.5 26.7 92.6 26.8Q92.7 26.9 92.7 27.0L92.7 27.0Q92.7 27.1 92.5 27.3L92.5 27.3Q92.4 27.5 91.6 28.0Q90.9 28.5 90.1 29.0Q89.2 29.5 88.8 29.8L88.8 29.8Q88.3 30.0 87.7 30.2Q87.1 30.5 86.6 30.6L86.6 30.6L86.2 30.8L85.8 31.2Q84.5 32.9 82.7 34.2L82.7 34.2Q81.5 34.9 80.4 35.2Q79.2 35.5 78.5 35.5L78.5 35.5Q77.7 35.5 77.0 35.3L77.0 35.3Q75.7 34.9 75.2 33.2ZM84.6 30.0L84.9 29.6Q85.7 28.2 85.9 27.0L85.9 27.0Q86.0 26.7 86.0 26.3L86.0 26.3Q86.0 26.1 86.0 25.8L86.0 25.8Q85.9 25.2 85.7 24.8L85.7 24.8Q85.4 24.0 84.6 23.6L84.6 23.6Q84.3 23.4 84.0 23.4L84.0 23.4Q83.8 23.4 83.5 23.5L83.5 23.5Q83.1 23.8 82.7 24.3Q82.3 24.9 82.0 25.4L82.0 25.4Q81.6 26.2 81.6 27.1L81.6 27.1Q81.6 27.5 81.7 28.0L81.7 28.0Q82.0 28.8 82.7 29.4Q83.4 29.9 84.3 30.0L84.3 30.0L84.6 30.0ZM80.9 33.4L80.9 33.4Q81.7 33.0 82.6 32.2L82.6 32.2Q82.9 31.9 83.1 31.7Q83.4 31.5 83.5 31.3Q83.7 31.1 83.7 31.1L83.7 31.1Q83.7 31.1 83.6 31.0Q83.4 31.0 83.3 31.0L83.3 31.0Q82.4 31.0 81.5 30.7Q80.6 30.3 80.0 30.0L80.0 30.0Q79.9 29.9 79.8 29.8Q79.8 29.8 79.8 29.8L79.8 29.8Q79.7 29.8 79.6 30.1Q79.5 30.3 79.3 30.7Q79.2 31.0 79.0 31.3Q78.9 31.6 78.9 31.8L78.9 31.8Q78.6 32.7 78.6 33.2L78.6 33.2Q78.6 33.7 78.8 34.0L78.8 34.0Q78.9 34.1 79.2 34.1L79.2 34.1Q79.8 34.1 80.9 33.4Z"></path></svg>

Here is the code which is converting the text to svg:

export async function textToPath(text, size, fileName) {
    console.log(size, fileName)
    // const fontFile = "https://fonts.gstatic.com/s/firasans/v15/va9E4kDNxMZdWfMOD5Vvl4jO.ttf"
    const fontFile = `https://uineon-fonts.hadithapi.com/${fileName}`
    console.log(fontFile);
    let params = {
        string: text,
        font: fontFile,
        fontSize: size.x,
        decimals: 1,
        singleGylyphs: true
    };
    const font = await opentype.load(params.font);
    let options = params.options;
    let unitsPerEm = font.unitsPerEm;
    let ratio = params.fontSize / unitsPerEm;
    let ascender = font.ascender;
    let descender = Math.abs(font.descender);
    let ratAsc = ascender / unitsPerEm;
    let ratDesc = descender / unitsPerEm;
    let yOffset = params.fontSize * ratAsc;
    let lineHeight = params.fontSize + params.fontSize * ratDesc;
    let singleGylyphs = params.singleGylyphs;
    let teststring = params.string.split("");
    let glyphs = font.stringToGlyphs(params.string);
    let firstGlyph = glyphs[0];
    let lastGlyph = glyphs[glyphs.length - 1];
    let leftSB = firstGlyph.leftSideBearing * ratio;

    let textPath = "";
    let path = "";
    let paths = "";
    
    // Individual paths for each glyph
    if (singleGylyphs) {
        paths = font.getPaths(
            params.string,
            -leftSB,
            yOffset,
            params.fontSize,
            options
        );
        paths.forEach(function (path, i) {
            let pathEl = path.toSVG(params.decimals);
            textPath += pathEl.replaceAll(
                "d=",
                'class="glyph glyph-' + teststring[i] + '" d='
            );
        });
    }
    // Word (all glyphs) merged to one path
    else {
        path = font.getPath(
            params.string,
            -leftSB,
            yOffset,
            params.fontSize,
            options
        );
        textPath += path
            .toSVG(params.decimals)
            .replaceAll("d=", 'class="glyph" d=');
    }

    // Render
    let fontSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
    fontSvg.classList.add("svgText");
    fontSvg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
    fontSvg.innerHTML = textPath;


    // Calculate viewBox width by getAdvanceWidth() or getBoundingBox()
    let lastRightSideBearing = (lastGlyph.advanceWidth - lastGlyph.xMax) * ratio;
    let stringWidth = 0;
    if (!singleGylyphs) {
        stringWidth = Math.ceil(path.getBoundingBox().x2);
    } else {
        stringWidth = Math.ceil(font.getAdvanceWidth(params.string, params.fontSize, options) - leftSB - lastRightSideBearing);
    }

    // Adjust bbox
    fontSvg.setAttribute("viewBox", "0 0 " + stringWidth + " " + lineHeight);
    fontSvg.setAttribute("data-asc", ratAsc);

    let textPathLength = 0;
    console.log(fontSvg);
    
    fontSvg.querySelectorAll('path').forEach(elem => {
        textPathLength += elem.getTotalLength()
    })

    return textPathLength;
}

I just wanna know, which type of unit is it returning? because my next calculations are depending on it.
Can someone tell me about it, I am stuck?

Routing Links do not scrollto the correct section on my page when clicking

I am having problems where my navigation bar is not scrolling down to the right place when I click on the Button in the AppBar. Now it is just opening a new tab in the browser with the correct href but still with the same section(Just top of the page). I tried to wrap every <Link> component with a <section id="Contact"> and add an id. And map through the paths in my RouterNavigation
But I guess I am missing something?

RouterNavigation.tsx

    {
        title: 'About',
        path: '#About',
    },
    {
        title: 'Vision',
        path: '#Vision',
    },
    {
        title: 'Contact',
        path: '#Contact',
    },
];

function RouterNavigation() {
    return (
        <>
            {RouterData.map((item, index) => (
                <li key={index}>
                    <a href={item.path}>
                        <span>{item.title}</span>
                    </a>
                </li>
            ))}
        </>
    );
}

export { RouterNavigation };

Topbar.tsx

import React from 'react';
import Toolbar from '@mui/material/Toolbar';
import Link from '@mui/material/Link';
import { AppBar, Box } from '@mui/material';

const styles = {
    link: {
        my: 1,
        mx: 1.5,
        fontSize: '1rem',
        lineHeight: '25px',
        textTransform: 'none',
        color: '#000000',
        opacity: 1,
        padding: '10px',
        border: 'none',
        textDecoration: 'none',
    },
};

function TopBar() {
    return (
        <>
            <AppBar position={'static'} sx={{ background: 'transparent' }} elevation={0}>
                <Toolbar disableGutters>
                        <Box sx={{ display: 'flex', alignItems: 'center' }}>

                            <section id="Vision">
                            <Link
                                variant="button"
                                href="/vision"
                                target="_blank"
                                rel="noopener noreferrer"
                                sx={styles.link}>
                                Vision
                            </Link>
                            </section>

                            <Link
                                variant="button"
                                href="/team"
                                target="_blank"
                                rel="noopener noreferrer"
                                sx={styles.link}>
                                Team
                            </Link>
                            <Link
                                variant="button"
                                href="/contact"
                                target="_blank"
                                rel="noopener noreferrer"
                                sx={styles.link}>
                                Contact
                            </Link>
                        </Box>
                </Toolbar>
            </AppBar>
        </>
    );
}

export { TopBar };

Google Maps API Link Overlay

Im relatively new to coding. I have created a google maps api for my website but would like to add an overlay in the centre of the map containing an image and some text which fills the width of the map and maybe 2/3rds of the height and links to a page.

HTML:

<body>
    <h1>test</h1>

    <div id="map"></div>
    <div id="overlay"></div>

    <script src="script.js"></script>
    <script
    src="https://maps.googleapis.com/maps/api/js?key=(*key*)&amp;map_ids=(*mapid*)&amp;callback=initMap">
</script>
</body>

JS:

function initMap(){
    map = new google.maps.Map(document.getElementById('map'), {
        center: {lat: 52.336262, lng: -1.065811},
        zoom: 14,
        gestureHandling: "none",
        mapId: '*mapid*',
        mapTypeControl: false,
        fullscreenControl: false,
        streetViewControl: false,
        zoomControl: false,
        keyboardShortcuts: false,
    });

    const markers = [
        [
            52.336262,
            -1.065811,
            "*imgsrc*",
            40,
            57.4,
        ],

    ];

        for(let i = 0; i<markers.length; i++){
            const currMarker = markers[i];

            const marker = new google.maps.Marker({
                position: { lat: currMarker[0], lng: currMarker[1] },
                map,
                icon: {
                    url: currMarker[2],
                    scaledSize: new google.maps.Size(currMarker[3], currMarker[4])
                }
            });

            
        }
    

}

CSS:

#map {
    height: 60vh;
}

entry-content-wrap {
   padding: 0;
}

.gm-style-iw-d {
    font-size: 20px;
}

#overlay {
    position:fixed;
    width:100%;
    height:100%;
    background-color:rgba(0,0,0,0.5)
}

This displays the overlay underneath the map so my question is how do I make it be contained within the map filling the width?

Vue.js + Dynamically resize list based on the number of items

I have created a dropdown with input using li. However, the height of the ul is fixed. I want to set the height of ul to set dynamically based on the number of items displayed so that if there are no items in the list the height is less.

enter image description here

 <div class="filterdropdown">
            <input placeholder="Enter a filter name"/>
            <div><img src="../Images/ICE.FilterChevron.png"  @click="filters.isShow = !filters.isShow" /></div>
        </div>
        <div v-if="filters.isShow">
            <ul>
                <li v-on:click="createNew">Create new Filter</li>
                <li v-for="item in filters.entities" v-on:click="filter.changeFilter(item.id,item.name)">{{ item.name }}<div title="Delete filter">x</div></li>
            </ul>
        </div>

CSS

    ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    border: 1px solid #333;
    height: 85px;
    overflow: hidden;
    overflow-y: scroll;
}

How to pass dynamic params to name route – Vue JS

I have this LayoutVertical.vue parent component:

<script>
import LayoutVertical from "@core/layouts/layout-vertical/LayoutVertical.vue";
import AppCustomizer from "@core/layouts/components/app-customizer/AppCustomizer.vue";
import { $themeConfig } from "@themeConfig";
import navMenuItems from "@/navigation/vertical";

export default {
    components: {
        AppCustomizer,
        LayoutVertical,
    },
    data() {
        return {
            showCustomizer: $themeConfig.layout.customizer,
            navMenuItems,
        };
    },
};
</script>

This navMenuItems property contained:

export default [
    {
        header: "Projects",
    },
    {
        title: "Import",
        route: {
            name: "project-import",
            params: { token: token },
        },
        icon: "SettingsIcon",
    },
];

And the route for this:

{
    path: "/project/import/view/:token",
    name: "project-import",
    props : true,
    component: () =>
        import("@/views/apps/projects/project-import/ProjectImport.vue"),
},

Now, I have another compnent called AppNavbarVerticalLayout.vue which is child component of that parent. In this component I have a onChange methods called chooseProject. From this method I can get a token value.

My question is how can I pass this token value to that navMenuItems property’s params?

Can I set a params for a specific name route?