From c08eac0062b208f4127c777b7026d90d28e1395b Mon Sep 17 00:00:00 2001 From: Isaac Kabucho Date: Sun, 6 Aug 2023 07:35:52 +0300 Subject: [PATCH 1/2] feat: made changes to Add people who grows this tree list on /trees/{id} page issue 1588 --- package-lock.json | 4 +-- src/models/apiPaths.js | 6 ++--- src/pages/trees/[treeid].js | 50 ++++++++++++++++++++++++------------- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index 670f5e1b..6d5d405f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "client", - "version": "2.3.3", + "version": "2.6.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "client", - "version": "2.3.3", + "version": "2.6.3", "dependencies": { "@emotion/cache": "^11.5.0", "@emotion/react": "^11.5.0", diff --git a/src/models/apiPaths.js b/src/models/apiPaths.js index 00d4a3cc..597654d7 100644 --- a/src/models/apiPaths.js +++ b/src/models/apiPaths.js @@ -9,9 +9,9 @@ const apiPaths = { countriesLatLon: (lat = '', lon = '') => urlJoin(host, `/countries?lat=${lat}&lon=${lon}`), leaders: urlJoin(host, '/countries/leaderboard'), - trees: (id = '') => urlJoin(host, `/trees/${id}`), - captures: (id = '') => urlJoin(host, `captures/${id}`), - growers: (id = '') => urlJoin(host, `growers/${id}`), + trees: (id = '') => urlJoin(host, `v2/trees/${id}`), + captures: (id = '') => urlJoin(host, `v2/captures/${id}`), + growers: (id = '') => urlJoin(host, `v2/growers/${id}`), planters: (id = '') => urlJoin(host, `growers/${id}`), stakeHolders: (id = '') => urlJoin(hostV2, `/stakeholder/stakeholders/${id}`), species: urlJoin(host, '/species'), diff --git a/src/pages/trees/[treeid].js b/src/pages/trees/[treeid].js index 2305cdbf..1d2c20f0 100644 --- a/src/pages/trees/[treeid].js +++ b/src/pages/trees/[treeid].js @@ -12,6 +12,7 @@ import moment from 'moment'; import { useRouter } from 'next/router'; import { useEffect, useMemo } from 'react'; import Badge from 'components/Badge'; +import FeaturedPlantersSlider from 'components/FeaturedPlantersSlider'; import HeadTag from 'components/HeadTag'; import InformationCard1 from 'components/InformationCard1'; import LikeButton from 'components/LikeButton'; @@ -23,7 +24,7 @@ import Icon from 'components/common/CustomIcon'; import TagList from 'components/common/TagList'; import TreeTag from 'components/common/TreeTag'; import { useDrawerContext } from 'context/DrawerContext'; -import { useMobile, useEmbed } from 'hooks/globalHooks'; +import { useMobile, useEmbed, useFullscreen } from 'hooks/globalHooks'; import { usePageLoading } from 'hooks/usePageLoading'; import AccuracyIcon from 'images/icons/accuracy.svg'; import CalendarIcon from 'images/icons/calendar.svg'; @@ -36,13 +37,20 @@ import TokenIcon from 'images/icons/token.svg'; import imagePlaceholder from 'images/image-placeholder.png'; import SearchIcon from 'images/search.svg'; import { useMapContext } from 'mapContext'; -import { getOrganizationById, getPlanterById, getTreeById } from 'models/api'; +import { + getOrganizationById, + getPlanterById, + getTreeById, + getCapturesById, + getGrowerById, +} from 'models/api'; import * as pathResolver from 'models/pathResolver'; import * as utils from 'models/utils'; export default function Tree({ tree, planter, + growers, organization, nextExtraIsEmbed, nextExtraKeyword, @@ -59,6 +67,7 @@ export default function Tree({ }); const isMobile = useMobile(); const isEmbed = useEmbed(); + const isFullscreen = useFullscreen(); const isPlanterContext = context && context.name === 'planters'; const isOrganizationContext = context && context.name === 'organizations'; @@ -583,22 +592,23 @@ export default function Tree({ /> )} - - - + {growers.length > 0 && ( + <> + + Featured planters this week + + `/planters/${id}`} + color="secondary" + planters={growers} + isMobile={isFullscreen} + /> + + )} Date: Mon, 7 Aug 2023 18:58:47 +0300 Subject: [PATCH 2/2] fix: removed v2/ from the apiPath file --- src/models/apiPaths.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/models/apiPaths.js b/src/models/apiPaths.js index 597654d7..3e7f17a6 100644 --- a/src/models/apiPaths.js +++ b/src/models/apiPaths.js @@ -9,9 +9,9 @@ const apiPaths = { countriesLatLon: (lat = '', lon = '') => urlJoin(host, `/countries?lat=${lat}&lon=${lon}`), leaders: urlJoin(host, '/countries/leaderboard'), - trees: (id = '') => urlJoin(host, `v2/trees/${id}`), - captures: (id = '') => urlJoin(host, `v2/captures/${id}`), - growers: (id = '') => urlJoin(host, `v2/growers/${id}`), + trees: (id = '') => urlJoin(host, `trees/${id}`), + captures: (id = '') => urlJoin(host, `captures/${id}`), + growers: (id = '') => urlJoin(host, `growers/${id}`), planters: (id = '') => urlJoin(host, `growers/${id}`), stakeHolders: (id = '') => urlJoin(hostV2, `/stakeholder/stakeholders/${id}`), species: urlJoin(host, '/species'),