{"ast":null,"code":"import _toConsumableArray from\"C:/Users/user/Desktop/00monsite/front/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";import _slicedToArray from\"C:/Users/user/Desktop/00monsite/front/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import React,{useEffect,useState}from\"react\";import Navbar from\"../components/Navbar\";import axios from\"axios\";import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";var Destination=function Destination(){var _useState=useState({}),_useState2=_slicedToArray(_useState,2),currentDestination=_useState2[0],setCurrentDestination=_useState2[1];var _useState3=useState([]),_useState4=_slicedToArray(_useState3,2),destinations=_useState4[0],setDestinations=_useState4[1];useEffect(function(){fetch(\"data.json\").then(function(response){return response.json();}).then(function(data){setDestinations(data.destinations);setCurrentDestination(data.destinations[0]);});},[]);useEffect(function(){content();},[currentDestination]);function select(text){var selectedDestination=destinations.find(function(destination){return destination.name===text.innerHTML;});setCurrentDestination(selectedDestination);var siblings=function siblings(n){return _toConsumableArray(n.parentElement.children).filter(function(c){return c!==n;});};var brothers_n_sisters=siblings(text);text.classList.replace(\"destination__select\",\"nav-text--active\");brothers_n_sisters.forEach(function(e){return e.classList.replace(\"nav-text--active\",\"destination__select\");});}function content(){if(currentDestination!==null&&currentDestination!==void 0&&currentDestination.images){setPictureSrc(currentDestination.images.png);setName(currentDestination.name);setDescription(currentDestination.description);setDistance(currentDestination.distance);setTravel(currentDestination.travel);}}// Dans le corps de la fonction Destination\nvar _useState5=useState(\"\"),_useState6=_slicedToArray(_useState5,2),pictureSrc=_useState6[0],setPictureSrc=_useState6[1];var _useState7=useState(\"\"),_useState8=_slicedToArray(_useState7,2),name=_useState8[0],setName=_useState8[1];var _useState9=useState(\"\"),_useState10=_slicedToArray(_useState9,2),description=_useState10[0],setDescription=_useState10[1];var _useState11=useState(\"\"),_useState12=_slicedToArray(_useState11,2),distance=_useState12[0],setDistance=_useState12[1];var _useState13=useState(\"\"),_useState14=_slicedToArray(_useState13,2),travel=_useState14[0],setTravel=_useState14[1];return/*#__PURE__*/_jsxs(\"div\",{className:\"bg-destination \",children:[/*#__PURE__*/_jsx(Navbar,{}),/*#__PURE__*/_jsxs(\"section\",{children:[/*#__PURE__*/_jsx(\"div\",{children:/*#__PURE__*/_jsxs(\"h4\",{children:[\" \",/*#__PURE__*/_jsx(\"span\",{className:\"number\",children:\"01\"}),\" PICK YOUR DESTINATION\"]})}),/*#__PURE__*/_jsxs(\"div\",{className:\"container\",children:[/*#__PURE__*/_jsx(\"div\",{className:\"containerAll centre\",children:/*#__PURE__*/_jsx(\"div\",{children:/*#__PURE__*/_jsx(\"img\",{id:\"picture\",className:\"destination__content--planet\",src:pictureSrc,alt:\"\"})})}),/*#__PURE__*/_jsxs(\"div\",{className:\"containerAll \",children:[/*#__PURE__*/_jsx(\"nav\",{className:\"navbar \",id:\"navDestination\",children:destinations.map(function(destination){return/*#__PURE__*/_jsx(\"h6\",{className:\"nav-link nav-text \".concat(currentDestination.name===destination.name?\"nav-text--active\":\"destination__select\"),onClick:function onClick(e){return select(e.target);},children:destination.name},destination.name);})}),/*#__PURE__*/_jsxs(\"div\",{className:\"tex_destination\",children:[/*#__PURE__*/_jsx(\"div\",{id:\"name\",children:/*#__PURE__*/_jsx(\"h3\",{children:name})}),/*#__PURE__*/_jsx(\"div\",{className:\"descriptionP\",children:/*#__PURE__*/_jsx(\"p\",{id:\"description\",children:description})}),/*#__PURE__*/_jsxs(\"div\",{className:\"distanceTravel d-flex justify-content-between\",children:[/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"p\",{children:\"AVG.DISTANCE\"}),/*#__PURE__*/_jsx(\"div\",{id:\"distance\",children:distance})]}),/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"p\",{children:\"EST.TRAVEL TIME\"}),/*#__PURE__*/_jsxs(\"div\",{id:\"travel\",children:[travel,\" \"]})]})]})]})]})]})]})]});};export default Destination;","map":{"version":3,"names":["React","useEffect","useState","Navbar","axios","Destination","currentDestination","setCurrentDestination","destinations","setDestinations","fetch","then","response","json","data","content","select","text","selectedDestination","find","destination","name","innerHTML","siblings","n","parentElement","children","filter","c","brothers_n_sisters","classList","replace","forEach","e","images","setPictureSrc","png","setName","setDescription","description","setDistance","distance","setTravel","travel","pictureSrc","map","target"],"sources":["C:/Users/user/Desktop/00monsite/front/src/page/Destination.js"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\r\nimport Navbar from \"../components/Navbar\";\r\nimport axios from \"axios\";\r\n\r\nconst Destination = () => {\r\n  const [currentDestination, setCurrentDestination] = useState({});\r\n  const [destinations, setDestinations] = useState([]);\r\n  \r\n\r\n  useEffect(() => {\r\n    fetch(\"data.json\")\r\n      .then((response) => response.json())\r\n      .then((data) => {\r\n        setDestinations(data.destinations);\r\n        setCurrentDestination(data.destinations[0]);\r\n      });\r\n  }, []);\r\n\r\n  useEffect(() => {\r\n    content();\r\n  }, [currentDestination]);\r\n\r\n  function select(text) {\r\n    const selectedDestination = destinations.find(\r\n      (destination) => destination.name === text.innerHTML\r\n    );\r\n    setCurrentDestination(selectedDestination);\r\n\r\n    var siblings = (n) => [...n.parentElement.children].filter((c) => c !== n);\r\n\r\n    var brothers_n_sisters = siblings(text);\r\n    text.classList.replace(\"destination__select\", \"nav-text--active\");\r\n    brothers_n_sisters.forEach((e) =>\r\n      e.classList.replace(\"nav-text--active\", \"destination__select\")\r\n    );\r\n  }\r\n\r\n  function content() {\r\n    if (currentDestination?.images) {\r\n      setPictureSrc(currentDestination.images.png);\r\n      setName(currentDestination.name);\r\n      setDescription(currentDestination.description);\r\n      setDistance(currentDestination.distance);\r\n      setTravel(currentDestination.travel);\r\n    }\r\n  }\r\n\r\n  // Dans le corps de la fonction Destination\r\n  const [pictureSrc, setPictureSrc] = useState(\"\");\r\n  const [name, setName] = useState(\"\");\r\n  const [description, setDescription] = useState(\"\");\r\n  const [distance, setDistance] = useState(\"\");\r\n  const [travel, setTravel] = useState(\"\");\r\n\r\n  return (\r\n    <div className=\"bg-destination \">\r\n      <Navbar />\r\n      <section>\r\n          <div>\r\n            <h4> <span className=\"number\">01</span> PICK YOUR DESTINATION</h4>\r\n          </div>\r\n      <div className=\"container\">\r\n        <div className=\"containerAll centre\">\r\n          <div>\r\n            <img\r\n              id=\"picture\"\r\n              className=\"destination__content--planet\"\r\n              src={pictureSrc}\r\n              alt=\"\"\r\n            />\r\n          </div>\r\n        </div>\r\n        <div className=\"containerAll \">\r\n          <nav className=\"navbar \" id=\"navDestination\">\r\n            {destinations.map((destination) => (\r\n              <h6\r\n                key={destination.name}\r\n                className={`nav-link nav-text ${\r\n                  currentDestination.name === destination.name\r\n                    ? \"nav-text--active\"\r\n                    : \"destination__select\"\r\n                }`}\r\n                onClick={(e) => select(e.target)}\r\n              >\r\n                {destination.name}\r\n              </h6>\r\n            ))}\r\n          </nav>\r\n\r\n          <div className=\"tex_destination\">\r\n            <div id=\"name\">\r\n              <h3>{name}</h3>\r\n            </div>\r\n            <div className=\"descriptionP\">\r\n              <p id=\"description\">{description}</p>\r\n            </div>\r\n            <div className=\"distanceTravel d-flex justify-content-between\">\r\n              <div>\r\n                <p>AVG.DISTANCE</p>\r\n                <div id=\"distance\">{distance}</div>\r\n              </div>\r\n              <div>\r\n               <p>EST.TRAVEL TIME</p>\r\n              <div id=\"travel\">{travel} </div>\r\n              </div>\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n      </section>\r\n    </div>\r\n  );\r\n};\r\n\r\nexport default Destination;\r\n"],"mappings":"8PAAA,MAAOA,MAAK,EAAIC,SAAS,CAAEC,QAAQ,KAAQ,OAAO,CAClD,MAAOC,OAAM,KAAM,sBAAsB,CACzC,MAAOC,MAAK,KAAM,OAAO,CAAC,wFAE1B,GAAMC,YAAW,CAAG,QAAdA,YAAW,EAAS,CACxB,cAAoDH,QAAQ,CAAC,CAAC,CAAC,CAAC,wCAAzDI,kBAAkB,eAAEC,qBAAqB,eAChD,eAAwCL,QAAQ,CA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