Update TeamMembers component with dynamic image loading #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dynamic Data Loading:
Replaced static data import with dynamic fetching from Firebase using a callable function.
Integrated caching to store fetched data in localStorage and reduce redundant API calls.
Caching Mechanism:
Implemented caching using localStorage with a validity period of 1 hour.
Data is cached along with an expiry timestamp to ensure it is refreshed periodically.
State Management:
Utilized React useState and useEffect hooks to manage component state, including loading, data, and error states.
Error Handling and Loading States:
Added error handling to display a message if the API call fails.
Included a loading state message while data is being fetched.
Data Handling and Rendering:
Updated the component to handle dynamic team members data, including image URLs and roles.
Implemented logic to display placeholder images if the actual image URL is not available.
UI and Button Logic:
Adjusted the UI to reflect dynamic data and updated button logic based on the number of team members.
Testing and Debugging:
Added console logs for debugging purposes to verify the correctness of data fetching and rendering.