-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from MozamelJawad/profile-reserved
Display reserved rockets in Profile
- Loading branch information
Showing
9 changed files
with
90 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,30 @@ | ||
import React from 'react'; | ||
import '../redux/profiles/profile.css'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
function Profile() { | ||
const { rockets } = useSelector((state) => state.rockets); | ||
const reservedRockets = rockets.filter((rocket) => rocket.reserved); | ||
|
||
return ( | ||
<div className="profile"> | ||
<div className="mission"> | ||
<h2>My Missions</h2> | ||
|
||
</div> | ||
|
||
<div className="rockets"> | ||
<h2>My Rockets</h2> | ||
{ reservedRockets.length > 0 ? ( | ||
<div className="mission-list"> | ||
{ | ||
reservedRockets.map((rocket) => <p key={rocket.id} className="profile-list">{rocket.name}</p>) | ||
} | ||
</div> | ||
) : <p className="notExist">There is no reserved rocket.</p>} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Profile; |
This file contains 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 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 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 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,32 @@ | ||
.profile { | ||
display: flex; | ||
gap: 2rem; | ||
margin-top: 1rem; | ||
padding: 2%; | ||
} | ||
|
||
.rockets, | ||
.mission { | ||
width: 50%; | ||
height: 50vh; | ||
} | ||
|
||
.rockets-list, | ||
.mission-list { | ||
margin-top: 2%; | ||
border: 1px solid #888; | ||
} | ||
|
||
.profile-list { | ||
padding: 2%; | ||
border-bottom: 1px solid #888; | ||
} | ||
|
||
.profile-list:last-child { | ||
border-bottom: none; | ||
} | ||
|
||
.notExist { | ||
margin-top: 1rem; | ||
font-size: 1.2rem; | ||
} |