Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display reserved rockets in Profile #32

Merged
merged 4 commits into from
Sep 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add preseved rockets to profile
  • Loading branch information
MozamelJawad committed Sep 7, 2023
commit 003c7d93a4311dde9a0cbc120411bed4c0321485
30 changes: 30 additions & 0 deletions src/components/Profile.jsx
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;