This repository was archived by the owner on Oct 14, 2025. It is now read-only.
generated from HackYourFuture-CPH/hyf-assignment-template
-
Notifications
You must be signed in to change notification settings - Fork 64
React1 week2/hossein #46
Open
hossein1065
wants to merge
4
commits into
HackYourFuture-CPH:main
Choose a base branch
from
hossein1065:react1-week2/hossein
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| const OurCrew = () => { | ||
|
|
||
| const crewMembers = [ | ||
| { | ||
| name: "Captain Sarah Vega", | ||
| role: "Captain", | ||
| description: "A former NASA astronaut with over 15 years of experience, Captain Vega leads our missions with unparalleled expertise and a passion for space exploration.", | ||
| image: "/crew/image-anousheh-ansari.png" | ||
| }, | ||
| { | ||
| name: "Dr. Leo Redding", | ||
| role: "Chief Astrophysicist", | ||
| description: "Dr. Redding is a renowned scientist who has contributed to major space discoveries. He ensures that every journey is as educational as it is exhilarating.", | ||
| image: "/crew/image-douglas-hurley.png" | ||
| }, | ||
| { | ||
| name: "Chief Engineer Hana Lee", | ||
| role: "Chief Engineer", | ||
| description: "With her extensive background in aerospace engineering, Hana Lee is responsible for the state-of-the-art technology that powers our spacecraft. Her innovation ensures that our travelers are always in safe hands.", | ||
| image: "/crew/image-mark-shuttleworth.png" | ||
| }, | ||
| { | ||
| name: "Mission Specialist Alex Santos", | ||
| role: "Mission Specialist", | ||
| description: "As a mission specialist, Alex’s job is to ensure that every aspect of the journey runs smoothly. With a background in both science and adventure tourism, Alex is the perfect guide for our space travelers.", | ||
| image: "/crew/image-victor-glover.png" | ||
| }, | ||
| { | ||
| name: "Crew Member Maya Patel", | ||
| role: "Crew Member", | ||
| description: "Maya brings a unique blend of technical skills and customer service experience to the team. She’s always ready to assist with any needs and to make sure every traveler has an unforgettable experience.", | ||
| image: "/crew/image-mark-shuttleworth.png" | ||
| } | ||
| ]; | ||
| // TASK - React 1 week 1 | ||
| // Create the "Our Crew section" | ||
| // Use the descriptions provided in /app/about_us/README.md | ||
| // Use the pictures from /public/crew | ||
| // Some inspiration ideas found in /data/inspiration_about_us | ||
| return ( | ||
| <section> | ||
| <h2>Our Crew</h2> | ||
| <div style={{ display: 'flex', flexWrap: 'wrap', gap: '20px' }}> | ||
| {crewMembers.map((member, index) => ( | ||
| <div key={index} style={{ border: '1px solid #ccc', padding: '15px', borderRadius: '8px', width: '220px', textAlign: 'center' }}> | ||
| <img src={member.image} alt={member.name} style={{ width: '100%', height: '220px', objectFit: 'cover', borderRadius: '5px' }} /> | ||
| <h3>{member.name}</h3> | ||
| <h4>{member.role}</h4> | ||
| <p>{member.description}</p> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </section> | ||
| ); | ||
| } | ||
| export default OurCrew; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| const OurPartners = () => { | ||
| // TASK - React 1 week 1 | ||
| // Create the "Our Crew section" | ||
| // Use the descriptions provided in /app/about_us/README.md | ||
| // Use the pictures from /public/crew | ||
| // Some inspiration ideas found in /data/inspiration_about_us | ||
|
|
||
| const partners = [ | ||
| "/business_partners/alphabet-logo.png", | ||
| "/business_partners/amazon_logo.png", | ||
| "/business_partners/CBC_Logo_White.png", | ||
| "/business_partners/Microsoft-Logo-White.png", | ||
| "/business_partners/nyu-logo.png", | ||
| "/business_partners/QueensLogo-White.png", | ||
| "/business_partners/samsung-logo.png", | ||
| "/business_partners/sodexo-logo.png" | ||
| ]; | ||
|
|
||
| return ( | ||
| <section style={{ padding: "20px" }}> | ||
| <h2 style={{ textAlign: "center", marginBottom: "20px" }}>Our Partners</h2> | ||
| <div style={{ display: "flex", flexWrap: "wrap", justifyContent: "center", gap: "30px" }}> | ||
| {partners.map((logo, index) => ( | ||
| <div key={index} style={{ border: "1px solid #ddd", padding: "15px", borderRadius: "8px", width: "150px" }}> | ||
| <img src={logo} alt={`Partner ${index + 1}`} style={{ width: "100%", objectFit: "contain" }} /> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </section> | ||
| ); | ||
| } | ||
|
|
||
| export default OurPartners; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| const OurValues = () => { | ||
| // TASK - React 1 week 1 | ||
| // Create the "Our Values" section | ||
| // Use the descriptions provided in /app/about_us/README.md | ||
| // Some inspiration ideas found in /data/inspiration_about_us | ||
| const values = [ | ||
| { | ||
| title: "Exploration", | ||
| description: "We are driven by a deep-seated desire to explore the unknown. We believe that the pursuit of discovery is at the heart of human nature, and we are committed to pushing the boundaries of what is possible." | ||
| }, | ||
| { | ||
| title: "Innovation", | ||
| description: "At Galactica, we prioritize cutting-edge technology and innovation. We are constantly evolving our spacecraft, safety protocols, and services to ensure that our travelers experience the most advanced and secure space journeys available." | ||
| }, | ||
| { | ||
| title: "Sustainability", | ||
| description: "We are committed to making space exploration sustainable for future generations. Our space missions are designed to minimize environmental impact, both on Earth and in space, and to foster a spirit of responsibility towards our universe." | ||
| }, | ||
| { | ||
| title: "Community", | ||
| description: "We believe in the power of collective exploration. Our journeys are not just about reaching new destinations; they are about building a community of space enthusiasts who share a passion for the stars." | ||
| } | ||
| ]; | ||
|
|
||
| return ( | ||
| <section> | ||
| <h2>Our Values</h2> | ||
| <div style={{ display: 'flex', flexDirection: 'column', gap: '20px' }}> | ||
| {values.map((value, index) => ( | ||
| <div key={index} style={{ border: '1px solid #ccc', padding: '15px', borderRadius: '8px' }}> | ||
| <h3>{value.title}</h3> | ||
| <p>{value.description}</p> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </section> | ||
| ); | ||
| }; | ||
| export default OurValues; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,25 @@ | ||
| "use client"; | ||
|
|
||
| import { useState } from 'react'; | ||
|
|
||
| import styles from '@/components/destination/destination.module.css'; | ||
| import { AddWishlistItem } from '@/components/destination/AddWishlistItem'; | ||
| import { useState } from "react"; | ||
| import styles from "@/components/destination/destination.module.css"; | ||
| import AddWishlistItem from "@/components/destination/AddWishlistItem"; | ||
| import PlanetWishlistItem from "@/components/destination/PlanetWishlistItem"; | ||
| import PlanetCard from "@/components/destination/PlanetCard"; | ||
|
|
||
| // TASK - React 1 week 2 | ||
| // Move this to its own file | ||
| const PlanetWishlistItem = ({ | ||
| name, | ||
| onRemove, | ||
| thumbnail, | ||
| }) => { | ||
| return ( | ||
| <div className={styles.wishlistItem}> | ||
| <img className={styles.wishlistItemThumbnail} src={thumbnail} alt="" /> | ||
| <b>{name.toUpperCase()}</b> | ||
| <button onClick={onRemove}>remove</button> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| // Move this to its own file ---- done | ||
| // const PlanetWishlistItem = ({ | ||
| // name, | ||
| // onRemove, | ||
| // thumbnail, | ||
| // }) => { | ||
| // return ( | ||
| // <div className={styles.wishlistItem}> | ||
| // <img className={styles.wishlistItemThumbnail} src={thumbnail} alt="" /> | ||
| // <b>{name.toUpperCase()}</b> | ||
| // <button onClick={onRemove}>remove</button> | ||
| // </div> | ||
| // ); | ||
| // } | ||
|
|
||
| export const Destinations = () => { | ||
| const [selectedPlanets, onAddPlanet] = useState([]); | ||
|
|
@@ -29,36 +28,59 @@ export const Destinations = () => { | |
| let numberOfPlanets = 0; | ||
|
|
||
| const onAddOrRemovePlanet = (name, index) => { | ||
| // TASK - React 1 week 2 | ||
| // Implement this function | ||
| // If you press the "ADD PLANET" the selected planet should display "SELECTED" | ||
| // And the counter should update, how many planets are selected (numberOfPlanets) | ||
| console.log(`You seleceted the following planet: ${name}, with the index of ${index}`); | ||
| } | ||
| const planetIndex = selectedPlanets.indexOf(name); | ||
|
|
||
| if (planetIndex > -1) { | ||
| const updatedPlanets = [...selectedPlanets]; | ||
| updatedPlanets.splice(planetIndex, 1); | ||
| onAddPlanet(updatedPlanets); | ||
| } else { | ||
| onAddPlanet([...selectedPlanets, name]); | ||
| } | ||
|
|
||
| console.log( | ||
| `You seleceted the following planet: ${name}, with the index of ${index}` | ||
| ); | ||
|
|
||
| // TASK - React 1 week 2 | ||
| // Implement this function ---- done | ||
| // If you press the "ADD PLANET" the selected planet should display "SELECTED" ---done | ||
| // And the counter should update, how many planets are selected (numberOfPlanets) ---done | ||
| //console.log(`You seleceted the following planet: ${name}, with the index of ${index}`); ---done | ||
| }; | ||
| numberOfPlanets = selectedPlanets.length; | ||
| return ( | ||
| <div className="fullBGpicture"> | ||
| <main className="mainContent"> | ||
| <h1>Travel destinations</h1> | ||
| <section className="card"> | ||
| <h2>Wishlist</h2> | ||
| {/* TASK - React 1 week 2 */} | ||
| {/* Display the number Of selected planets */} | ||
| {/* Display the "no planets" message if it is empty! */} | ||
| <p>No planets in wishlist :(</p> | ||
| <p>You have {numberOfPlanets} in your wishlist</p> | ||
| {numberOfPlanets === 0 ? ( | ||
| <p>No planets in wishlist :</p> | ||
| ) : ( | ||
| <p>You have {numberOfPlanets} planet(s) in your wishlist</p> | ||
| )} | ||
|
|
||
| <b>List coming soon after lesson 3!</b> | ||
|
|
||
| {/* STOP! - this is for week 3!*/} | ||
|
|
||
| {/* TASK - React 1 week 2 */} | ||
| {/* Display the number Of selected planets --done-- */} | ||
|
|
||
| {/* Display the "no planets" message if it is empty! ---done--*/} | ||
|
|
||
| {/* STOP! - t</div>his is for week 3!*/} | ||
| {/* TASK - React 1 week 3 */} | ||
| {/* Import the AddWishlistItem react component */} | ||
| {/* <AddWishlistItem /> */} | ||
| {/* TASK - React 1 week 3 */} | ||
| {/* Convert the list, so it is using selectedPlanets.map() to display the items */} | ||
| {/* Implement the "REMOVE" function */} | ||
| {/* uncomment the following code snippet: */} | ||
|
|
||
| {/* | ||
| <h3>Your current wishlist</h3> | ||
|
|
||
|
|
||
| <div className={styles.wishlistList}> | ||
| <PlanetWishlistItem | ||
| name="europa" | ||
|
|
@@ -75,40 +97,46 @@ export const Destinations = () => { | |
| <section className="card"> | ||
| <h2>Possible destinations</h2> | ||
| {/* TASK - React 1 week 2 */} | ||
| {/* Add all 4 planets! Europa, Moon, Mars, Titan */} | ||
| {/* Add all 4 planets! Europa, Moon, Mars, Titan ---done--- */} | ||
| {/* Use the README.md file for descriptions */} | ||
| {/* Create a <PlanetCard /> component, which accepts the following properties: */} | ||
| {/* name, description, thumbnail, isSelected, onAddOrRemovePlanet */} | ||
| <div className={styles.planetCard}> | ||
| <img className={styles.planetThumbnail} src="/destination/image-europa.png" alt="" /> | ||
| <div className={styles.planetDescription}> | ||
| <h2>EUROPA {isPlanetSelected ? "- SELECTED" : ""}</h2> | ||
| <p>Lorem ipsum...</p> | ||
| </div> | ||
| <button | ||
| className="roundButton" | ||
| onClick={() => onAddOrRemovePlanet('Pluto', 0)} | ||
| > | ||
| {isPlanetSelected ? "REMOVE" : "ADD PLANET"} | ||
| </button> | ||
| </div> | ||
| <div className={styles.planetCard}> | ||
| <img className={styles.planetThumbnail} src="/destination/image-europa.png" alt="" /> | ||
| <div className={styles.planetDescription}> | ||
| <h2>EUROPA {isPlanetSelected ? "- SELECTED" : ""}</h2> | ||
| <p>Lorem ipsum...</p> | ||
| </div> | ||
| <button | ||
| className="roundButton" | ||
| onClick={() => onAddOrRemovePlanet('Pluto', 0)} | ||
| > | ||
| {isPlanetSelected ? "REMOVE" : "ADD PLANET"} | ||
| </button> | ||
| </div> | ||
|
|
||
| <PlanetCard | ||
| name="Europa" | ||
| description="Europa, one of Jupiter’s moons, is an icy world with a hidden ocean beneath its surface. This mysterious moon is a prime candidate for the search for extraterrestrial life, making it a thrilling destination for space explorers." | ||
| thumbnail="/destination/image-europa.png" | ||
| isSelected={selectedPlanets.includes("Europa")} | ||
| onAddOrRemovePlanet={() => onAddOrRemovePlanet("Europa")} | ||
| /> | ||
|
|
||
| <PlanetCard | ||
| name="Moon" | ||
| description="Our closest celestial neighbor, the Moon, is a silent witness to Earth's history. With its stunning craters and desolate landscapes, the Moon offers a unique glimpse into space exploration's past and future, making it a perfect destination for lunar adventurers." | ||
| thumbnail="/destination/image-moon.png" | ||
| isSelected={selectedPlanets.includes("Moon")} | ||
| onAddOrRemovePlanet={() => onAddOrRemovePlanet("Moon")} | ||
| /> | ||
|
|
||
| <PlanetCard | ||
| name="Mars" | ||
| description="Mars, the Red Planet, is a barren yet fascinating world with vast deserts, towering volcanoes, and the deepest canyon in the solar system. As humanity’s next frontier, Mars invites us to dream of colonization and the possibilities of life beyond Earth." | ||
| thumbnail="/destination/image-mars.png" | ||
| isSelected={selectedPlanets.includes("Mars")} | ||
| onAddOrRemovePlanet={() => onAddOrRemovePlanet("Mars")} | ||
| /> | ||
|
|
||
| <PlanetCard | ||
| name="TITAN" | ||
| description="Titan, Saturn's largest moon, is a world of dense atmosphere and liquid methane lakes. This enigmatic moon is shrouded in a thick orange haze, concealing a landscape that is both alien and strangely familiar, beckoning explorers to uncover its secrets." | ||
| thumbnail="/destination/image-titan.png" | ||
| isSelected={selectedPlanets.includes("TITAN")} | ||
| onAddOrRemovePlanet={() => onAddOrRemovePlanet("TITAN")} | ||
| /> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good job using the component here! You could save the information in an array and then map through it to make it more modular! |
||
| </section> | ||
| </main> | ||
| </div> | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
| export default Destinations; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you could use a template string to add plural to planet only when the numberOfPlanets is bigger then 1 🙂