diff --git a/src/components/molecules/GenericBarChart.tsx b/src/components/molecules/GenericBarChart.tsx index 8b1b26b2..47790f06 100644 --- a/src/components/molecules/GenericBarChart.tsx +++ b/src/components/molecules/GenericBarChart.tsx @@ -64,7 +64,7 @@ const BarChartContainer: FC = ({ data, textLabel, subtitle, style={{ fill: blackColor }} /> - {isStacked && } + {isStacked && } {children} diff --git a/src/components/molecules/NewsFlashComp.tsx b/src/components/molecules/NewsFlashComp.tsx index f97b36c2..aaa3bdea 100644 --- a/src/components/molecules/NewsFlashComp.tsx +++ b/src/components/molecules/NewsFlashComp.tsx @@ -14,6 +14,7 @@ import LocationApprove from 'components/organisms/LocationApproveWindow'; import {locationQualificationOptions} from 'components/organisms/LocationApproveWindow'; import { INewsFlash } from 'models/NewFlash'; import {useParams} from 'react-router-dom' +import { observer } from "mobx-react-lite"; const ICON_HEIGHT = 18 @@ -38,7 +39,6 @@ const NewsFlashComp: FC = ({ news }) => { const locale = useLocale(); const { userStore, settingsStore } = store; const { t } = useTranslation(); - const userAllowedChange = userStore.isUserAuthenticated && userStore.isAdmin; function getVerificationIcon(verificationText: string) { if (verificationText === locationQualificationOptions.REJECTED) { @@ -58,16 +58,16 @@ const NewsFlashComp: FC = ({ news }) => { const criticalIcon = news.critical && ; const {newsId} = useParams() const newsID = newsId ? parseInt(newsId) : '' - const className = news.id === newsID ? classes.activeNewsFlash : ''; - const date = news.date == null ? '' : dateFormat(new Date(news.date.replace(/-/g, '/')), locale); const handleLocationEditorOpen = () => setOpen(true); const handleLocationEditorClose = () => setOpen(false); - const locationChangeButton = userAllowedChange && + + const locationChangeButton = userStore.isUserAdmin && {t('changeLocationButton')} + return ( @@ -84,8 +84,7 @@ const NewsFlashComp: FC = ({ news }) => { - ); } -export default NewsFlashComp; +export default observer(NewsFlashComp); diff --git a/src/components/organisms/CardEditorDialog.tsx b/src/components/organisms/CardEditorDialog.tsx index 2a06314d..af1c3c66 100644 --- a/src/components/organisms/CardEditorDialog.tsx +++ b/src/components/organisms/CardEditorDialog.tsx @@ -107,7 +107,8 @@ const CardEditor: FC = ({ isOpen, onClose, widgetName, text }) => { actionButtons={false} sizeOptions={sizeOptions} dateComment={dateComment} - title={text} + title={widget?.data?.text?.title} + subtitle={widget?.data?.text?.subtitle} > {widgetName} {widgetComponent} diff --git a/src/const/cards.const.ts b/src/const/cards.const.ts index 49e16199..d3ef915c 100644 --- a/src/const/cards.const.ts +++ b/src/const/cards.const.ts @@ -1,7 +1,7 @@ import { WidgetName } from 'models/WidgetName'; import orYarokLogo from 'assets/greenlight.png'; -// cards is this least will be avaiaable for operation environments (all non-staging environments) +// cards in this list will be available for operation environments (all non-staging environments) export const operationalCards: WidgetName[] = [ WidgetName.accident_count_by_severity, WidgetName.most_severe_accidents_table, @@ -9,7 +9,11 @@ export const operationalCards: WidgetName[] = [ WidgetName.head_on_collisions_comparison_percentage, WidgetName.vision_zero_2_plus_1, WidgetName.injured_count_by_severity, - WidgetName.accidents_heat_map + WidgetName.accidents_heat_map, + WidgetName.accident_count_by_accident_year, + WidgetName.injured_count_by_accident_year, + WidgetName.accident_count_by_driver_type, + WidgetName.accident_count_by_day_night ]; export type OrgLogoData = {key : string, path:string} ; diff --git a/src/store/user.store.ts b/src/store/user.store.ts index f96e2444..fbdd4b5a 100644 --- a/src/store/user.store.ts +++ b/src/store/user.store.ts @@ -56,6 +56,10 @@ export default class UserStore { return this.userInfo?.data.organizations; } + get isUserAdmin(){ + return this.isUserAuthenticated && this.isAdmin; + } + get usersManagementTableData(): any { return this.usersInfoList?.map((user) => ({ name: `${user.first_name} ${user.last_name}`,