diff --git a/canopeum_frontend/canopeum-mockoon.json b/canopeum_frontend/canopeum-mockoon.json
index 6db79df9a..f68d3c834 100644
--- a/canopeum_frontend/canopeum-mockoon.json
+++ b/canopeum_frontend/canopeum-mockoon.json
@@ -656,7 +656,7 @@
"responses": [
{
"uuid": "ac5b893d-b30e-43c9-8988-4c13a7e0c819",
- "body": "[\n {{#repeat 1 (int 1 14) comma=true}}\n {\n \"name\": \"{{lorem (int 1 3)}}\",\n \"type\": {\n \"id\": {{int 0 6}},\n \"en\": \"{{lorem (int 1 2)}}\",\n \"fr\": \"{{lorem (int 1 2)}}\"\n },\n \"plantCount\": {{int 0 5000}},\n \"survivedCount\": {{int 0 5000}},\n \"propagationCount\": {{int 0 500}},\n \"visitorCount\": {{int 0 500}},\n \"sponsors\": {{{someOf (array (lorem 2) (lorem 2) (lorem 2) (lorem 2) (lorem 2)) 0 5 true}}},\n \"progress\": {{float 0 100}}\n }\n {{/repeat}}\n]",
+ "body": "[\n {{#repeat 1 (int 1 14) comma=true}}\n {\n \"id\": \"{{int (int 1 9999)}}\", \"name\": \"{{lorem (int 1 3)}}\", \n \"type\": {\n \"id\": {{int 0 6}},\n \"en\": \"{{lorem (int 1 2)}}\",\n \"fr\": \"{{lorem (int 1 2)}}\"\n },\n \"plantCount\": {{int 0 5000}},\n \"survivedCount\": {{int 0 5000}},\n \"propagationCount\": {{int 0 500}},\n \"visitorCount\": {{int 0 500}},\n \"sponsors\": {{{someOf (array (lorem 2) (lorem 2) (lorem 2) (lorem 2) (lorem 2)) 0 5 true}}},\n \"progress\": {{float 0 100}}\n }\n {{/repeat}}\n]",
"latency": 0,
"statusCode": 200,
"label": "",
diff --git a/canopeum_frontend/src/components/analytics/SiteSummaryCard.tsx b/canopeum_frontend/src/components/analytics/SiteSummaryCard.tsx
index 9bc892367..110fb9c28 100644
--- a/canopeum_frontend/src/components/analytics/SiteSummaryCard.tsx
+++ b/canopeum_frontend/src/components/analytics/SiteSummaryCard.tsx
@@ -7,7 +7,7 @@ type Props = {
}
const SiteSummaryCard = ({ site }: Props) => {
- const { t } = useTranslation()
+ const { t: translate } = useTranslation()
return (
{
psychiatry
{site.plantCount}
- Planted
+ {translate('analytics.site-summary.planted')}
@@ -50,7 +50,7 @@ const SiteSummaryCard = ({ site }: Props) => {
forest
{site.survivedCount}
- Survived
+ {translate('analytics.site-summary.survived')}
@@ -58,7 +58,7 @@ const SiteSummaryCard = ({ site }: Props) => {
forest
{site.propagationCount}
- Propagation
+ {translate('analytics.site-summary.propagation')}
@@ -74,7 +74,9 @@ const SiteSummaryCard = ({ site }: Props) => {
/>
- {Math.round(site.progress)}% Sponsored
+
+ {Math.round(site.progress)}% {translate('analytics.site-summary.sponsored')}
+
diff --git a/canopeum_frontend/src/locale/en/analytics.json b/canopeum_frontend/src/locale/en/analytics.json
index 084c28060..2124fe0ab 100644
--- a/canopeum_frontend/src/locale/en/analytics.json
+++ b/canopeum_frontend/src/locale/en/analytics.json
@@ -16,5 +16,11 @@
"table-row-11": "how many replaced",
"table-row-12": "amount of seeds collected in area",
"table-row-13": "types of seeds collected",
- "last-update": "last update"
+ "last-update": "last update",
+ "site-summary": {
+ "planted": "Planted",
+ "survived": "Survived",
+ "propagation": "Propagation",
+ "sponsored": "Sponsored"
+ }
}
diff --git a/canopeum_frontend/src/locale/en/analyticsSite.json b/canopeum_frontend/src/locale/en/analyticsSite.json
new file mode 100644
index 000000000..6cd3f30fb
--- /dev/null
+++ b/canopeum_frontend/src/locale/en/analyticsSite.json
@@ -0,0 +1,4 @@
+{
+ "location": "Location",
+ "batch-tracking": "Batch Tracking"
+}
diff --git a/canopeum_frontend/src/locale/en/index.ts b/canopeum_frontend/src/locale/en/index.ts
index f995f17d8..f298365b8 100644
--- a/canopeum_frontend/src/locale/en/index.ts
+++ b/canopeum_frontend/src/locale/en/index.ts
@@ -1,4 +1,5 @@
import analyticsJSON from './analytics.json'
+import analyticsSiteJSON from './analyticsSite.json'
import homeJSON from './home.json'
import mapSiteJSON from './mapSite.json'
@@ -6,6 +7,7 @@ const enJSON = {
translation: {
home: { ...homeJSON },
analytics: { ...analyticsJSON },
+ analyticsSite: { ...analyticsSiteJSON },
mapSite: { ...mapSiteJSON },
},
}
diff --git a/canopeum_frontend/src/locale/fr/analytics.json b/canopeum_frontend/src/locale/fr/analytics.json
index 782126df6..2ed0d2ac5 100644
--- a/canopeum_frontend/src/locale/fr/analytics.json
+++ b/canopeum_frontend/src/locale/fr/analytics.json
@@ -16,5 +16,11 @@
"table-row-11": "combien ont été remplacés",
"table-row-12": "quantité de graines collectées dans la zone",
"table-row-13": "types de graines collectées",
- "last-update": "dernière mise à jour"
+ "last-update": "dernière mise à jour",
+ "site-summary": {
+ "planted": "Planté",
+ "survived": "Survécu",
+ "propagation": "Propagation",
+ "sponsored": "Sponsorisé"
+ }
}
diff --git a/canopeum_frontend/src/locale/fr/analyticsSite.json b/canopeum_frontend/src/locale/fr/analyticsSite.json
new file mode 100644
index 000000000..869fd68f3
--- /dev/null
+++ b/canopeum_frontend/src/locale/fr/analyticsSite.json
@@ -0,0 +1,4 @@
+{
+ "location": "Localisation",
+ "batch-tracking": "Suivi des lots"
+}
diff --git a/canopeum_frontend/src/locale/fr/index.ts b/canopeum_frontend/src/locale/fr/index.ts
index 3bd6153ed..114b5dd72 100644
--- a/canopeum_frontend/src/locale/fr/index.ts
+++ b/canopeum_frontend/src/locale/fr/index.ts
@@ -1,4 +1,5 @@
import analyticsJSON from './analytics.json'
+import analyticsSiteJSON from './analyticsSite.json'
import homeJSON from './home.json'
import mapSiteJSON from './mapSite.json'
@@ -6,6 +7,7 @@ const frJSON = {
translation: {
home: { ...homeJSON },
analytics: { ...analyticsJSON },
+ analyticsSite: { ...analyticsSiteJSON },
mapSite: { ...mapSiteJSON },
},
}
diff --git a/canopeum_frontend/src/pages/AnalyticsSite.tsx b/canopeum_frontend/src/pages/AnalyticsSite.tsx
index 9272b7476..660a88f18 100644
--- a/canopeum_frontend/src/pages/AnalyticsSite.tsx
+++ b/canopeum_frontend/src/pages/AnalyticsSite.tsx
@@ -1,9 +1,43 @@
+import type { Site } from '@services/api'
+import api from '@services/apiInterface'
+import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
+import { useParams } from 'react-router-dom'
const AnalyticsSite = () => {
- const { t } = useTranslation()
+ const { t: translate } = useTranslation()
+ const { siteId: siteIdFromParams } = useParams()
- return
+ const [site, setSite] = useState()
+
+ const fetchSite = async (siteId: number) => setSite(await api().analytics.site(siteId))
+
+ useEffect(() => {
+ if (!siteIdFromParams) return
+
+ const siteIdNumber = Number.parseInt(siteIdFromParams, 10)
+ if (!siteIdNumber) return
+
+ void fetchSite(siteIdNumber)
+ }, [siteIdFromParams])
+
+ return (
+
+
+
+ {translate('analyticsSite.location')}
+
+
+
+
{site?.name}
+
+
+
+
+
{translate('analyticsSite.batch-tracking')}
+
+
+ )
}
export default AnalyticsSite