Skip to content
Open
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
1 change: 1 addition & 0 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function AppContent() {
<Route path="/explore" element={<ExplorePage />} />
<Route path="/card/:id" element={<CardDetailPage />} />
<Route path="/detail" element={<ImageDetailPage />} />
<Route path="/detail/:id" element={<ImageDetailPage />} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ImageDetailPage doesn't seem to handle the id parameter, as in the CardDetailPage component that uses useParams hook to extract the id parameter from the route. My understanding is that if the id is required for rendering the content it might lead to unexpected behavior when the id might be needed for fetching the data or rendering specific details.
My suggestion would be to use the same hook as in the CardDetailsPage to extract the id. If the ImageDetailPage was not intended, might need adjustment.

<Route path="/blog" element={<Blog />} />
</Routes>
</>
Expand Down
11 changes: 6 additions & 5 deletions frontend/src/components/ExplorePageSection1/CardDetailPage.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from "react";
import { useParams } from "react-router-dom";

Check failure on line 2 in frontend/src/components/ExplorePageSection1/CardDetailPage.jsx

View workflow job for this annotation

GitHub Actions / eslint

'/home/runner/work/S25-Full-Stack-Circle/S25-Full-Stack-Circle/node_modules/react-router-dom/dist/index.mjs' imported multiple times
import Breadcrumb from "./Breadcrumb";
import styles from "./CardDetailPage.module.css";
import { cards } from "./cardDetails";
import { Link } from "react-router-dom";

Check failure on line 6 in frontend/src/components/ExplorePageSection1/CardDetailPage.jsx

View workflow job for this annotation

GitHub Actions / eslint

'/home/runner/work/S25-Full-Stack-Circle/S25-Full-Stack-Circle/node_modules/react-router-dom/dist/index.mjs' imported multiple times

const CardDetailPage = () => {
const { id } = useParams();
Expand Down Expand Up @@ -72,17 +73,16 @@
{galleryImages.map((image, index) => (
<div key={index} className={styles.imageContainer}>
<div className={styles.imageWrapper}>
<img
src={image.src}
alt={`Gallery ${index + 1}`}
className={styles.image}
/>

Check failure on line 76 in frontend/src/components/ExplorePageSection1/CardDetailPage.jsx

View workflow job for this annotation

GitHub Actions / eslint

Replace `⏎··············<Link·to={`/detail/${index}`}·key={index}·state={{·image:·image·}}` with `················<Link⏎··················to={`/detail/${index}`}⏎··················key={index}⏎··················state={{·image:·image·}}⏎···············`
<Link to={`/detail/${index}`} key={index} state={{ image: image }} >
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key prop isn't needed here as you specified it already in line 74.

<img src={image.src} alt={`Gallery ${index + 1}`} className={styles.image} />

Check failure on line 78 in frontend/src/components/ExplorePageSection1/CardDetailPage.jsx

View workflow job for this annotation

GitHub Actions / eslint

Replace `················<img·src={image.src}·alt={`Gallery·${index·+·1}`}·className={styles.image}` with `··················<img⏎····················src={image.src}⏎····················alt={`Gallery·${index·+·1}`}⏎····················className={styles.image}⏎·················`

<div className={styles.overlay}>

Check failure on line 80 in frontend/src/components/ExplorePageSection1/CardDetailPage.jsx

View workflow job for this annotation

GitHub Actions / eslint

Insert `··`
<span className={styles.overlayText}>Open</span>

Check failure on line 81 in frontend/src/components/ExplorePageSection1/CardDetailPage.jsx

View workflow job for this annotation

GitHub Actions / eslint

Replace `··················` with `····················`
<div className={styles.overlayButtons}>

Check failure on line 82 in frontend/src/components/ExplorePageSection1/CardDetailPage.jsx

View workflow job for this annotation

GitHub Actions / eslint

Insert `··`
<img

Check failure on line 83 in frontend/src/components/ExplorePageSection1/CardDetailPage.jsx

View workflow job for this annotation

GitHub Actions / eslint

Insert `··`
src="/images/share-icon.svg"

Check failure on line 84 in frontend/src/components/ExplorePageSection1/CardDetailPage.jsx

View workflow job for this annotation

GitHub Actions / eslint

Insert `··`
alt="Share"

Check failure on line 85 in frontend/src/components/ExplorePageSection1/CardDetailPage.jsx

View workflow job for this annotation

GitHub Actions / eslint

Insert `··`
className={styles.shareIcon}
/>
<img
Expand All @@ -92,6 +92,7 @@
/>
</div>
</div>
</Link>
</div>
<div className={styles.tags}>
{image.tags.map((tag, tagIndex) => (
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/pages/ImageDetailPage.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from "react";
import { Link } from "react-router-dom";
import { Link, useLocation } from "react-router-dom";
import styles from "./Detail.module.css";
import Breadcrumb from "./ImageDetailPage/Breadcrumb";
import ShopItem from "./ImageDetailPage/ShopItem";

function ImageDetailPage() {
const location = useLocation();
const { image } = location.state || {};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can happen that the location is undefined or the image is missing so we need to check for it.
e.g.
if (!image){ return <div>No image available</div> }

return (
<div className={styles.pageWrapper}>
<Breadcrumb />
Expand All @@ -16,7 +18,7 @@ function ImageDetailPage() {
</Link>

<div className={styles.centered}>
<ShopItem />
<ShopItem image={image} />
</div>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/ImageDetailPage/ShopItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const suggestions = [
"Create board"
];

const ShopItem = () => {
const ShopItem = ({ image }) => {
const [menuOpen, setMenuOpen] = useState(false);
const [search, setSearch] = useState("");
const popupRef = useRef(null);
Expand All @@ -36,7 +36,7 @@ const ShopItem = () => {
return (
<div className={styles["shop-item"]}>
<div className={styles["shop-item-image"]}>
<img src="https://picsum.photos/300/300" alt="Product" />
<img src={image.src ||"https://picsum.photos/300/300"} alt="Product" />
</div>

<div className={styles["shop-item-details"]}>
Expand Down
Loading