Dynamic Pages, Content Hierarchies, and Previews

Monday, December 23, 2024 – Last week, I focused on testing the core functionality of the entity, which is to dynamically call APIs and replace the previously hard-coded UI pages. To do this, I integrated the API into the existing hard-coded UI. The design schema was created with flexibility in mind, capable of storing data for multiple pages using a general field name that can be applied across different types of content.

The flexibility of this schema is a crucial aspect of its design. It enables the system to store dynamic content, which can be rendered on various pages without the need to manually create separate DTOs for each page in the UI. Each content section within a page is represented by its own FieldName and FieldValue, where the FieldName can correspond to different parts of the page, such as headers or body text. Additionally, this structure supports nested blocks, allowing content hierarchies where sections can contain other sections, making it adaptable to a wide variety of content needs.

Instead of creating static pages for each type of content, this approach relies on the API to fetch the data for each page, reducing redundancy and making content management easier for the admin. Mr. Peter also suggested adding a preview section to the UI to help users understand what to expect. This introduced a challenge, since the page was designed to be used for multiple types of pages, I had to figure out how to implement a preview specific to each page. After some trial and error, I found a solution, though I’m not sure if it’s the most optimal approach.

Currently, since there’s only one confirmed page for the UI, I inserted a conditional check to determine if the page being managed was the specific one. If it was, the preview would be shown, otherwise, a “nothing to preview” message would be displayed. To facilitate the preview, I divided the UI into a separate component that can be called with the necessary values passed into it.

Additionally, I began working on creating another entity for managing metadata on the backend. This entity follows a similar schema design and will be accessible to admins. Towards the end of the week, I still have few CRUD API functionalities to be completed and will continue working on them next week.