diff --git a/package.json b/package.json index eea3a082..dff0bfdc 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "typescript": "^4.3.5" }, "scripts": { - "start": "react-scripts start --openssl-legacy-provider", + "start": "react-scripts --openssl-legacy-provider start", "build": "react-scripts build", "build:staging": "env-cmd -f .env.staging react-scripts build", "build:demo": "env-cmd -f .env.demo react-scripts build", diff --git a/src/components/molecules/NewsFlashComp.tsx b/src/components/molecules/NewsFlashComp.tsx index 2f1ff251..f97b36c2 100644 --- a/src/components/molecules/NewsFlashComp.tsx +++ b/src/components/molecules/NewsFlashComp.tsx @@ -13,6 +13,7 @@ import { useTranslation } from 'react-i18next'; import LocationApprove from 'components/organisms/LocationApproveWindow'; import {locationQualificationOptions} from 'components/organisms/LocationApproveWindow'; import { INewsFlash } from 'models/NewFlash'; +import {useParams} from 'react-router-dom' const ICON_HEIGHT = 18 @@ -35,7 +36,7 @@ const NewsFlashComp: FC = ({ news }) => { const store: RootStore = useStore(); const classes = useStyles(); const locale = useLocale(); - const { userStore, newsFlashStore, settingsStore } = store; + const { userStore, settingsStore } = store; const { t } = useTranslation(); const userAllowedChange = userStore.isUserAuthenticated && userStore.isAdmin; @@ -55,7 +56,11 @@ const NewsFlashComp: FC = ({ news }) => { const [isOpen, setOpen] = useState(false); const verificationIcon = getVerificationIcon(news.newsflash_location_qualification); const criticalIcon = news.critical && ; - const className = news.id === newsFlashStore.activeNewsFlashId ? classes.activeNewsFlash : ''; + 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); @@ -79,6 +84,7 @@ const NewsFlashComp: FC = ({ news }) => { + ); } diff --git a/src/components/organisms/News.tsx b/src/components/organisms/News.tsx index 5fb9de73..2774e2b1 100644 --- a/src/components/organisms/News.tsx +++ b/src/components/organisms/News.tsx @@ -32,7 +32,7 @@ const News: FC = () => { {street && city && } {newsFlashStore.newsFlashCollection.length > 0 ? ( newsFlashStore.newsFlashCollection.map((news) => - + ) ) : ( diff --git a/src/components/organisms/SideBar.tsx b/src/components/organisms/SideBar.tsx index 6a8d401d..0cf70696 100644 --- a/src/components/organisms/SideBar.tsx +++ b/src/components/organisms/SideBar.tsx @@ -62,7 +62,7 @@ const SideBar: FC = () => { {location && ( - + )}