GraphQL query the same collection

I have a filtered query in GraphQL that return only some specific content , while I want to add this same query but to display all it content . I cannot use two similar queries in the same page , eventually I cannot pass this all data that I want , even if I add this query in a component it will cause an error of undefined .
This is the query :

  allPrismicCollection(
    sort: {fields: data___collection___text, order: ASC}
    limit: $limit
    skip: $skip
  ) {

    nodes {
      data {
        slides {
          slide {
            document {
              ... on PrismicSlide {
                data {
                  blogs {
                    blog {
                      document {
                        ... on PrismicBlog {
                          uid
                          data {
                            image {
                              gatsbyImageData(aspectRatio: 1.5)
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

and this is the query I want to add as well :

  allPrismicCollection {
    nodes {
      data {
          collection {
          text
        }
        slides {
          slide {
            document {
              ... on PrismicSlide {
                id
                data {
                  blogs {
                    blog {
                      document {
                        ... on PrismicBlog {
                          id
                          data {
                            tags {
                              tag
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      
      }
    }
  }

Any idea how to mix these queries , or maybe to add it independently in components ?!
Thanks.

how to iterate information in the state in React

Best regards. This is my first question. I am new to react and I do not know how to do with this doubt.

I make a request and I keep the answer in the state. Now I can’t deserialize the json and use it within the app. I have tried several ways that recommend online but nothing. if I make a json.stringify, I can see the information, that is, the request is correct.

this is the request I receive from the api:

{"boards":[{"items":[{"id":"John Smith","column_values":[{"text":"Caracas, Distrito Capital, Venezuela"}]},{"id":"Edith Ruza","column_values":[{"text":"Buenos Aires, CABA, Argentina"}]},{"id":"david Rios","column_values":[{"text":"Perth Australia Occidental, Australia"}]},{"id":"Peter Doe","column_values":[{"text":"Calgary, Alberta, Canadá"}]},{"id":"Mary Jones","column_values":[{"text":"London, Reino Unido"}]},{"id":"Lionel Messi","column_values":[{"text":"París, Francia"}]},{"id":"Samy Forte","column_values":[{"text":"Mexico City, CDMX, México"}]},{"id":"Tadeo Carthy","column_values":[{"text":"Tel Aviv, Israel"}]}]}]}

and this is my code that not work:

class App extends React.Component {
  constructor(props) {
    super(props);

    // Default state
    this.state = {
      setData:{},
      settings: {},
      myData: {},      
    };
  }
  com
  componentDidMount() {
    
    monday
      .api('query { boards( ids : 2664704591 ) { items { id : name column_values(ids : "ubicaci_n") { text }}}}')
          .then(res => {this.setState({myData: res.data})});
  }
  
  render() {    
    return (
      
      <div className="App">
        <AttentionBox
          title="hola"
          text="Let's start building your amazing app, which will change the world!"          
        />
        <div className="btn btn-primary"></div>
        <button className="btn btn-warning"></button>
        <div>
          {this.state.myData.map((property) => {
            return (<div>property</div>)
          })}
        </div>        
      </div>
    );
  }
}

export default App;

I would greatly appreciate any clue to move forward

TypeError: Cannot read properties of undefined (reading ‘map’) (JavaScript array map)

In my React component, I am receiving the props, below is the component. I simply need to grab the props i.e. data and map it and render the data

Component

import * as React from "react";
    import { Box } from "@chakra-ui/react";
    import CourseCard from "./CourseCard";
    import CourseGrid from "./CourseGrid";
    
    const CardLayout = ({ data }) => {
      console.log(data);
      return (
        <Box
          maxW="7xl"
          mx="auto"
          px={{
            base: "4",
            md: "8",
            lg: "12",
          }}
          py={{
            base: "4",
            md: "8",
            lg: "12",
          }}
        >
          <CourseGrid>
            {data.getPs_courseList.map((course) => (
              <CourseCard key={course.slug} course={course} />
            ))}
          </CourseGrid>
        </Box>
      );
    };

export default CardLayout;

Incoming Props

{
  "getPs_courseList": [
    {
      "short_desc": "JavaScript for Beginners",
      "slug": "javascript_for_beginners",
      "price": "10$",
      "trainer_name": "John",
      "language": "English",
      "level": "Beginner",
      "length_in_minutes": "120"
    },
    {
      "short_desc": "What is GraphQL?",
      "slug": "what_is_graphql",
      "price": "FREE",
      "trainer_name": "Anita",
      "language": "English",
      "level": "Intermediate",
      "length_in_minutes": "230"
    }
  ]
}

when I am trying to use the map function like below, I am getting an error. Can anyone suggest what is it I am missing here?

 {data.getPs_courseList.map((course) => (
          <CourseCard key={course.slug} course={course} />
        ))}

Error

enter image description here

How to insert block of html into eleventy template

enter image description here

I’m trying to move a website from python to eleventy. My file structure is in the screenshot above. I’ve been following some tutorials such as https://dev.to/loige/getting-started-with-eleventy-in-11-minutes-496j

I want to insert a block of html into a template. I tried putting the filename into the template called test.njk using the numchucks front matter:

---
title: hi
question: there
need3: need3.njk
---
<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

But this does not add the actual html (only the filename). Please see below, How can I add the block of html into the template

enter image description here

how to Implement array.flat() like method for a class extending the builtin Set method in typescript?

I have extended the builtin Set class and want to implement a flat method which behaves like Array.prototype.flat()

export class ExtendedSet<S> extends Set{
  constructor(arr?: Array<S>){
    super(arr)
  }
  flat(){
    let newSet = new ExtendedSet();
    for (let x of this){
      if(x instanceof ExtendedSet){
        newSet.add(x.flat())
      }else{
        newSet.add(x)
      }
    }
    return newSet
  }
  
}

for the above flat method how do i provide type declarations such that, if instance for which the flat method is called is ExtendedSet<ExtendedSet<number>>, then the ?return type is ExtendedSet<number>

“Default” method for a Date object

In Node REPL, I get the following:

> console.log(new Date())
2022-06-21T14:52:30.675Z
undefined
> console.log(new Date().toString())
Tue Jun 21 2022 14:52:36 GMT+0000 (Coordinated Universal Time)
undefined

In the first statement, what is the method that was invoked on the Date object, if any?

Div going up, on scroll down

I am creating a single article page to show articles.What i wanted is to have a nice background (article image)and my article body,around midway of my page.When i scroll down though,i want the article body to go up.
This is what i have done so far.I tried to play around with scrollY and what i’m essentially trying to do is subtract from my “top” attibute ,every time there is a scroll. F.e. my article body has top=100px,when i scroll down 20px,i want my “top” to be 100-20=80.

  const container = document.getElementById('article-container');
  
  window.addEventListener('scroll',()=>{
    console.log(scrollY)
      container.style.top= `${378-scrollY} px`
  })
  main{
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .article-image{
    position: absolute;
    z-index: 0.9;
    min-height: 85vh;
    opacity: 0.9;
  }

  .article-container{
    width: 50%;
    position: relative;
    top: 35vh;
    z-index:1;
    background-color: white;
    min-height: 50vh;
    padding: 30px;
    color: #1A2434;
    -webkit-box-shadow: 0px 0px 15px 5px #1A2434 ; 
    box-shadow: 0px 0px 15px 5px #1A2434 ;
  }

  .article-container h1{
    font-size: 3rem;
  }

  .article-container .date{
    font-size: 0.8rem;
    padding-top: 4vh;
    font-family: 'Zona Pro Thin';
    color: rgba(0, 0, 0, 0.5);
  }

  .article-container .article-description{
    font-size: 1.2 rem;
    padding-top: 4vh;
    font-family: 'Zona Pro Thin';
    color:#1a2434d0;
    font-weight: bolder;
  }
<main>
  <img class='article-image' src="<%= article.image %>">
  <div class="article-container" id="article-container">
    <h1>Article Title</h1>
    <div class="date">
      21/6/2022
    </div> 
    <div class="article-description">
      Article Description
    </div>
  </div>
</main>

Uploading An Avatar Image Using The Stream-Chat API (GetStream.io)

I am currently working on a Stream-Chat API project, and I want the users to be able to upload an image directly from their device. When I have tested it, everything goes without issue, but the image doesn’t get displayed, only the default avatar of the first user’s letter. Is there any way to fix it?

This is the code which handles the image input:

{isSignup && (
                            <div className="auth__form-container_fields-content_input">
                                <label htmlFor="avatarURL">Profile Picture</label>
                                <input 
                                    name="avatarURL" 
                                    type="file"
                                    accept="image/apng, image/avif, image/gif, image/jpeg, image/png, image/svg+xml, image/webp"
                                    placeholder="Avatar URL"
                                    onChange={handleChange}
                                    required
                                />
                            </div>
                        )}

This is the handleChange function:

const handleChange = (e) => {
        setForm({ ...form, [e.target.name]: e.target.value });
    }

How to display a PDF without downloading

I have a PDF like like this:

"http://centraldata.s3.amazonaws.com/.....pdf?AWSAccessKeyId=...."

which I get from an api call. Then I pass it into an link so that users can click and download it.

<a href={pdfUrl} />

So, my question is, is there a way to let user view the PDF without downloading it? Except passing the Url into an tag, I don’t know if there is any other way to use this link

Multilevel drop down menu with Hover and Click with different media queries | No Jquery please

I made a small multilevel navbar using vanilla JS and HTML & CSS. I cant seem to get the click one working. So the task is, have the navbar have hover if it is desktop version, and have click if it is a mobile version. Below will be my JS, CSS and HTML codes. I made a JS code so that it opens when I click, but cant seem to open its child element, which is another ul, I tried everything and cant seem to get around it. I made a hover effect for the desktop version, but I just cant figure out how to do the JS version

let menu = document.querySelector(".menu ul");
menu = menu.children;

for (let i = 0; i < menu.length; i++) {
  console.log(menu[i]);
  menu[i].addEventListener("click", function() {
    menu[i].firstElementChild.classList.toggle("show");
    console.log(menu[i].firstElementChild);
  });
}
.menu {
  --menu-height: 40px;
  box-sizing: border-box;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
}
.menu ul {
  list-style: none;
  padding: 16px;
  margin: 0;
}
.menu ul li,
.menu ul li a {
  opacity: 0.8;
  color: #ffffff;
  cursor: pointer;
  transition: 200ms;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 700;
}
.menu ul li a,
.menu ul li a a {
  display: flex;
  align-items: center;
  height: 100%;
  width: 100%;
}
.menu ul li {
  padding-right: 36px;
}
.menu ul li::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #ffa500;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}
.menu ul .link::before {
  padding-right: 0;
  display: none;
}
.menu > ul {
  display: flex;
  height: var(--menu-height);
  align-items: center;
  background-color: #000000;
}
.menu > ul li {
  position: relative;
  margin: 0 8px;
}
.menu > ul li ul {
  visibility: hidden;
  opacity: 0;
  padding: 0;
  min-width: 160px;
  background-color: #333;
  position: absolute;
  top: 45px;
  left: 50%;
  transform: translateX(-50%);
  transition: 200ms;
  transition-delay: 200ms;
}
.menu > ul li ul li {
  margin: 0;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 30px;
  padding-right: 40px;
}
.menu > ul li ul li::before {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 5px solid #ffa500;
}
.menu > ul li ul li ul {
  top: -2%;
  left: 100%;
  transform: translate(0);
}

.show {
  display: flex;
}

.hide {
  display: none;
}

@media screen and (min-width: 1200px) {
  .menu ul li:hover,
  .menu ul li a:hover {
    opacity: 1;
  }
  .menu > ul li ul li:hover {
    background: black;
  }
  .menu > ul li:hover > ul {
    opacity: 1;
    visibility: visible;
    transition-delay: 0ms;
  }
}

@media screen and (max-width: 1200px) {
  .menu {
    height: 100vh;
    top: 0;
    left: 0;
    width: 20vw;
  }
  .menu ul {
    flex-direction: column;
    height: 100vh;
  }
  .menu ul li {
    margin: 1rem 0;
  }
  .menu ul li ul {
    visibility: hidden;
    opacity: 0;
    padding: 0;
    min-width: 160px;
    background-color: #333;
    position: absolute;
    top: 0px;
    left: 200%;
    transform: translateX(-50%);
    transition: 200ms;
    transition-delay: 200ms;
    height: fit-content;
  }
}
<div class="menu">
  <ul>
    <li>
      Parent 1
      <ul>
        <li class="link">
          <a href="">Child 1</a>
        </li>
        <li class="link">
          <a href="">Child 2</a>
        </li>
        <li>
          Nested child
          <ul>
            <li class="link">
              <a href="">Something</a>
            </li>
            <li class="link">
              <a href="">Something</a>
            </li>
          </ul>
        </li>
      </ul>
    </li>
    <li>
      Parent 2
      <ul>
        <li class="link">
          <a href="">Basic link 1</a>
        </li>
        <li class="link">
          <a href="">Basic link 2</a>
        </li>
        <li>
          Nested child 2
          <ul>
            <li class="link">
              <a href="">Basic nested link 1</a>
            </li>
            <li class="link">
              <a href="">Basic nested link 2</a>
            </li>

          </ul>
        </li>
      </ul>
    </li>
    <li class="link">Simple Link</li>
    <li class="link">Another Link</li>
  </ul>
</div>

I want to take the value of textarea and display the value at submit (react)

I searched without necessarily finding. I would like to get the value of the textarea and at submit display the value in the paragraph of the component.

My project is to create a kind of application to take notes. You have to enter in a field the note then by validating the form, your note is added below.

Thanks to you and have a nice day

//Into note.js

import React from 'react';
import AddNote from './addnote';

class Note extends React.Component {

    constructor(props) {
        super(props);
        this.state = { value: '' };

        this.handleChange = this.handleChange.bind(this);
        this.handleSubmit = this.handleSubmit.bind(this);
    }

    handleChange(event) {
        this.setState({ value: event.target.value });
    }

    handleSubmit(event) {
        event.preventDefault();
    }



    render() {
        return (
            <>
                <div className='title'>
                    <h1>Notes</h1>
                    <span className="LineTitle"></span>
                </div>
                <form id="form" onSubmit={this.handleSubmit}>
                    <textarea className="textNote" id="textZone" value={this.state.value} onChange={this.handleChange}></textarea>
                    <button type="submit" className="addBtn">Ajouter</button>
                    <button type="reset" className="deleteBtn">Supprimer</button>
                </form>

                <AddNote />
                
            </>
        )
    }
}

export default Note;
//into addnote.js

import React from 'react';
import Note from './note';

class AddNote extends React.Component {



    render() {
        return (
            <>
                <h3 className="NoteDetails">date/heure/minutes</h3>
                <span className="NoteLine"></span>
                <div className="notes">
                    <p></p> // the value of textarea into
                </div>

            </>
        )
    }
}

export default AddNote;

strong text