Conversation
…ories for the source-list
There was a problem hiding this comment.
Pull request overview
This PR introduces type safety for datasource filtering by creating a DataSource enum and adding a check to ensure only valid datasource categories are included in the "Platform breakdown" section. This change prepares the component for an adjusted data structure from the API.
- Added a DataSource enum with four platform values (PLATFORM, FACEBOOK, TWITTER, YOUTUBE)
- Updated switch statement to use enum values instead of string literals
- Enhanced filtering logic to only include rows that match valid DataSource enum values
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return { icon: ushahidiIcon, color: '#EFC44C' }; | ||
|
|
||
| case 'facebook': | ||
| return { icon: facebookIcon, color: '#8B9DC3' }; | ||
| case DataSource.FACEBOOK: | ||
| return { icon: facebookIcon, color: '#8B9DC3' }; | ||
|
|
||
| case 'twitter': | ||
| return { icon: twitterIcon, color: '#1DA1F2' }; | ||
| case DataSource.TWITTER: | ||
| return { icon: twitterIcon, color: '#1DA1F2' }; | ||
|
|
||
| case 'youtube': | ||
| return { icon: youtubeIcon, color: '#CC181E' }; | ||
| case DataSource.YOUTUBE: | ||
| return { icon: youtubeIcon, color: '#CC181E' }; | ||
|
|
||
| default: | ||
| return { icon: '', color: '#8e8e8e' }; | ||
| return { icon: '', color: '#8e8e8e' }; |
There was a problem hiding this comment.
The return statements inside the switch cases have inconsistent indentation. They should be indented to align with the case statements. This appears across all cases in the switch statement.
Playwright test results
|
Making datasources an enum and adding a check to see if the row is a datasource or not before adding them to the section "Platform breakdown" (this is an adjustment to the datastructure that will come out of the api).