Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Dec 1, 2023
1 parent cf7d290 commit 19b060a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,34 @@ const ToggleTypesRow = ({ type, Icon, count }: IToggleTypeRowProps) => {
);
};

export const FlagTypesWidget = ({ featureTypeCounts }: IFlagTypesWidgetProps) => {
export const FlagTypesWidget = ({
featureTypeCounts,
}: IFlagTypesWidgetProps) => {
const featureTypeStats = useMemo(() => {
const release =
featureTypeCounts.find((featureType) => featureType.type === 'release')?.count || 0;
featureTypeCounts.find(
(featureType) => featureType.type === 'release',
)?.count || 0;

const experiment =
featureTypeCounts.find((featureType) => featureType.type === 'experiment')?.count || 0;
featureTypeCounts.find(
(featureType) => featureType.type === 'experiment',
)?.count || 0;

const operational =
featureTypeCounts.find((featureType) => featureType.type === 'operational')?.count || 0;
featureTypeCounts.find(
(featureType) => featureType.type === 'operational',
)?.count || 0;

const kill =
featureTypeCounts.find((featureType) => featureType.type === 'kill-switch')?.count || 0;
featureTypeCounts.find(
(featureType) => featureType.type === 'kill-switch',
)?.count || 0;

const permission =
featureTypeCounts.find((featureType) => featureType.type === 'permission')?.count || 0;

featureTypeCounts.find(
(featureType) => featureType.type === 'permission',
)?.count || 0;

return {
release,
Expand Down
20 changes: 10 additions & 10 deletions frontend/src/component/project/Project/ProjectInfo/ProjectInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ const StyledProjectInfoSidebarContainer = styled(Box)(({ theme }) => ({
}));

const ProjectInfo = ({
id,
description,
memberCount,
health,
featureTypeCounts,
stats,
}: IProjectInfoProps) => {
id,
description,
memberCount,
health,
featureTypeCounts,
stats,
}: IProjectInfoProps) => {
const { isEnterprise } = useUiConfig();
const theme = useTheme();
const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
Expand All @@ -65,9 +65,9 @@ const ProjectInfo = ({
sx={
fitMoreColumns
? {
gridTemplateColumns:
'repeat(auto-fill, minmax(225px, 1fr))',
}
gridTemplateColumns:
'repeat(auto-fill, minmax(225px, 1fr))',
}
: { gridTemplateColumns: 'repeat(2, 1fr)' }
}
>
Expand Down
35 changes: 22 additions & 13 deletions frontend/src/component/project/Project/ProjectOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,14 @@ const PaginatedProjectOverview: FC<{
},
);

const { members, featureTypeCounts, health, description, environments, stats } =
project;
const {
members,
featureTypeCounts,
health,
description,
environments,
stats,
} = project;

return (
<StyledContainer key={projectId}>
Expand Down Expand Up @@ -140,17 +146,20 @@ const ProjectOverview = () => {

if (featureSearchFrontend) return <PaginatedProjectOverview />;


const featureTypeCounts = features.reduce((acc : FeatureTypeCount[], feature) => {
const existingEntry = acc.find(entry => entry.type === feature.type);
if (existingEntry) {
existingEntry.count += 1;
} else {
acc.push({ type: feature.type, count: 1 });
}
return acc;
}, []);

const featureTypeCounts = features.reduce(
(acc: FeatureTypeCount[], feature) => {
const existingEntry = acc.find(
(entry) => entry.type === feature.type,
);
if (existingEntry) {
existingEntry.count += 1;
} else {
acc.push({ type: feature.type, count: 1 });
}
return acc;
},
[],
);

return (
<StyledContainer>
Expand Down

0 comments on commit 19b060a

Please sign in to comment.