Skip to content

Commit

Permalink
Merge pull request #57 from poap-xyz/release/v1.3.5
Browse files Browse the repository at this point in the history
Release v1.3.5
jm42 authored May 25, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents b6bdd3a + abba810 commit b7e2063
Showing 8 changed files with 65 additions and 44 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/poap-family",
"version": "1.3.4",
"version": "1.3.5",
"author": {
"name": "POAP",
"url": "https://poap.xyz"
4 changes: 2 additions & 2 deletions src/components/InCommon.js
Original file line number Diff line number Diff line change
@@ -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) {
30 changes: 17 additions & 13 deletions src/components/LastEvents.js
Original file line number Diff line number Diff line change
@@ -84,26 +84,30 @@ function LastEvents({ currentPage = 1, onPageChange = (page) => {}, qty = 3, sho
/>
)}
{loading && <Loading />}
{cachedEvents.length > 0 && !loading && <CachedEventList
cachedEvents={cachedEvents}
showClear={false}
/>}
{cachedEvents.length > 0 && !loading && (
<CachedEventList
cachedEvents={cachedEvents}
showClear={false}
/>
)}
{error &&
<ErrorMessage style={{ marginTop: '1rem' }}>
<span title={error.reason ? `${error.reason}` : undefined}>
{error.message ?? 'Unknown error'}
</span>
</ErrorMessage>
}
{pages > 1 && !loading && <Pagination
page={page}
pages={pages}
total={total}
onPage={(newPage) => {
setPage(newPage)
onPageChange(newPage)
}}
/>}
{pages > 1 && !loading && (
<Pagination
page={page}
pages={pages}
total={total}
onPage={(newPage) => {
setPage(newPage)
onPageChange(newPage)
}}
/>
)}
</Card>
</div>
)
8 changes: 6 additions & 2 deletions src/models/in-common.js
Original file line number Diff line number Diff line change
@@ -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,
}
8 changes: 5 additions & 3 deletions src/pages/Event.js
Original file line number Diff line number Diff line change
@@ -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)
)
)
@@ -319,7 +319,9 @@ function Event() {
eta={loadedProgress.estimated}
rate={loadedProgress.rate}
/>
: <Loading />)}
: <Loading />
)
}
<AddressErrorList errors={errors} onRetry={retryAddress} />
</Card>
:
40 changes: 24 additions & 16 deletions src/pages/Events.js
Original file line number Diff line number Diff line change
@@ -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)
)
)
@@ -639,7 +639,9 @@ function Events() {
</div>
</td>
<td className="event-cell-owners">
{(status === STATUS_INITIAL || (event.id in loading && loading[event.id] === LOADING_OWNERS)) && !(event.id in owners) && <Loading small={true} />}
{(status === STATUS_INITIAL || (event.id in loading && loading[event.id] === LOADING_OWNERS)) && !(event.id in owners) && (
<Loading small={true} />
)}
{event.id in owners && (
<ShadowText grow={true} small={true}>
{formatStat(owners[event.id].length)}
@@ -669,19 +671,25 @@ function Events() {
</div>
</td>
<td>
{event.id in loadedProgress && <Progress
value={loadedProgress[event.id].progress}
max={1}
showPercent={true}
eta={loadedProgress[event.id].estimated}
rate={loadedProgress[event.id].rate}
/>}
{event.id in progress && <Progress
value={loadedCount[event.id]}
max={owners[event.id].length}
showValue={loadedCount[event.id] > 0}
/>}
{event.id in loading && loading[event.id] === LOADING_CACHING && <Progress />}
{event.id in loadedProgress && (
<Progress
value={loadedProgress[event.id].progress}
max={1}
showPercent={true}
eta={loadedProgress[event.id].estimated}
rate={loadedProgress[event.id].rate}
/>
)}
{event.id in progress && (
<Progress
value={loadedCount[event.id]}
max={owners[event.id].length}
showValue={loadedCount[event.id] > 0}
/>
)}
{event.id in loading && loading[event.id] === LOADING_CACHING && (
<Progress />
)}
{event.id in eventOwnerErrors && Object.entries(eventOwnerErrors[event.id]).map(
([address, error]) => (
<p key={address} className="status-error-message">
14 changes: 8 additions & 6 deletions src/pages/FeedbackList.js
Original file line number Diff line number Diff line change
@@ -129,12 +129,14 @@ function FeedbackList({ qty = 10 }) {
</ul>
)}
{error && <ErrorMessage style={{ marginTop: '1rem' }}>{error.message ?? 'Unknown error'}</ErrorMessage>}
{pages > 1 && <Pagination
page={page}
pages={pages}
total={total}
onPage={onPageChange}
/>}
{pages > 1 && (
<Pagination
page={page}
pages={pages}
total={total}
onPage={onPageChange}
/>
)}
</Card>
</div>
</Page>
3 changes: 2 additions & 1 deletion src/pages/Home.js
Original file line number Diff line number Diff line change
@@ -48,7 +48,8 @@ function Home() {
v{packageJson.version.split('.').slice(0, -1).join('.')}
</a>
)
: `v${packageJson.version.split('.').slice(0, -1).join('.')}`}
: `v${packageJson.version.split('.').slice(0, -1).join('.')}`
}
</span>
</div>
</CenterPage>

0 comments on commit b7e2063

Please sign in to comment.