Skip to content

Conversation

@bhi049
Copy link
Contributor

@bhi049 bhi049 commented Dec 15, 2025

📄 Pull Request Overview

Closes #603

This PR implements dynamic Gallery data fetching from Directus CMS.

🔧 Changes Made

  1. Directus integration for Gallery
  • Fetches photo_object, photo_version, and category data from Directus using existing API infrastructure.
  • Includes all required relations and translation fields (translations, category.translations, preview/full.translations).
  1. Translation handling
  • Added support for translated title, author, and description on photo_object.
  • Language selection is handled via getLanguageCode and centralized translation helpers.
  1. Post-fetch typing
  • Gallery data is mapped and typed after retrieval in useGetDirectusGalleryImages, following existing project conventions for Directus relations.
  1. Picture Gallery page update
  • Replaced mock/static gallery data with Directus-driven content.
  1. Content validation
  • Added test content in Directus to verify correct rendering in the frontend.

Checklist Before Submission

  • Functionality: I have tested my code, and it works as expected.
  • JSDoc: I have added or updated JSDoc comments for all relevant code.
  • Debugging: No console.log() or other debugging statements are left.
  • Clean Code: Removed commented-out or unnecessary code.
  • Tests: Added new tests or updated existing ones for the changes made.
  • Documentation: Documentation has been updated (if applicable).

📝 Additional Information

Provide any additional context or information that reviewers may need to know:

  • Screenshots:
Näyttökuva 2025-12-22 kello 18 32 26 Näyttökuva 2025-12-22 kello 18 33 03
  • Dependencies: None
  • Known Issues: None at this time

@bhi049 bhi049 moved this to In review in altzone-webpages Dec 15, 2025
Copy link
Contributor

@Rutjake Rutjake left a comment

Choose a reason for hiding this comment

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

Good Work!
I suggest optimizing the search to prevent unnecessary backend load. By implementing a simple Debounce using e.g. useEffect and setTimeout, we ensure that the API request is only fired after the user has stopped typing for a brief moment (e.g., 500ms). This significantly reduces the number of requests sent to Directus while typing."

Something has happened to the size of the SectionGallery block:
image

it should remain the same as what was done to the frontend before:
image

@bhi049
Copy link
Contributor Author

bhi049 commented Dec 22, 2025

@Rutjake I checked the current implementation and, as far as I can see, the search only performs client-side filtering on already fetched data. It doesn’t trigger additional Directus requests while typing.

@bhi049 bhi049 requested a review from Rutjake December 22, 2025 16:54
Copy link
Member

@Skoivumaki Skoivumaki left a comment

Choose a reason for hiding this comment

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

Everything good 👍

@Skoivumaki
Copy link
Member

@Rutjake I checked the current implementation and, as far as I can see, the search only performs client-side filtering on already fetched data. It doesn’t trigger additional Directus requests while typing.

This seems correct. However the idea is a must if Directus were to have hundreds of images and would have to be optimized by limiting query size. For now, I don't find this issue severe enough for it to require further optimization.

@Rutjake Rutjake merged commit 5899266 into dev Jan 5, 2026
3 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in altzone-webpages Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants