From ca976fce41aad81b418904107af56e02ab96ad68 Mon Sep 17 00:00:00 2001 From: Noam Gaash Date: Wed, 13 Dec 2023 09:52:45 +0200 Subject: [PATCH] refactor: texts --- src/locale/he.json | 6 +++++- src/pages/Profile.tsx | 28 ++++++++++++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/locale/he.json b/src/locale/he.json index 4f1ed3c1..1cd2ab74 100644 --- a/src/locale/he.json +++ b/src/locale/he.json @@ -109,5 +109,9 @@ "bearing": "מעלות", "coords": "נ.צ.", "hide_document": "הסתר מידע לגיקים", - "show_document": "הצג מידע לגיקים" + "show_document": "הצג מידע לגיקים", + "lineProfile": { + "title": "פרופיל קו", + "notFound":"לא הצלחנו למצוא את הקו שחיפשת :(" + } } diff --git a/src/pages/Profile.tsx b/src/pages/Profile.tsx index 53464a64..95e1c995 100644 --- a/src/pages/Profile.tsx +++ b/src/pages/Profile.tsx @@ -1,21 +1,13 @@ import styled from 'styled-components' -import { useContext } from 'react' import Grid from '@mui/material/Unstable_Grid2' // Grid version 2 -import moment from 'moment' import { Label } from './components/Label' import { NotFound } from './components/NotFound' import { PageContainer } from './components/PageContainer' import { useTranslation } from 'react-i18next' -import { PageSearchState, SearchContext } from '../model/pageState' -import LineNumberSelector from './components/LineSelector' -import OperatorSelector from './components/OperatorSelector' -import RouteSelector from './components/RouteSelector' //API -// import { /*getGtfsRidesList,*/ getRidesAsync } from 'src/api/profileService' -import { getRoutesAsync } from '../api/gtfsService' import Widget from 'src/shared/Widget' import { useLoaderData } from 'react-router-dom' @@ -39,13 +31,29 @@ const GeneralDetailsAboutLine = () => { const LineProfileComponent = () => { const { t } = useTranslation() - const route = useLoaderData() as any + const route = useLoaderData() as { + // TODO: find better type definition + agency_name: string + route_short_name: string + route_long_name: string + message?: string + } console.log('route', route) + if (route.message) + return ( + + +

{t('lineProfile.notFound')}

+
{route.message}
+
+
+ ) + return ( -

{t('profile_page')}

+

{t('lineProfile.title')}