Skip to content

Root: ui|v2.5|src|components|FrontPage: Control.tsx

Serechops edited this page Apr 9, 2024 · 1 revision

Control.tsx

This file contains components related to controlling and displaying filter results.

RecommendationRow Component:

Props:

  • mode: Filter mode.
  • filter: List filter model.
  • header: Header string for the recommendation row.

Description:

  • This component renders different types of recommendation rows based on the provided filter mode.
  • It dynamically selects the appropriate recommendation row component based on the filter mode and passes the necessary props to it.

SavedFilterResults Component:

Props:

  • savedFilterID: ID of the saved filter.

Description:

  • This component fetches a saved filter by ID and renders the corresponding recommendation row.
  • It uses the useFindSavedFilter hook to fetch the saved filter data and then creates a ListFilterModel based on the fetched data.
  • The RecommendationRow component is used to render the recommendation row with the fetched filter.

CustomFilterResults Component:

Props:

  • customFilter: Custom filter object.

Description:

  • This component renders a recommendation row for a custom filter.
  • It creates a ListFilterModel based on the provided custom filter data and uses the RecommendationRow component to render the recommendation row.

Control Component:

Props:

  • content: FrontPageContent object.

Description:

  • This component acts as a controller for rendering recommendation rows based on the content type.
  • It switches between rendering saved filter results and custom filter results based on the type of FrontPageContent.
  • For saved filter content, it renders the SavedFilterResults component.
  • For custom filter content, it renders the CustomFilterResults component.

Example of Usage:

<Control content={content} />

Explanation:

In this example, content represents the FrontPageContent object, which can be either a saved filter or a custom filter.

Clone this wiki locally