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 joined missions in My profile view #42

Merged
merged 5 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
- [x] **Add actions and other functionality to Cancel Reservation**
- [x] **Add actions and other functionality to Join Missions**
- [x] **Add actions and other functionality to Leave Missions**
- [ ] **Display the list of Missions Joined in the My Profile view**
- [ ] **Display the list of Rockets reserved in the My Profile view**
- [x] **Display the list of Missions Joined in the My Profile view**
- [x] **Display the list of Rockets reserved in the My Profile view**
- [ ] **Create Unit tests using Jest and React testing library**

<p align="right">(<a href="#readme-top">back to top</a>)</p>
Expand Down
33 changes: 33 additions & 0 deletions src/assets/styles/MyProfile.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,36 @@
justify-content: center;
gap: 2rem;
}

.services-content .service {
width: 100%;
display: flex;
flex-direction: column;
gap: 0.8rem;
}

.services-content .service h2 {
font-size: 2rem;
color: #333;
}

.reservation-list {
width: 100%;
display: flex;
flex-direction: column;
gap: 0;
border: 1px solid #ccc;
}

.reservation-item {
padding: 0.7rem 0.8rem 1.1rem;
border-bottom: 1px solid #ccc;
font-size: 1rem;
font-weight: 500;
color: #333;
transition: all 0.2s ease-out;
}

.reservation-item:hover {
background-color: #f1f1f1;
}
7 changes: 7 additions & 0 deletions src/assets/styles/responsive.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
.rocket-image {
width: 350px;
}

.services-content {
flex-direction: row;
align-items: start;
justify-content: space-between;
gap: 3rem;
}
}

@media (min-width: 992px) {
Expand Down
24 changes: 24 additions & 0 deletions src/components/JoinedMissions.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { useSelector } from 'react-redux';
import ReservationItem from './ReservationItem';

const JoinedMissions = () => {
const { missions } = useSelector((state) => state.missions);

return (
<div className="my-missions service">
<h2>My Missions</h2>
<ul id="reserved-missions" className="reservation-list">
{missions
.filter((mission) => mission.reserved === true)
.map((mission) => (
<ReservationItem
key={mission.mission_id}
serviceName={mission.mission_name}
/>
))}
</ul>
</div>
);
};

export default JoinedMissions;
2 changes: 2 additions & 0 deletions src/views/MyProfile.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Layout from './Layout';
import JoinedMissions from '../components/JoinedMissions';
import ReservedRockets from '../components/ReservedRockets';
import '../assets/styles/MyProfile.css';

Expand All @@ -7,6 +8,7 @@ const MyProfile = () => (
<section id="myProfile">
<div className="container">
<div className="services-content">
<JoinedMissions />
<ReservedRockets />
</div>
</div>
Expand Down