Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: removing texts (part 6) #315

Merged
merged 4 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/pages/components/timeline/TimelinePoint.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TEXTS } from 'src/resources/texts'
import { t } from 'i18next'
import styled from 'styled-components'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { t } from 'i18next'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not remove the i18next modal, because I'm still using it in pointTypeToDescription.

import { Moment } from 'moment'

Expand All @@ -25,9 +25,9 @@ export const pointTypeToColor: Record<PointType, string> = {

export const pointTypeToDescription: Record<PointType, string | null> = {
[PointType.BOUNDARY]: null,
[PointType.GTFS]: TEXTS.timestamp_gtfs,
[PointType.SIRI]: TEXTS.timestamp_siri,
[PointType.TARGET]: TEXTS.timestamp_target,
[PointType.GTFS]: t('timestamp_gtfs'),
[PointType.SIRI]: t('timestamp_siri'),
[PointType.TARGET]: t('timestamp_target'),
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[PointType.GTFS]: t('timestamp_gtfs'),
[PointType.SIRI]: t('timestamp_siri'),
[PointType.TARGET]: t('timestamp_target'),
[PointType.GTFS]: 'timestamp_gtfs',
[PointType.SIRI]: 'timestamp_siri',
[PointType.TARGET]: 'timestamp_target',

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I think we need the translation modal, this is the result if we remove it from the first two:
image


type PointProps = {
Expand Down Expand Up @@ -58,7 +58,7 @@ type LabeledPointProps = {
} & PointProps

export const LabeledPoint = ({ timestamp, top, type }: LabeledPointProps) => {
const timeDisplay = timestamp.format(TEXTS.time_format)
const timeDisplay = timestamp.format(t('time_format'))
return (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const timeDisplay = timestamp.format(t('time_format'))
const timeDisplay = timestamp.format('time_format')

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we can pass the time format directly = HH:mm:ss. If we pass it like 'time_format' this is what we get:
image

I think I have seen use of the translation modal in another place, for formatting time. If so maybe it should be a constant somewhere.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, it's weird to find it in the translation file, you're right. it can simply be a constant

<>
<Point top={top} type={type} title={timeDisplay} />
Expand Down
214 changes: 0 additions & 214 deletions src/resources/texts.tsx

This file was deleted.

Loading