Skip to content

Commit

Permalink
feat: #28 more splitting + react multi carousel
Browse files Browse the repository at this point in the history
  • Loading branch information
ZegarekPL committed Apr 13, 2024
1 parent 101db37 commit 9d0ec9f
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 115 deletions.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"react": "^18",
"react-dom": "^18",
"react-icons": "^5.0.1",
"react-multi-carousel": "^2.8.5",
"react-query": "^3.39.3"
},
"devDependencies": {
Expand Down
93 changes: 6 additions & 87 deletions src/app/(role_organizer)/myconference/[conferenceId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
import Page from "@/components/common/Page/Page";
import Logo from "@/assets/home/laptop.jpg";
import { Box, BoxWithImage } from "@/components/common/Box/Box";
import Image, { StaticImageData } from "next/image";
import { useQuery } from "react-query";
import {
GetConferenceDetailsWithRoleFilteringData,
getConferenceDetailsWithRoleFiltering,
} from "@/hooks/conference";
import { getConferenceDetailsWithRoleFiltering } from "@/hooks/conference";
import Error500 from "@/components/common/Error/Error500";
import { FaChevronRight, FaRegCalendarCheck } from "react-icons/fa";
import { IoMdPin } from "react-icons/io";
import { FaRegCalendarXmark } from "react-icons/fa6";
import Link from "next/link";
import MyConferencePageImageBox from "@/components/myconferenceId/MyConferencePageImageBox";
import People from "@/components/myconferenceId/PeopleBox";
import AllImagesCarousel from "@/components/myconferenceId/Carousel/AllImagesCarousel";

export default function MyConferencePage({
params,
Expand Down Expand Up @@ -103,8 +98,8 @@ export default function MyConferencePage({
</Box>
<Box className="text-darkblue w-[90%] lg:w-[60%] mt-5 mb-20">
<h1 className="w-full flex justify-center text-3xl">Zdjęcia</h1>
<div className="w-full grid-cols-4 grid gap-8 pt-4">
<Image src={""} alt={""} />
<div className="w-full pt-4">
<AllImagesCarousel photos={conferenceIdData.photos} />
</div>
</Box>
</>
Expand All @@ -114,79 +109,3 @@ export default function MyConferencePage({
</Page>
);
}

function People({
username,
photo,
email,
}: {
username: string;
photo: string | StaticImageData;
email?: string;
}) {
return (
<div className="w-full">
<p className="w-full flex justify-center items-center">
<Image
src={photo}
alt={"Logo"}
className="rounded-full"
width={80}
height={80}
/>
</p>
<span className="w-full flex justify-center pt-1 text-md">
{username}
</span>
<span className="w-full flex justify-center text-xs">{email}</span>
</div>
);
}

function MyConferencePageImageBox({
conferenceIdData,
}: {
conferenceIdData: GetConferenceDetailsWithRoleFilteringData;
}) {
return (
<div className="absolute top-0 left-0 w-full h-full flex flex-col items-center text-close2White p-4">
<h1 className="text-4xl pt-[5%]">{conferenceIdData.name}</h1>
<div className="w-full h-auto flex justify-around text-3xl pt-[10%]">
<div className="flex-row flex gap-x-3 w-full h-auto items-center justify-center">
<FaRegCalendarCheck className="text-4xl" />
<h1 className="text-lg">
{conferenceIdData.startDateTime.split("T")[0]}{" "}
{conferenceIdData.startDateTime
.split("T")[1]
.split(":")
.slice(0, 2)
.join(":")}
</h1>
</div>
<div className="flex-row flex gap-x-3 w-full h-auto items-center justify-center">
<FaRegCalendarXmark className="text-4xl" />
<h1 className="text-lg">
{conferenceIdData.endDateTime.split("T")[0]}{" "}
{conferenceIdData.endDateTime
.split("T")[1]
.split(":")
.slice(0, 2)
.join(":")}
</h1>
</div>
</div>
<div className="flex-col flex gap-x-3 w-full h-auto items-center justify-center pt-[18%]">
<div className="flex-row flex gap-x-3 w-full h-auto items-center justify-center">
<IoMdPin className="text-4xl" />
<h1 className=" text-3xl">{conferenceIdData.location.name}</h1>
</div>
<Link
href={`https://www.google.com/maps/place/${conferenceIdData.location.locX}+${conferenceIdData.location.locY}`}
className={"pt-2 hover:underline flex items-center gap-2"}
>
Zobacz lokalizację na mapie <FaChevronRight />
</Link>
</div>
</div>
);
}
41 changes: 41 additions & 0 deletions src/components/myconferenceId/Carousel/AllImagesCarousel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import Carousel from "react-multi-carousel";
import SingleImageCarousel from "./SingleImageCarousel";
import { Image } from "@/hooks/conference";

export default function AllImagesCarousel({ photos }: { photos: Image[] }) {
const responsive = {
desktop: {
breakpoint: { max: 3000, min: 1024 },
items: 4,
},
tablet: {
breakpoint: { max: 1424, min: 464 },
items: 2,
},
mobile: {
breakpoint: { max: 664, min: 0 },
items: 1,
},
};
console.log("photos1", photos);
return (
<Carousel
responsive={responsive}
ssr
showDots={true}
slidesToSlide={1}
containerClass={`w-full flex justify-start items-center lg:w-[70vw] mt-2 pb-10 hidden`}
itemClass={"px-3 flex justify-start items-center"}
deviceType={""}
centerMode={false}
className={`mb-4 flex items-center ${
photos && photos.length > 3 ? "justify-start" : "justify-center"
}`}
>
{photos &&
photos.map((photos, index) => (
<SingleImageCarousel key={index} photos={photos} />
))}
</Carousel>
);
}
12 changes: 12 additions & 0 deletions src/components/myconferenceId/Carousel/SingleImageCarousel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use client";
import { Image } from "@/hooks/conference";
import APIImageComponent from "@/hooks/imageAPI";

export default function SingleImageCarousel({ photos }: { photos: Image }) {
console.log("photos2", photos);
return (
<div className="w-full flex justify-center items-center">
<APIImageComponent imageId={0} type={""} />
</div>
);
}
56 changes: 56 additions & 0 deletions src/components/myconferenceId/MyConferencePageImageBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { GetConferenceDetailsWithRoleFilteringData } from "@/hooks/conference";
import Link from "next/link";
import {
FaChevronRight,
FaRegCalendarCheck,
FaRegCalendarXmark,
} from "react-icons/fa6";
import { IoMdPin } from "react-icons/io";

export default function MyConferencePageImageBox({
conferenceIdData,
}: {
conferenceIdData: GetConferenceDetailsWithRoleFilteringData;
}) {
return (
<div className="absolute top-0 left-0 w-full h-full flex flex-col items-center text-close2White p-4">
<h1 className="text-4xl pt-[5%]">{conferenceIdData.name}</h1>
<div className="w-full h-auto flex justify-around text-3xl pt-[10%]">
<div className="flex-row flex gap-x-3 w-full h-auto items-center justify-center">
<FaRegCalendarCheck className="text-4xl" />
<h1 className="text-lg">
{conferenceIdData.startDateTime.split("T")[0]}{" "}
{conferenceIdData.startDateTime
.split("T")[1]
.split(":")
.slice(0, 2)
.join(":")}
</h1>
</div>
<div className="flex-row flex gap-x-3 w-full h-auto items-center justify-center">
<FaRegCalendarXmark className="text-4xl" />
<h1 className="text-lg">
{conferenceIdData.endDateTime.split("T")[0]}{" "}
{conferenceIdData.endDateTime
.split("T")[1]
.split(":")
.slice(0, 2)
.join(":")}
</h1>
</div>
</div>
<div className="flex-col flex gap-x-3 w-full h-auto items-center justify-center pt-[18%]">
<div className="flex-row flex gap-x-3 w-full h-auto items-center justify-center">
<IoMdPin className="text-4xl" />
<h1 className=" text-3xl">{conferenceIdData.location.name}</h1>
</div>
<Link
href={`https://www.google.com/maps/place/${conferenceIdData.location.locX}+${conferenceIdData.location.locY}`}
className={"pt-2 hover:underline flex items-center gap-2"}
>
Zobacz lokalizację na mapie <FaChevronRight />
</Link>
</div>
</div>
);
}
29 changes: 29 additions & 0 deletions src/components/myconferenceId/PeopleBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Image, { StaticImageData } from "next/image";

export default function People({
username,
photo,
email,
}: {
username: string;
photo: string | StaticImageData;
email?: string;
}) {
return (
<div className="w-full">
<p className="w-full flex justify-center items-center">
<Image
src={photo}
alt={"Logo"}
className="rounded-full"
width={80}
height={80}
/>
</p>
<span className="w-full flex justify-center pt-1 text-md">
{username}
</span>
<span className="w-full flex justify-center text-xs">{email}</span>
</div>
);
}
Loading

0 comments on commit 9d0ec9f

Please sign in to comment.