nss-evening-cohort-10 / nutshell-star-destroyer

0 stars 1 forks source link

Planetary System Mission: Read #87

Open ConnorSullivan10 opened 4 years ago

ConnorSullivan10 commented 4 years ago

User Story

As a user, I'd like to see the available Planetary Systems when choosing mission options.

AC

GIVEN a user is on the Missions page WHEN they click the "View Details" button on the mission THEN they should see a "System" card with a "View Details" button AND when they click the "View Details" button THEN On READ, they should only be able to see the one planetary system attributed to the mission.

Dev Notes

const systemMissionCard = (mission) => {
let domString = '';
    domString += `
          <div id="${mission.planetaryId}" class="card foodCard card-body text-center" style=" width: 20em; max-width: 500px; height: 100%; margin: 2em;">
              <h2>Planetary System</h2>
  smash.getAllPlanetarySystemById(mission.planetaryID);
        .then ( (planetSystem) {
            domstring+= <img src="${planetSystem.planetaryImg}" class="card-img-top" style="width: 100%; height: auto;" alt="..."/>
         });
      domString += <button type="button" class="btn view-system-details" " id="${mission.planetaryId}" style="background-color: red;"> View Details</button>
          </div>`;
  utilities.printToDom('systemMissions', domString);
};

image

const bigSystemCard = (e) => {
const planetSystemId = e.target.id;
smash.getAllPlanetarySystemById(mission.planetaryID);
 .then ( (planetSystem) {
let domString = '';
      domString += `
      <div class=" system-bigCard text-center ${planetSystemId}">
         <button class="close-system d-flex justify-content-end" style="color:red;">X</button>
         <h2>${planetSystem.name}</h2>
         <img src="${planetSystem.planetaryImg}"/>
         <h5>Size = ${planetSystem.size}</h5>
         <h5>Ally? = ${planetSystem.isAlly}</h5>
         <p>${planetSystem.info}</p>
     </div>
        `;
});
  utilities.printToDom('bigSystem', domString);
};
const closeBigSystemCard = () => {
  $('body').on('click', '.close-system', () => {
    utilities.printToDom('bigSystemCard', '');
    *insert function that prints all component cards inside the mission after clicking "View Details*
  });
};
systemBigCardClick
gregkorte commented 4 years ago

In AC: On READ, they should only be able to see the one planetary system attributed to the mission.