From f6039883fa1622d5b6dc1739eebbe027394b6bfc Mon Sep 17 00:00:00 2001 From: Juan M Date: Thu, 25 May 2023 16:36:05 +0200 Subject: [PATCH 1/3] Rename filter and sort in common --- src/components/InCommon.js | 4 ++-- src/models/in-common.js | 8 ++++++-- src/pages/Event.js | 4 ++-- src/pages/Events.js | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/InCommon.js b/src/components/InCommon.js index c05d93d..a762c3e 100644 --- a/src/components/InCommon.js +++ b/src/components/InCommon.js @@ -2,7 +2,7 @@ import toColor from '@mapbox/to-color' import { createRef, useContext, useEffect, useState } from 'react' import { Link } from 'react-router-dom' import { SettingsContext } from '../stores/cache' -import { filterAndSortInCommonEntries, INCOMMON_EVENTS_LIMIT } from '../models/in-common' +import { filterAndSortInCommon, INCOMMON_EVENTS_LIMIT } from '../models/in-common' import { intersection } from '../utils/array' import ButtonLink from './ButtonLink' import Card from './Card' @@ -32,7 +32,7 @@ function InCommon({ const [ownerHighlighted, setOwnerHighlighted] = useState(null) const [liRefs, setLiRefs] = useState({}) - let inCommonEntries = filterAndSortInCommonEntries(Object.entries(inCommon)) + let inCommonEntries = filterAndSortInCommon(Object.entries(inCommon)) let inCommonLimit = INCOMMON_EVENTS_LIMIT if (showCount > 0) { diff --git a/src/models/in-common.js b/src/models/in-common.js index 2e72fc3..10081fe 100644 --- a/src/models/in-common.js +++ b/src/models/in-common.js @@ -1,6 +1,6 @@ import { equals, intersection } from '../utils/array' -function filterAndSortInCommonEntries(inCommonEntries) { +function filterAndSortInCommon(inCommonEntries) { let entries = inCommonEntries.filter(([eventId, addresses]) => addresses.length > 1) entries.sort( ([aEventId, aAddresses], [bEventId, bAddresses]) => bAddresses.length - aAddresses.length @@ -30,4 +30,8 @@ function mergeEventsInCommon(eventData, all = false) { const INCOMMON_EVENTS_LIMIT = 20 -export { filterAndSortInCommonEntries, mergeEventsInCommon, INCOMMON_EVENTS_LIMIT } +export { + filterAndSortInCommon, + mergeEventsInCommon, + INCOMMON_EVENTS_LIMIT, +} diff --git a/src/pages/Event.js b/src/pages/Event.js index 461e26c..fda94f1 100644 --- a/src/pages/Event.js +++ b/src/pages/Event.js @@ -8,7 +8,7 @@ import { ReverseEnsContext } from '../stores/ethereum' import { scanAddress } from '../loaders/poap' import { getInCommonEventsWithProgress, patchEvents, putEventInCommon } from '../loaders/api' import { filterCacheEventsByInCommonEventIds, parseEventIds } from '../models/event' -import { filterAndSortInCommonEntries } from '../models/in-common' +import { filterAndSortInCommon } from '../models/in-common' import Timestamp from '../components/Timestamp' import Page from '../components/Page' import Card from '../components/Card' @@ -99,7 +99,7 @@ function Event() { () => { if (loadedCount === owners.length && !cachedTs) { const inCommonProcessed = Object.fromEntries( - filterAndSortInCommonEntries( + filterAndSortInCommon( Object.entries(inCommon) ) ) diff --git a/src/pages/Events.js b/src/pages/Events.js index 12dc736..1251cf3 100644 --- a/src/pages/Events.js +++ b/src/pages/Events.js @@ -5,7 +5,7 @@ import { HTMLContext } from '../stores/html' import { ReverseEnsContext } from '../stores/ethereum' import { getEventMetrics, getEventsMetrics, getEventsOwners, getInCommonEventsWithProgress, patchEvents, putEventInCommon, putEventOwners } from '../loaders/api' import { fetchPOAPs, scanAddress } from '../loaders/poap' -import { filterAndSortInCommonEntries, mergeEventsInCommon } from '../models/in-common' +import { filterAndSortInCommon, mergeEventsInCommon } from '../models/in-common' import { filterCacheEventsByInCommonEventIds, parseEventIds, parseExpiryDates } from '../models/event' import Timestamp from '../components/Timestamp' import Card from '../components/Card' @@ -441,7 +441,7 @@ function Events() { eventsLoaded++ if (eventId in eventData && !eventData[eventId].ts && !(eventId in errors) && !(eventId in loading)) { const inCommonProcessed = Object.fromEntries( - filterAndSortInCommonEntries( + filterAndSortInCommon( Object.entries(eventData[eventId].inCommon) ) ) From 9c45cd09a3662b04ba67c64ddf1378c8a14c2359 Mon Sep 17 00:00:00 2001 From: Juan M Date: Thu, 25 May 2023 16:43:02 +0200 Subject: [PATCH 2/3] Fix component identation --- src/components/LastEvents.js | 30 +++++++++++++++++------------- src/pages/Event.js | 4 +++- src/pages/Events.js | 36 ++++++++++++++++++++++-------------- src/pages/FeedbackList.js | 14 ++++++++------ src/pages/Home.js | 3 ++- 5 files changed, 52 insertions(+), 35 deletions(-) diff --git a/src/components/LastEvents.js b/src/components/LastEvents.js index 13741f5..47126a1 100644 --- a/src/components/LastEvents.js +++ b/src/components/LastEvents.js @@ -84,10 +84,12 @@ function LastEvents({ currentPage = 1, onPageChange = (page) => {}, qty = 3, sho /> )} {loading && } - {cachedEvents.length > 0 && !loading && } + {cachedEvents.length > 0 && !loading && ( + + )} {error && @@ -95,15 +97,17 @@ function LastEvents({ currentPage = 1, onPageChange = (page) => {}, qty = 3, sho } - {pages > 1 && !loading && { - setPage(newPage) - onPageChange(newPage) - }} - />} + {pages > 1 && !loading && ( + { + setPage(newPage) + onPageChange(newPage) + }} + /> + )} ) diff --git a/src/pages/Event.js b/src/pages/Event.js index 461e26c..1861317 100644 --- a/src/pages/Event.js +++ b/src/pages/Event.js @@ -319,7 +319,9 @@ function Event() { eta={loadedProgress.estimated} rate={loadedProgress.rate} /> - : )} + : + ) + } : diff --git a/src/pages/Events.js b/src/pages/Events.js index 12dc736..995825e 100644 --- a/src/pages/Events.js +++ b/src/pages/Events.js @@ -639,7 +639,9 @@ function Events() { - {(status === STATUS_INITIAL || (event.id in loading && loading[event.id] === LOADING_OWNERS)) && !(event.id in owners) && } + {(status === STATUS_INITIAL || (event.id in loading && loading[event.id] === LOADING_OWNERS)) && !(event.id in owners) && ( + + )} {event.id in owners && ( {formatStat(owners[event.id].length)} @@ -669,19 +671,25 @@ function Events() { - {event.id in loadedProgress && } - {event.id in progress && 0} - />} - {event.id in loading && loading[event.id] === LOADING_CACHING && } + {event.id in loadedProgress && ( + + )} + {event.id in progress && ( + 0} + /> + )} + {event.id in loading && loading[event.id] === LOADING_CACHING && ( + + )} {event.id in eventOwnerErrors && Object.entries(eventOwnerErrors[event.id]).map( ([address, error]) => (

diff --git a/src/pages/FeedbackList.js b/src/pages/FeedbackList.js index 1ffc38a..483461d 100644 --- a/src/pages/FeedbackList.js +++ b/src/pages/FeedbackList.js @@ -129,12 +129,14 @@ function FeedbackList({ qty = 10 }) { )} {error && {error.message ?? 'Unknown error'}} - {pages > 1 && } + {pages > 1 && ( + + )} diff --git a/src/pages/Home.js b/src/pages/Home.js index e0f4c94..c306d7c 100644 --- a/src/pages/Home.js +++ b/src/pages/Home.js @@ -48,7 +48,8 @@ function Home() { v{packageJson.version.split('.').slice(0, -1).join('.')} ) - : `v${packageJson.version.split('.').slice(0, -1).join('.')}`} + : `v${packageJson.version.split('.').slice(0, -1).join('.')}` + } From abba81061498a2456faea072dc49f7f4d0bd485f Mon Sep 17 00:00:00 2001 From: Juan M Date: Thu, 25 May 2023 16:44:49 +0200 Subject: [PATCH 3/3] Version 1.3.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ee6eaa9..c7aedbd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@poap-xyz/poap-family", - "version": "1.3.4", + "version": "1.3.5", "author": { "name": "POAP", "url": "https://poap.xyz"