diff --git a/src/components/MiniPhotos.jsx b/src/components/MiniPhotos.jsx
index 8c3e63a..3d1152a 100644
--- a/src/components/MiniPhotos.jsx
+++ b/src/components/MiniPhotos.jsx
@@ -5,70 +5,81 @@ import ResponsiveImage from "./ResponsiveImage";
import { handleClickLink } from "./helper";
const MiniPhotos = (props) => {
- const { user, userID, linkHandling, ...rest } = props;
+ const { user, userID, linkHandling, ...rest } = props;
- const { linkRefs, linkState } = linkHandling;
- const [activeLink, setActiveLink] = linkState;
- const { photos: photosLinkRef } = linkRefs;
+ const { linkRefs, linkState } = linkHandling;
+ const [activeLink, setActiveLink] = linkState;
+ const { photos: photosLinkRef } = linkRefs;
- const photos = user.photos;
+ const photos = user.photos;
- const NUMBER_OF_PHOTOS = 9;
+ const NUMBER_OF_PHOTOS = 9;
- const photosLink = `/fakebook/${user.lastname}.${user.firstname}/Photos`;
+ /* ---------- FIX: build unique slug ----------------------------- */
- function handleClick() {
- handleClickLink(
- { currentTarget: photosLinkRef.current },
- activeLink,
- setActiveLink
- );
- }
+ const slugBase = `${user.lastname}.${user.firstname}`;
- return (
-
-
-
-
- Photos
-
-
-
- {photos.map((photo, index) => {
- return (
- //we only render maximum 9 photos
- index < NUMBER_OF_PHOTOS && (
-
-
-
-
-
- )
- );
- })}
-
-
-
- );
+ const userSlug =
+ user.index && user.index > 0 ? `${slugBase}.${user.index}` : slugBase;
+
+ const photosLink = `/fakebook/${userSlug}/Photos`;
+
+ /* ---------------------------------------------------------------- */
+
+ function handleClick() {
+ handleClickLink(
+ { currentTarget: photosLinkRef.current },
+ activeLink,
+ setActiveLink
+ );
+ }
+
+ return (
+
+
+
+
+ Photos
+
+
+
+ {photos.map((photo, index) => {
+ return (
+ //we only render maximum 9 photos
+ index < NUMBER_OF_PHOTOS && (
+
+
+
+
+
+ )
+ );
+ })}
+
+
+
+ );
};
export default MiniPhotos;