Type '{ oldGroupes: Groupe[]; key: number; id: number; oldX: any; oldY: any; comesFromPageArtist: boolean; nomArtiste: string; description: string | undefined; date: string; heure: string; setIsNavTransparent: (isNavTransparent: boolean) => void; }' is not assignable to type 'IntrinsicAttributes & Props'.
Property 'description' does not exist on type 'IntrinsicAttributes & Props'.description={description} // Passer la description appropriéeimport {useEffect, useState, useRef, useLayoutEffect} from 'react'
import SearchBar from '../../components/form/SearchBar';
import Combo from '../../components/form/Combo';
import CarteArtiste from '../../components/Artiste/CarteProgrammation';
import { motion } from 'framer-motion';
import { useLocation } from 'react-router-dom';
import axios from 'axios';
import Footer from '../../components/footer';
import CarteProgrammation from '../../components/Artiste/CarteProgrammation';
type Props = {
isNavInFocus: boolean;
setIsNavTransparent: (isNavTransparent : boolean) => void;
}
type Groupe = {
idG: number;
nomG: string;
descriptionG: string;
datePassage: string;
heurePassage: string;
}
type Artiste = {
descriptionA?: string;
idMG?: number;
idG: number;
nomDeSceneMG: string;
nomMG: string;
prenomMG?: string;
datePassage?: string;
heurePassage?: string;
};
type Evenement = {
dateDebutE: string;
dateFinE: string;
heureDebutE: string,
heureFinE: string,
idE: number;
idG: number;
idL: number | null;
nomE: string;
};
type Programme = Groupe | Evenement | Artiste;
export default function Programmation(props : Props) {
const location = useLocation();
const idArtistComingFrom = location.state?.comesFromPageArtist;
const oldX = location.state?.oldX;
const oldY = location.state?.oldY;
const oldGroupes = location.state?.oldGroupes;
window.history.replaceState({}, document.title)
const[lesGroupes, setLesGroupes] = useState<Groupe[]>(location.state? oldGroupes : []);
const [lesArtistes, setLesArtistes] = useState<Artiste[]>([]);
useEffect(() => {
axios.get('http://localhost:8080/getGroupesWithEvenements').then((res) => {
const groupedData = res.data as Programme[][];
const listeGroupes: Groupe[] = [];
const listeArtistes: Artiste[] = [];
console.log(groupedData);
groupedData.forEach((groupArray) => {
let groupeObj: Partial<Groupe> = {};
let artisteObj: Partial<Artiste> = {};
groupArray.forEach((item) => {
if ('nomG' in item) {
groupeObj = { ...groupeObj, ...item }; // Copier les infos du groupe
} else if ('nomDeSceneMG' in item) {
artisteObj = { ...artisteObj, ...item }; // Copier les infos de l'artiste
} else if ('dateDebutE' in item) {
// S'assurer que l'évènement correspond au groupe ou à l'artiste actuellement traité
const datePassage = item.dateDebutE;
const heurePassage = item.heureDebutE;
if (groupeObj.idG === item.idG) {
groupeObj.datePassage = datePassage;
groupeObj.heurePassage = heurePassage;
}
if (artisteObj.idG === item.idG) {
artisteObj.datePassage = datePassage;
artisteObj.heurePassage = heurePassage;
}
}
});
if (groupeObj.idG != null) {
listeGroupes.push(groupeObj as Groupe);
}
if (artisteObj.nomDeSceneMG != null) {
listeArtistes.push(artisteObj as Artiste);
}
});
setLesGroupes(listeGroupes);
setLesArtistes(listeArtistes);
console.log("listeArtistes : ")
console.log(listeArtistes)
console.log("listeGroupes : ")
console.log(listeGroupes)
});
}, []);
const[filtreDate, setFiltreDate] = useState("Tout");
const[filtreAffichage, setFiltreAffichage] = useState("Grille");
const[filtreGenre, setFiltreGenre] = useState("Tout");
const pageRef = useRef(null);
const contentVariants = {
visible:{
filter: "blur(0px)",
scale:1,
zIndex:1,
transition:{
duration:0.5,
ease: [1, 0, 0,1]
}
},
hidden:{
filter:"blur(10px)",
scale:0.8,
zIndex:-1,
transition:{
duration:0.5,
ease: [1, 0, 0,1]
}
}
}
useEffect(() => {
window.scrollTo(0, 0)
props.setIsNavTransparent(false)
}, [])
return (
<>
<motion.div id="Programmation"
className='page-defaut'
variants={contentVariants}
animate={props.isNavInFocus ? "hidden" : "visible"}
ref={pageRef}
>
PROGRAMMATION
<Combo title="DATE" choices={["Tout", "21 Juillet", "22 Juillet", "23 Juillet"]} currentChoice={filtreDate} setCurrentChoice={setFiltreDate} />
<Combo title="AFFICHAGE" choices={["Grille", "Horaires"]} currentChoice={filtreAffichage} setCurrentChoice={setFiltreAffichage} />
<Combo title="GENRE" choices={["Tout", "Rap", "Rock", "Pop"]} currentChoice={filtreGenre} setCurrentChoice={setFiltreGenre} />
{
// Combiner les deux listes sans les trier
[...lesGroupes, ...lesArtistes].map((performer, index) => {
const isGroup = 'nomG' in performer;
const nomArtiste = isGroup ? performer.nomG : performer.nomDeSceneMG;
const description = isGroup ? performer.descriptionG : performer.descriptionA;
const datePassage = performer.datePassage ?? "Date inconnue";
const heurePassage = performer.heurePassage ?? "Heure inconnue";
return(
<CarteProgrammation
oldGroupes={lesGroupes}
key={performer.idG}
id={performer.idG}
oldX={idArtistComingFrom == performer.idG ? oldX : null}
oldY={idArtistComingFrom == performer.idG ? oldY : null}
comesFromPageArtist={idArtistComingFrom == performer.idG}
nomArtiste={nomArtiste}
description={description} // Passer la description appropriée
date={datePassage} // Passer la date avec un fallback
heure={heurePassage}
setIsNavTransparent={props.setIsNavTransparent}
/>
)
})
}
</motion.div>
<Footer/>
</>
)
}
import { motion } from 'framer-motion'
import {useState,useRef, useEffect} from 'react'
import { Link } from 'react-router-dom'
type Props = {
id:number,
date: string,
heure: string,
nomArtiste: string,
setIsNavTransparent: (isNavTransparent : boolean) => void;
comesFromPageArtist?: boolean;
oldX?: number;
oldY?: number;
oldGroupes?: Groupe[];
}
type Groupe = {
idG: number;
nomG: string;
descriptionG: string;
datePassage: string;
heurePassage: string;
}
export default function CarteProgrammation(props: Props) {
// change le nomArtiste en majuscule et remplace les espaces par des retours à la ligne
const nomArtiste = props.nomArtiste.toUpperCase().split(" ")
const[isHovered, setIsHovered] = useState(false)
const[isSwitching, setIsSwitching] = useState(false)
const[delay, setDelay] = useState(props.comesFromPageArtist? 0.2 : 0)
const refCarte = useRef(null);
const[zIndexCard, setZIndexCard] = useState(props.comesFromPageArtist ? 99 : 1)
useEffect(() => {
setTimeout(() => {
console.log(props.date)
console.log(props.heure)
setZIndexCard(1)
setDelay(0)
}, 600);
}, [])
const titleVariants = {
hover:{
fontSize: "2.3rem",
color:"#FFD600",
transition:{
duration:0.4,
ease: [1, 0, 0,1]
}
},
default:{
fontSize: "2.3rem",
color:"#FFFBEE",
transition:{
delay:delay,
duration:0.4,
ease: [1, 0, 0,1]
}
},
exit:{
fontSize: "7.625rem",
color:"#FFD600",
transition:{
duration:0.4,
ease: [1, 0, 0,1]
}
}
}
// fais le variant pour l'image de l'artiste (scale 1.2 sur hover)
const imageVariants = {
hover:{
scale:1.3,
transition:{
duration:0.4,
ease: [1, 0, 0,1]
}
},
default:{
scale:1,
transition:{
duration:0.4,
ease: [1, 0, 0,1]
}
}
}
// fais le variant pour le texte de dateHeure (x 2rem sur hover)
const dateHeureVariants = {
hover:{
y:"0rem",
fontSize: "1.875rem",
transition:{
duration:0.4,
ease: [1, 0, 0,1]
}
},
default:{
y:(window.innerWidth <= 576 ? 3.1 : 2.9).toString() + "rem",
fontSize: "1.875rem",
transition:{
delay:delay,
duration:0.4,
ease: [1, 0, 0,1]
}
},
exit:{
y:"0rem",
fontSize: "4.6875rem",
transition:{
duration:0.4,
ease: [1, 0, 0,1]
}
}
}
// default font-size: 1.875rem;
// exit font-size: 4.6875rem;
const heureVariants = {
hover:{
transition:{
duration:0.4,
ease: [1, 0, 0,1]
}
},
default:{
transition:{
duration:0.4,
ease: [1, 0, 0,1]
}
},
}
const carteVariants = {
default:{
zIndex:zIndexCard,
width: "24rem",
height: "15.5rem",
y:0,
x:0,
transition:{
delay:0.2,
duration:0.4,
ease: [1, 0, 0,1]
}
},
exit:{
x: refCarte.current? -refCarte.current.offsetLeft : props.oldX? -props.oldX : 0,
y: refCarte.current? -refCarte.current.offsetTop : props.oldY? -props.oldY : 0,
height: "100vh",
width: "100vw",
zIndex:99,
transition:{
duration:0.4,
ease: [1, 0, 0,1]
}
}
}
const textVariants = {
default:{
padding: "0.5rem 1rem",
transition:{
delay:delay*2,
duration:0.4,
ease: [1, 0, 0,1]
}
},
exit:{
padding: "3rem",
transition:{
duration:0.4,
ease: [1, 0, 0,1]
}
}
}
return (
<motion.div
className="outer-carte-artiste"
ref={refCarte}
variants={carteVariants}
initial={props.comesFromPageArtist ? "exit" : "default"}
animate="default"
exit={isSwitching ? "exit" : "default"}
onClick={() => window.scrollTo(0,0)}
>
<Link className="carte-artiste"
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
to={{
pathname:"/artiste",
search:?id=${props.id},
}}
state={{
nomArtiste: props.nomArtiste,
date: props.date,
heure: props.heure,
oldX: refCarte.current?.offsetLeft,
oldY: refCarte.current?.offsetTop,
oldGroupes: props.oldGroupes
}}
onClick={() => {props.setIsNavTransparent(true); setIsSwitching(true)}}
>
<motion.img
src={"http://localhost:8080/getImageArtiste/" + props.id}
alt="image de l'artiste"
variants={imageVariants}
initial="default"
animate={isHovered ? "hover" : "default"}
exit="default"
/>
<motion.div className="texts"
variants={textVariants}
initial={props.comesFromPageArtist ? "exit" : "default"}
animate="default"
exit={isSwitching ? "exit" : "default"}
>
<motion.h3
variants={titleVariants}
initial={props.comesFromPageArtist ? "exit" : "default"}
animate={isHovered ? "hover" : "default"}
exit={isSwitching ? "exit" : "default"}
>{
nomArtiste.map((mot, index) => {
return(
{mot}
)
})
}</motion.h3>
<motion.div className="date-heure"
variants={dateHeureVariants}
initial={props.comesFromPageArtist ? "exit" : "default"}
animate={isHovered ? "hover" : "default"}
exit={isSwitching ? "exit" : "default"}
>
<h4
>{props.date}</h4>
<motion.h4
variants={heureVariants}
initial="default"
animate={isHovered ? "hover" : "default"}
exit={isSwitching ? "exit" : "default"}
>{props.heure}</motion.h4>
</motion.div>
</motion.div>
</Link>
</motion.div>
)
}