Skip to content

Commit

Permalink
feat: feature flag for feed status (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro100 authored Jan 22, 2025
1 parent 5e063ae commit f7e94f0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions web-app/src/app/interface/RemoteConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface RemoteConfigValues extends FirebaseDefaultConfig {
featureFlagBypass: string;
enableFeatureFilterSearch: boolean;
enableIsOfficialFilterSearch: boolean;
enableFeedStatusBadge: boolean;
}

const featureByPassDefault: BypassConfig = {
Expand All @@ -50,6 +51,7 @@ export const defaultRemoteConfigValues: RemoteConfigValues = {
featureFlagBypass: JSON.stringify(featureByPassDefault),
enableFeatureFilterSearch: false,
enableIsOfficialFilterSearch: false,
enableFeedStatusBadge: false,
};

remoteConfig.defaultConfig = defaultRemoteConfigValues;
6 changes: 5 additions & 1 deletion web-app/src/app/screens/Feed/DataQualitySummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import VerifiedIcon from '@mui/icons-material/Verified';
import { useTranslation } from 'react-i18next';
import { verificationBadgeStyle } from '../../styles/VerificationBadge.styles';
import { FeedStatusChip } from '../../components/FeedStatus';
import { useRemoteConfig } from '../../context/RemoteConfigProvider';

export interface DataQualitySummaryProps {
feedStatus: components['schemas']['BasicFeed']['status'];
Expand All @@ -21,14 +22,17 @@ export default function DataQualitySummary({
latestDataset,
}: DataQualitySummaryProps): React.ReactElement {
const { t } = useTranslation('feeds');
const { config } = useRemoteConfig();
return (
<Box data-testid='data-quality-summary' sx={{ my: 2 }}>
{(latestDataset?.validation_report === undefined ||
latestDataset.validation_report === null) && (
<WarningContentBox>{t('errorLoadingQualityReport')}</WarningContentBox>
)}
<Box sx={{ display: 'flex', gap: 1, flexWrap: 'wrap' }}>
<FeedStatusChip status={feedStatus ?? ''}></FeedStatusChip>
{config.enableFeedStatusBadge && (
<FeedStatusChip status={feedStatus ?? ''}></FeedStatusChip>
)}
{isOfficialFeed && (
<Tooltip title={t('officialFeedTooltip')} placement='top'>
<Chip
Expand Down
7 changes: 7 additions & 0 deletions web-app/src/app/screens/Feed/Feed.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ const mockFeedRT: GTFSRTFeedType = {
feed_references: ['mdb-y'],
};

jest.mock('firebase/compat/app', () => ({
initializeApp: jest.fn(),
remoteConfig: jest.fn(() => ({
settings: { minimumFetchIntervalMillis: 3600000 },
})),
}));

describe('Feed page', () => {
afterEach(cleanup);

Expand Down

0 comments on commit f7e94f0

Please sign in to comment.