8000 Format area numbers in accessibility map by GabrielBruno24 · Pull Request #1408 · chairemobilite/transition · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Format area numbers in accessibility map #1408

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

10000
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export interface AccessibilityComparisonStatsComponentProps {
const AccessibilityComparisonStatsComponent: React.FunctionComponent<AccessibilityComparisonStatsComponentProps> = (
props: AccessibilityComparisonStatsComponentProps
) => {
const { t } = useTranslation(['transit', 'main']);
const { t, i18n } = useTranslation(['transit', 'main']);

const language = i18n.language;

const sortByDuration = (features: GeoJSON.Feature[]) => {
features.sort((feat1, feat2) => {
Expand Down Expand Up @@ -68,15 +70,24 @@ const AccessibilityComparisonStatsComponent: React.FunctionComponent<Accessibili
</tr>
<tr>
<th>{t('transit:transitRouting:AccessibilityMapAreaSquareKm')}</th>
<td>{Math.round(properties1.areaSqKm * 100) / 100}</td>
<td>{Math.round(properties2.areaSqKm * 100) / 100}</td>
<td>{Math.round((properties2.areaSqKm - properties1.areaSqKm) * 100) / 100}</td>
<td>{(Math.round(properties1.areaSqKm * 100) / 100).toLocaleString(language)}</td>
<td>{(Math.round(properties2.areaSqKm * 100) / 100).toLocaleString(language)}</td>
<td>
{(Math.round((properties2.areaSqKm - properties1.areaSqKm) * 100) / 100).toLocaleString(
language,
{ signDisplay: 'exceptZero' }
)}
</td>
</tr>
<tr>
<th>{t('transit:transitRouting:AccessibilityMapAreaSquarem')}</th>
<td>{Math.round(properties1.areaSqM)}</td>
<td>{Math.round(properties2.areaSqM)}</td>
<td>{Math.round(properties2.areaSqM - properties1.areaSqM)}</td>
<td>{Math.round(properties1.areaSqM).toLocaleString(language)}</td>
<td>{Math.round(properties2.areaSqM).toLocaleString(language)}</td>
<td>
{Math.round(properties2.areaSqM - properties1.areaSqM).toLocaleString(language, {
signDisplay: 'exceptZero'
})}
</td>
</tr>
{/* TODO: Add more rows when POIs are fixed. */}
</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ const AccessibilityMapStatsComponent: React.FunctionComponent<AccessibilityMapSt
props: AccessibilityMapStatsComponentProps
) => {
const features = props.accessibilityPolygons.features;

const language = props.i18n.language;

features.sort((feat1, feat2) => {
const duration1 = feat1.properties?.durationMinutes;
const duration2 = feat2.properties?.durationMinutes;
Expand Down Expand Up @@ -70,11 +73,11 @@ const AccessibilityMapStatsComponent: React.FunctionComponent<AccessibilityMapSt
</tr>
<tr>
<th>{props.t('transit:transitRouting:AccessibilityMapAreaSquareKm')}</th>
<td>{Math.round(properties.areaSqKm * 100) / 100}</td>
<td>{(Math.round(properties.areaSqKm * 100) / 100).toLocaleString(language)}</td>
</tr>
<tr>
<th>{props.t('transit:transitRouting:AccessibilityMapAreaSquarem')}</th>
<td>{Math.round(properties.areaSqM)}</td>
<td>{Math.round(properties.areaSqM).toLocaleString(language)}</td>
</tr>
{atLeastOneCategoryNotEmpty && (
<tr>
Expand Down
Loading
0