Skip to content

Commit

Permalink
Merge branch 'dev' into feat-1031-add-theme-for-n12
Browse files Browse the repository at this point in the history
  • Loading branch information
atalyaalon authored Feb 29, 2024
2 parents a6f633c + ff9727a commit a6e1b06
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 2 deletions.
Binary file added src/assets/vision_zero_bike.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/components/molecules/card/AnyWayCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ const AnyWayCard: FC<IProps> = ({
const [element, setElement] = useState({});
const [isOpen, setOpen] = useState(false);
const [widgateOpen,SetWidgetOpen] = useState('')

const handleCardEditorOpen = (name:string) =>{
const handleCardEditorOpen = (name:string) => {
SetWidgetOpen(name)
setOpen(true)
};
Expand All @@ -105,6 +104,7 @@ const AnyWayCard: FC<IProps> = ({
const sizes = getSizes(variant, factor);

const classes = useStyles();

const imgDownloadHandler = () => {
if (element && element instanceof HTMLElement) {
widgetToImage(widgetName, element);
Expand Down
5 changes: 5 additions & 0 deletions src/components/molecules/widgets/WidgetWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from 'models/WidgetData';
import visionZeroImage from 'assets/vision_zero_2_plus_1.jpg';
import vision_zero_10_50_90 from 'assets/vision_zero_10_50_90.png';
import vision_zero_bike from 'assets/vision_zero_bike.png';
import AccidentsCountByHourBarWidget from './AccidentsCountByHourBarWidget';
import MostSevereAccidentsMapWidget from './MostSevereAccidentsMapWidget';
import MostSevereAccidentsTableWidget from './MostSevereAccidentsTableWidget';
Expand Down Expand Up @@ -181,6 +182,10 @@ const WidgetWrapper: FC<IProps> = ({ widget, locationText, sizeOptions, editorBa
widgetComponent = <StaticImageViewWidget data={{items:{image_src:vision_zero_10_50_90},text:{}} as IWidgetVisionZeroImageData} />;
break;
}
case WidgetName.vision_zero_bike: {
widgetComponent = <StaticImageViewWidget data={{items:{image_src:vision_zero_bike},text:{}} as IWidgetVisionZeroImageData} />;
break;
}
case WidgetName.top_road_segments_accidents_per_km: {
widgetComponent = (
<TopRoadSegmentsAccidentsPerKm data={data as IWidgetTopRoadSegmentsAccidentsPerKm} segmentText={locationText} />
Expand Down
2 changes: 2 additions & 0 deletions src/const/cards.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const operationalCards: WidgetName[] = [
WidgetName.most_severe_accidents,
WidgetName.head_on_collisions_comparison_percentage,
WidgetName.vision_zero_2_plus_1,
WidgetName.vision_zero_10_50_90,
WidgetName.vision_zero_bike,
WidgetName.injured_count_by_severity,
WidgetName.accidents_heat_map,
WidgetName.accident_count_by_accident_year,
Expand Down
1 change: 1 addition & 0 deletions src/models/WidgetName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export enum WidgetName {
head_on_collisions_comparison_percentage = 'head_on_collisions_comparison_percentage',
vision_zero_2_plus_1 = 'vision_zero_2_plus_1',
vision_zero_10_50_90 = 'vision_zero_10_50_90',
vision_zero_bike = 'vision_zero_bike',
top_road_segments_accidents_per_km = 'top_road_segments_accidents_per_km',
accident_count_by_road_light = 'accident_count_by_road_light',
accident_count_by_driver_type = 'accident_count_by_driver_type',
Expand Down
8 changes: 8 additions & 0 deletions src/services/data.verification/data.verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ export const verifiedWidgetData = (widget: any) => {
isValid = validString(items.image_src);
break;
}
case 'vision_zero_10_50_90': {
isValid = validString(items.image_src);
break;
}
case 'vision_zero_bike': {
isValid = validString(items.image_src);
break;
}
default: {
isValid = false;
}
Expand Down
1 change: 1 addition & 0 deletions src/services/widgets.style.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const widgetVariants: { [index: string]: CardVariant } = {
},
[WidgetName.vision_zero_2_plus_1]: { header: HeaderVariant.None, footer: FooterVariant.LogoWithRange },
[WidgetName.vision_zero_10_50_90]: { header: HeaderVariant.None, footer: FooterVariant.LogoWithRange },
[WidgetName.vision_zero_bike]: { header: HeaderVariant.None, footer: FooterVariant.LogoWithRange },
[WidgetName.top_road_segments_accidents_per_km]: {
header: HeaderVariant.Centered,
footer: FooterVariant.LogoWithRange,
Expand Down

0 comments on commit a6e1b06

Please sign in to comment.