Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ReutSher1 committed Nov 12, 2024
1 parent c456f45 commit 4ec182d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/components/molecules/GenericBarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface ISingleBarChartProps extends IBarChartBaseProps {}

interface IMultiBarChartProps extends IBarChartBaseProps {
isStacked: boolean;
yLabels?: string[];
customYLabels?: string[];
editorBarOptions?: Record<number, boolean>;
}

Expand Down Expand Up @@ -107,16 +107,16 @@ const MultiBarChart: FC<IMultiBarChartProps> = ({
isStacked,
textLabel,
subtitle,
yLabels,
customYLabels,
editorBarOptions,
}) => {
const theme = useTheme();
const colors = (theme.palette.primary as ColorScheme).barChartColors;

const defaultYLabels = data ? Object.keys(data[0]) : [];
const customYLabels = yLabels || defaultYLabels.slice(1);
const yLabels= customYLabels || defaultYLabels.slice(1);

const maxBarsNum = customYLabels.length;
const maxBarsNum = yLabels.length;
const filteredColors: Record<string, any> =
editorBarOptions && Object.keys(editorBarOptions).length !== 0
? Object.values(editorBarOptions)
Expand Down Expand Up @@ -150,14 +150,14 @@ const MultiBarChart: FC<IMultiBarChartProps> = ({
key={i}
stackId={isStacked ? 'stack_1' : undefined}
fill={filteredColors[i]}
dataKey={customYLabels[i]}
dataKey={yLabels[i]}
style={barStyle}
isAnimationActive={false}
>
{!isStacked && (
<LabelList
content={<CustomizedLabel isPercentage={isPercentage} isStacked={isStacked} />}
dataKey={customYLabels[i]}
dataKey={yLabels[i]}
/>
)}
</Bar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ interface IProps {

const KilledAndInjuredCountPerAgeGroupStackedWidget: FC<IProps> = ({ data, editorBarOptions }) => {
const { text } = data;
debugger;
const multiBarSeries = createBarWidget(data, editorBarOptions);
return <MultiBarChart isStacked={true} isPercentage={false} data={multiBarSeries}
textLabel={text.title}
yLabels={Object.values(text.labels_map)}
customYLabels={Object.values(text.labels_map)}
subtitle={text.subtitle}
editorBarOptions={editorBarOptions} />;
};
Expand Down
2 changes: 1 addition & 1 deletion src/const/cards.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const operationalCards: WidgetName[] = [
// WidgetName.accident_count_by_driver_type,
WidgetName.killed_and_injured_count_per_age_group,
WidgetName.accident_count_by_day_night,
WidgetName.killed_and_injured_count_per_age_group_stacked
WidgetName.killed_and_injured_count_per_age_group_stacked,
];

export type OrgLogoData = {key : string, path:string} ;
Expand Down
2 changes: 1 addition & 1 deletion src/models/WidgetData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,4 @@ export interface IWidgetKilledAndInjuredCountPerAgeGroup extends IWidgetDataBase
subtitle?: string;
title?: string;
};
}
}
1 change: 1 addition & 0 deletions src/services/widgets.data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const fetchWidgets = async ({
}: IWidgetInput): Promise<ILocationData | undefined> => {
try {
const widgetsUrl = getWidgetUrl({ lang, newsId, yearAgo, gpsId, city, street });
console.log(widgetsUrl);
const response = await axios.get(widgetsUrl);
return processWidgetsFetchResponse(response);
} catch (error) {
Expand Down
3 changes: 1 addition & 2 deletions src/utils/barChart.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const barsWidgetsLabels: Record<string, Array<string>> = {
['textView.fatal.plural', 'textView.severe.plural', 'textView.light.plural'],
'injured_count_by_accident_year':
['textView.killed.plural', 'textView.severeInjured.plural', 'textView.lightInjured.plural'],
}
}

export const barsWidgetsTitle: Record<string, string> = {
'accident_count_by_accident_year': 'cardEditor.showAccidents',
Expand Down Expand Up @@ -75,7 +75,6 @@ export function createBarWidget (
data: IWidgetMultiBarData,
editorBarOptions: Record<number, boolean>
): BarDataMap[] {
debugger
const { items, text } = data;
const excludeList = (Object.keys(editorBarOptions).length !== 0) ?
Object.values(editorBarOptions).map((include: any, index: number) => {
Expand Down

0 comments on commit 4ec182d

Please sign in to comment.