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

EPMGCIP-171: Implement Homepage with Slider Featuring Exhibits #30

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

Dzmitry-Yaniuk
Copy link
Collaborator

@Dzmitry-Yaniuk Dzmitry-Yaniuk commented Nov 21, 2024

https://jira.epam.com/jira/browse/EPMGCIP-171

Code changes

  • Created new Home component handling basic layout for home page;
  • Created new GraphQL query TopLatestExhibits.gql to obtain top latest recently added exhibits;
  • Adjusted ImageGallery component to be customized, update usages;
  • Added new component ImageGalleryArrow for ImageGallery to represent custom arrow customization;
  • Covered changes with tests;
  • Fixed all vulnerabilities in package-lock.json;
  • Added min NodeJS version restriction in package.json to run application;
  • Updated .gitgnore to exclude VS Code and JetBrains IDE system folders;

Screenshots

Screen.Recording.2024-11-21.at.22.27.07.mov

@Dzmitry-Yaniuk Dzmitry-Yaniuk added the enhancement New feature or request label Nov 21, 2024
import styles from "./page.module.scss";
import HomePage from "../../components/pages/Home/Home";
import { getTopLatestExhibits } from "@/lib/exhibit";
import { ITopLatestExhibit } from "@/interfaces/ITopLatestExhibit";
Copy link
Collaborator

Choose a reason for hiding this comment

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

what do you think about reusing src\interfaces\IExhibit.ts interface?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking about the same approach, however, since I use lightweight model of exhibit that does not include a large set of properties in IExhibit I believe it would be better to define custom model instead.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it. In that case, maybe it is better to rename it to something like "IPreviewExhibit"? So it will be more clear that it should be used for preview cards.

export default async function Home() {
const topLatestExhibits = (await getTopLatestExhibits(
topLatestExhibitsLimit,
)) as ITopLatestExhibit[];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure that need type assertion here... I suppose type should be passed from appollo client

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am afraid it does not work here, TS raises types error and it is mandatory to perform manual casting. I can try to put it on lib error to prevent extra casts in uses cases

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I agree. If it is possible, let's do that in 'libs'

src/components/pages/Home/Home.tsx Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should consider code styling for import order—for example, starting with third-party libraries, followed by local imports, arranged from distant to closer paths.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, thank you!
It is already done in terms of #31


function ImageGalleryArrow(props: Props): React.ReactElement {
return (
<div
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you use 'button' here?

font-size: 30px;
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add 'hover' effect?

import styles from "./page.module.scss";
import HomePage from "../../components/pages/Home/Home";
import { getTopLatestExhibits } from "@/lib/exhibit";
import { ITopLatestExhibit } from "@/interfaces/ITopLatestExhibit";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it. In that case, maybe it is better to rename it to something like "IPreviewExhibit"? So it will be more clear that it should be used for preview cards.

export default async function Home() {
const topLatestExhibits = (await getTopLatestExhibits(
topLatestExhibitsLimit,
)) as ITopLatestExhibit[];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I agree. If it is possible, let's do that in 'libs'

@@ -32,35 +30,19 @@ export default function Home(props: Props): React.ReactElement {
return {
url: firstImageItem.url,
id: firstImageItem.sys.id,
clickUrl: `${locale}${EXHIBIT_URL}/${exhibit.slug}`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suppose, you can remove ${locale}, next-intl should resolve that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants