From 9d8d2695c117d25d5cafd68b63dff7139ae80f55 Mon Sep 17 00:00:00 2001 From: royallsilwallz Date: Thu, 17 Oct 2024 10:23:17 +0545 Subject: [PATCH 1/8] Remove `Map Swipe` tab if MapSwipe group ID not present --- frontend/src/views/partnersStats.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/partnersStats.js b/frontend/src/views/partnersStats.js index 9da9d83d4b..2eefb7a6fd 100644 --- a/frontend/src/views/partnersStats.js +++ b/frontend/src/views/partnersStats.js @@ -86,6 +86,11 @@ export const PartnersStats = () => { .filter((key) => key.startsWith('link')) .filter((link) => partner[link]); + // remove Map Swipe tab if mapswipe_group_id not present + const modifiedTabData = !partner?.mapswipe_group_id + ? tabData.filter((tab) => tab.id !== 'mapswipe') + : tabData; + return ( { )}
- {tabData.map(({ id: tabId, title }) => ( + {modifiedTabData.map(({ id: tabId, title }) => (
Date: Thu, 17 Oct 2024 11:09:48 +0545 Subject: [PATCH 2/8] Add MapSwipe group name to overview section in MapSwipe stats --- frontend/src/components/partnerMapswipeStats/overview.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/src/components/partnerMapswipeStats/overview.js b/frontend/src/components/partnerMapswipeStats/overview.js index 0eeaf21818..22b51365a8 100644 --- a/frontend/src/components/partnerMapswipeStats/overview.js +++ b/frontend/src/components/partnerMapswipeStats/overview.js @@ -82,6 +82,9 @@ export const Overview = () => { customPlaceholder={} ready={!isLoading && !isRefetching} > +

+ {data?.nameInsideProvider} +

Date: Thu, 17 Oct 2024 11:13:15 +0545 Subject: [PATCH 3/8] Change `ds` to `days` in MapSwipe Stats page --- frontend/src/components/partnerMapswipeStats/overview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/partnerMapswipeStats/overview.js b/frontend/src/components/partnerMapswipeStats/overview.js index 22b51365a8..723b2d1882 100644 --- a/frontend/src/components/partnerMapswipeStats/overview.js +++ b/frontend/src/components/partnerMapswipeStats/overview.js @@ -30,7 +30,7 @@ export const formatSecondsToTwoUnits = (seconds, shortFormat = false) => { years: 'yrs', months: 'mos', weeks: 'wks', - days: 'ds', + days: 'days', hours: 'hrs', minutes: 'mins', seconds: 'secs', From 631d1b13d63b3016f69d00857b6c934b600d44c3 Mon Sep 17 00:00:00 2001 From: royallsilwallz Date: Mon, 21 Oct 2024 13:51:44 +0545 Subject: [PATCH 4/8] Fix content overflowing responsive issue in MapSwipe Stats page --- .../partnerMapswipeStats/overview.js | 2 +- .../projectTypeAreaStats.js | 2 +- .../swipesByOrganization.js | 3 +- .../swipesByProjectType.js | 2 +- frontend/src/views/partnersMapswipeStats.css | 17 -------- frontend/src/views/partnersMapswipeStats.js | 10 ++--- frontend/src/views/partnersMapswipeStats.scss | 42 +++++++++++++++++++ 7 files changed, 51 insertions(+), 27 deletions(-) delete mode 100644 frontend/src/views/partnersMapswipeStats.css create mode 100644 frontend/src/views/partnersMapswipeStats.scss diff --git a/frontend/src/components/partnerMapswipeStats/overview.js b/frontend/src/components/partnerMapswipeStats/overview.js index 723b2d1882..eb88287fa6 100644 --- a/frontend/src/components/partnerMapswipeStats/overview.js +++ b/frontend/src/components/partnerMapswipeStats/overview.js @@ -86,7 +86,7 @@ export const Overview = () => { {data?.nameInsideProvider}
diff --git a/frontend/src/components/partnerMapswipeStats/swipesByOrganization.js b/frontend/src/components/partnerMapswipeStats/swipesByOrganization.js index 9209740dc3..7a94ae5956 100644 --- a/frontend/src/components/partnerMapswipeStats/swipesByOrganization.js +++ b/frontend/src/components/partnerMapswipeStats/swipesByOrganization.js @@ -80,11 +80,10 @@ export const SwipesByOrganization = ({ contributionsByOrganization = [] }) => { }, []); return ( -
+

-
{contributionsByOrganization.length === 0 && ( diff --git a/frontend/src/components/partnerMapswipeStats/swipesByProjectType.js b/frontend/src/components/partnerMapswipeStats/swipesByProjectType.js index 399c00f608..5d79f22cc6 100644 --- a/frontend/src/components/partnerMapswipeStats/swipesByProjectType.js +++ b/frontend/src/components/partnerMapswipeStats/swipesByProjectType.js @@ -82,7 +82,7 @@ export const SwipesByProjectType = ({ contributionsByProjectType = [] }) => { }, []); return ( -
+

diff --git a/frontend/src/views/partnersMapswipeStats.css b/frontend/src/views/partnersMapswipeStats.css deleted file mode 100644 index 3bf7e57d23..0000000000 --- a/frontend/src/views/partnersMapswipeStats.css +++ /dev/null @@ -1,17 +0,0 @@ -.mapswipe-stats-info-banner { - background-color: #d9d7d7; - width: fit-content; - margin-left: 20px; - border-radius: 3px; -} - -.mapswipe-stats-info-banner::before { - content: ''; - position: absolute; - left: -20px; - top: 0; - bottom: 0; - width: 20px; - background-color: #d9d7d7; - clip-path: polygon(100% 0, 0 50%, 100% 100%); -} diff --git a/frontend/src/views/partnersMapswipeStats.js b/frontend/src/views/partnersMapswipeStats.js index c9015d3640..9d067cc6d8 100644 --- a/frontend/src/views/partnersMapswipeStats.js +++ b/frontend/src/views/partnersMapswipeStats.js @@ -19,7 +19,7 @@ import { SwipesByProjectType } from '../components/partnerMapswipeStats/swipesBy import { SwipesByOrganization } from '../components/partnerMapswipeStats/swipesByOrganization'; import messages from './messages'; import { fetchLocalJSONAPI } from '../network/genericJSONRequest'; -import './partnersMapswipeStats.css'; +import './partnersMapswipeStats.scss'; const PagePlaceholder = () => (
@@ -141,16 +141,16 @@ export const PartnersMapswipeStats = () => {
-
+
{getSwipes()}
-
+
{getTimeSpentContributing()} @@ -158,7 +158,7 @@ export const PartnersMapswipeStats = () => {
-
+
Date: Mon, 21 Oct 2024 19:18:50 +0545 Subject: [PATCH 5/8] Use `/stats` route instead of `/stats/leaderboard` for Partner Stats --- frontend/src/components/partners/partners.js | 2 +- frontend/src/views/partnersStats.js | 21 +++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/partners/partners.js b/frontend/src/components/partners/partners.js index 3557a5e7d0..2a01708188 100644 --- a/frontend/src/components/partners/partners.js +++ b/frontend/src/components/partners/partners.js @@ -95,7 +95,7 @@ export function PartnersCard({ details }) { - + { const [partnerStats, setPartnerStats] = useState(null); const [error, loading, partner] = useFetch(`partners/${id}/`); - // navigate to /leaderboard path when no tab param present - useEffect(() => { - if (!tabname) { - navigate('leaderboard'); - } - }, [navigate, tabname]); - const fetchData = async (name) => { try { let hashtag = name.trim(); @@ -73,12 +66,10 @@ export const PartnersStats = () => { function getTabContent() { switch (tabname) { - case 'leaderboard': - return ; case 'mapswipe': return ; default: - return <>; + return ; } } @@ -91,6 +82,8 @@ export const PartnersStats = () => { ? tabData.filter((tab) => tab.id !== 'mapswipe') : tabData; + const activeTab = tabname === 'mapswipe' ? 'mapswipe' : 'leaderboard'; + return ( { role="button" tabIndex={0} className={`flex items-center pointer partners-tab-item ${ - tabname === tabId ? 'bg-tan blue-dark' : 'bg-grey-dark white' + activeTab === tabId ? 'bg-tan blue-dark' : 'bg-grey-dark white' }`} - onClick={() => navigate(`/partners/${id}/stats/${tabId}`)} + onClick={() => + tabId === 'leaderboard' + ? navigate(`/partners/${id}/stats`) + : navigate(`/partners/${id}/stats/${tabId}`) + } onKeyDown={() => {}} >

{title}

From 6e1d75211e1e100e169738eac05c9580ae34f540 Mon Sep 17 00:00:00 2001 From: royallsilwallz Date: Tue, 22 Oct 2024 14:29:03 +0545 Subject: [PATCH 6/8] Move the stats info footer to the top of the stats cards --- .../src/components/partners/leaderboard.js | 3 ++ .../src/components/partners/partnersStats.js | 2 - .../src/components/statsInfoFooter/index.jsx | 40 ++++++++++++------- .../components/userDetail/elementsMapped.js | 4 +- frontend/src/views/partnersMapswipeStats.js | 2 +- frontend/src/views/partnersMapswipeStats.scss | 3 ++ 6 files changed, 34 insertions(+), 20 deletions(-) diff --git a/frontend/src/components/partners/leaderboard.js b/frontend/src/components/partners/leaderboard.js index aeb2cb7087..c2cddd1920 100644 --- a/frontend/src/components/partners/leaderboard.js +++ b/frontend/src/components/partners/leaderboard.js @@ -4,10 +4,13 @@ import messages from '../../views/messages'; import { StatsSection } from './partnersStats'; import { Activity } from './partnersActivity'; import { CurrentProjects } from './currentProjects'; +import StatsInfoFooter from '../statsInfoFooter'; export const Leaderboard = ({ partner, partnerStats }) => { return (
+ +

{partner.primary_hashtag diff --git a/frontend/src/components/partners/partnersStats.js b/frontend/src/components/partners/partnersStats.js index c4758eed8a..8724511215 100644 --- a/frontend/src/components/partners/partnersStats.js +++ b/frontend/src/components/partners/partnersStats.js @@ -4,7 +4,6 @@ import shortNumber from 'short-number'; import messages from './messages'; import { StatsCard } from '../statsCard'; import { MappingIcon, EditIcon, RoadIcon, HomeIcon } from '../svgIcons'; -import StatsInfoFooter from '../statsInfoFooter'; const iconClass = 'h-50 w-50'; const iconStyle = { height: '45px' }; @@ -71,7 +70,6 @@ export const StatsSection = ({ partner }) => { className={'w-25-l w-50-m w-100 mv1'} />

-
); }; diff --git a/frontend/src/components/statsInfoFooter/index.jsx b/frontend/src/components/statsInfoFooter/index.jsx index abe69a640a..b3cf5a2ea3 100644 --- a/frontend/src/components/statsInfoFooter/index.jsx +++ b/frontend/src/components/statsInfoFooter/index.jsx @@ -2,27 +2,37 @@ import { useIntl } from 'react-intl'; import { useOsmStatsMetadataQuery } from '../../api/stats'; import { dateOptions } from '../statsTimestamp'; +import { InfoIcon } from '../svgIcons'; +import '../../views/partnersMapswipeStats.scss'; -export default function StatsInfoFooter() { +export default function StatsInfoFooter({ className }) { const intl = useIntl(); const { data: osmStatsMetadata } = useOsmStatsMetadataQuery(); return ( -
- - These statistics come from{' '} - - ohsomeNow Stats - {' '} - and were last updated at{' '} - {intl.formatDate(osmStatsMetadata?.max_timestamp, dateOptions)} ( - {intl.timeZone}). +
+ + + + These statistics come from{' '} + + ohsomeNow Stats + {' '} + and were last updated at{' '} + + {intl.formatDate(osmStatsMetadata?.max_timestamp, dateOptions)} + {' '} + ({intl.timeZone}) +
); diff --git a/frontend/src/components/userDetail/elementsMapped.js b/frontend/src/components/userDetail/elementsMapped.js index 1e1655c56f..6dc4b3bc31 100644 --- a/frontend/src/components/userDetail/elementsMapped.js +++ b/frontend/src/components/userDetail/elementsMapped.js @@ -125,6 +125,8 @@ export const ElementsMapped = ({ userStats, osmStats }) => { return (
+ +
{ unitLess={osmStats?.waterway?.modified?.unit_less} />
- -
); }; diff --git a/frontend/src/views/partnersMapswipeStats.js b/frontend/src/views/partnersMapswipeStats.js index 9d067cc6d8..b3b097b804 100644 --- a/frontend/src/views/partnersMapswipeStats.js +++ b/frontend/src/views/partnersMapswipeStats.js @@ -46,7 +46,7 @@ const PagePlaceholder = () => ( const InfoBanner = () => { return ( -
+
diff --git a/frontend/src/views/partnersMapswipeStats.scss b/frontend/src/views/partnersMapswipeStats.scss index e38842aee8..186a7cb92a 100644 --- a/frontend/src/views/partnersMapswipeStats.scss +++ b/frontend/src/views/partnersMapswipeStats.scss @@ -13,6 +13,9 @@ background-color: #d9d7d7; clip-path: polygon(100% 0, 0 50%, 100% 100%); } + .stats-info-datetime { + letter-spacing: -0.4px; + } } $medium: 960px; From 2aae1cbc3886dc305b4d96def287f68a12b51232 Mon Sep 17 00:00:00 2001 From: royallsilwallz Date: Thu, 24 Oct 2024 19:35:51 +0545 Subject: [PATCH 7/8] Change stats info design in homepage, project & feature stats page --- frontend/src/components/homepage/stats.js | 9 ++-- frontend/src/components/projectStats/edits.js | 50 ++++++++++--------- .../components/teamsAndOrgs/featureStats.js | 5 +- frontend/src/views/home.js | 4 -- 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/frontend/src/components/homepage/stats.js b/frontend/src/components/homepage/stats.js index 1901fa35f4..c970ed5ed9 100644 --- a/frontend/src/components/homepage/stats.js +++ b/frontend/src/components/homepage/stats.js @@ -3,6 +3,7 @@ import shortNumber from 'short-number'; import messages from './messages'; import { useOsmStatsQuery, useSystemStatisticsQuery } from '../../api/stats'; +import StatsInfoFooter from '../statsInfoFooter'; export const StatsNumber = (props) => { const value = shortNumber(props.value); @@ -38,8 +39,10 @@ export const StatsSection = () => { const hasStatsLoaded = hasTmStatsLoaded && hasOsmStatsLoaded; return ( - <> -
+
+ + +
{ value={hasStatsLoaded ? tmStatsData.data.mappersOnline : undefined} />
- +
); }; diff --git a/frontend/src/components/projectStats/edits.js b/frontend/src/components/projectStats/edits.js index 9059c5ba76..b3bdb46d11 100644 --- a/frontend/src/components/projectStats/edits.js +++ b/frontend/src/components/projectStats/edits.js @@ -4,7 +4,7 @@ import projectMessages from './messages'; import userDetailMessages from '../userDetail/messages'; import { MappingIcon, HomeIcon, RoadIcon, EditIcon } from '../svgIcons'; import { StatsCard } from '../statsCard'; -import StatsTimestamp from '../statsTimestamp'; +import StatsInfoFooter from '../statsInfoFooter'; export const EditsStats = ({ data }) => { const { changesets, buildings, roads, edits } = data; @@ -18,30 +18,32 @@ export const EditsStats = ({ data }) => {

-
-
- } - description={} - value={changesets || 0} - /> - } - description={} - value={edits || 0} - /> - } - description={} - value={buildings || 0} - /> - } - description={} - value={roads || 0} - /> +
+ +
+ } + description={} + value={changesets || 0} + /> + } + description={} + value={edits || 0} + /> + } + description={} + value={buildings || 0} + /> + } + description={} + value={roads || 0} + /> +
); diff --git a/frontend/src/components/teamsAndOrgs/featureStats.js b/frontend/src/components/teamsAndOrgs/featureStats.js index b5b31ca9c3..8a3dbdd3ed 100644 --- a/frontend/src/components/teamsAndOrgs/featureStats.js +++ b/frontend/src/components/teamsAndOrgs/featureStats.js @@ -7,7 +7,7 @@ import userDetailMessages from '../userDetail/messages'; import { OHSOME_STATS_BASE_URL, defaultChangesetComment } from '../../config'; import { RoadIcon, HomeIcon, WavesIcon, MarkerIcon } from '../svgIcons'; import { StatsCard } from '../statsCard'; -import StatsTimestamp from '../statsTimestamp'; +import StatsInfoFooter from '../statsInfoFooter'; export const FeatureStats = () => { const [stats, setStats] = useState({ edits: 0, buildings: 0, roads: 0, pois: 0, waterways: 0 }); @@ -42,9 +42,10 @@ export const FeatureStats = () => {

-
+ + } description={} diff --git a/frontend/src/views/home.js b/frontend/src/views/home.js index 2d423e0b89..7b40ac7c5c 100644 --- a/frontend/src/views/home.js +++ b/frontend/src/views/home.js @@ -8,7 +8,6 @@ import { WhoIsMapping } from '../components/homepage/whoIsMapping'; import { Testimonials } from '../components/homepage/testimonials'; import { Alert } from '../components/alert'; import homeMessages from '../components/homepage/messages'; -import StatsTimestamp from '../components/statsTimestamp/'; export function Home() { return ( @@ -24,9 +23,6 @@ export function Home() { } > -
- -
From cd346160476417fdc1390ebc635acc450bcb23e2 Mon Sep 17 00:00:00 2001 From: royallsilwallz Date: Fri, 25 Oct 2024 10:25:26 +0545 Subject: [PATCH 8/8] Change cards layout in large screen size in Manage Stats --- .../components/teamsAndOrgs/featureStats.js | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/frontend/src/components/teamsAndOrgs/featureStats.js b/frontend/src/components/teamsAndOrgs/featureStats.js index 8a3dbdd3ed..5522e0f66a 100644 --- a/frontend/src/components/teamsAndOrgs/featureStats.js +++ b/frontend/src/components/teamsAndOrgs/featureStats.js @@ -46,30 +46,32 @@ export const FeatureStats = () => {
- } - description={} - value={stats.buildings || 0} - className={'w-25-l w-50-m w-100 mv1'} - /> - } - description={} - value={stats.roads || 0} - className={'w-25-l w-50-m w-100 mv1'} - /> - } - description={} - value={stats.pois || 0} - className={'w-25-l w-50-m w-100 mv1'} - /> - } - description={} - value={stats.waterways || 0} - className={'w-25-l w-50-m w-100 mv1'} - /> +
+ } + description={} + value={stats.buildings || 0} + className={'w-25-l w-50-m w-100 mv1'} + /> + } + description={} + value={stats.roads || 0} + className={'w-25-l w-50-m w-100 mv1'} + /> + } + description={} + value={stats.pois || 0} + className={'w-25-l w-50-m w-100 mv1'} + /> + } + description={} + value={stats.waterways || 0} + className={'w-25-l w-50-m w-100 mv1'} + /> +
);