Skip to content

Commit d7b798b

Browse files
authored
Merge pull request #232 from mapswipe/fix/charts
fix: chart in projects page
2 parents 15ccfe3 + 4d43f17 commit d7b798b

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

src/components/ProjectsMap/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ function ProjectMap(props: Props) {
182182
<Link
183183
className={styles.cardLink}
184184
key={project.id}
185-
href={`/[locale]/projects/${project.id}`}
185+
href={`/[locale]/projects/${project.firebaseId}`}
186186
>
187187
<Card
188188
className={styles.project}
@@ -215,12 +215,12 @@ function ProjectMap(props: Props) {
215215
<div className={styles.progressBar}>
216216
<div className={styles.track}>
217217
<div
218-
style={{ width: `${project.progress}%` }}
218+
style={{ width: `${project.progress * 100}%` }}
219219
className={styles.progress}
220220
/>
221221
</div>
222222
<div className={styles.progressLabel}>
223-
{t('project-card-progress-text', { progress: project.progress })}
223+
{t('project-card-progress-text', { progress: (project.progress * 100) })}
224224
</div>
225225
</div>
226226
)}

src/pages/[locale]/projects/[id].tsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import React, { useEffect, useState, useMemo } from 'react';
22
import dynamic from 'next/dynamic';
33
import { GetStaticProps, GetStaticPaths } from 'next';
44
import { useTranslation } from 'next-i18next';
5-
import { _cs, bound, listToMap } from '@togglecorp/fujs';
5+
import {
6+
_cs,
7+
bound,
8+
listToMap,
9+
isDefined,
10+
} from '@togglecorp/fujs';
611
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
712
import {
813
IoDownloadOutline,
@@ -449,11 +454,11 @@ function Project(props: Props) {
449454
</div>
450455
</div>
451456
<div className={styles.chartContainer}>
452-
{chartPoints.length > 1 ? (
453-
<div
454-
ref={svgContainerRef}
455-
className={styles.timelineChartContainer}
456-
>
457+
<div
458+
ref={svgContainerRef}
459+
className={styles.timelineChartContainer}
460+
>
461+
{(isDefined(projectHistory) && chartPoints.length > 1) ? (
457462
<svg className={styles.timelineChart}>
458463
<defs>
459464
<linearGradient
@@ -522,15 +527,15 @@ function Project(props: Props) {
522527
d={getPathData(chartPoints)}
523528
/>
524529
</svg>
525-
</div>
526-
) : (
527-
<div className={styles.emptyChart}>
528-
<IoStatsChartSharp className={styles.chartIcon} />
529-
<div className={styles.message}>
530-
Not enough data points for the chart!
530+
) : (
531+
<div className={styles.emptyChart}>
532+
<IoStatsChartSharp className={styles.chartIcon} />
533+
<div className={styles.message}>
534+
Not enough data points for the chart!
535+
</div>
531536
</div>
532-
</div>
533-
)}
537+
)}
538+
</div>
534539
</div>
535540
</div>
536541
</Section>

0 commit comments

Comments
 (0)