From 1f8a17d9817b61a75de2835165dec548b6c3145d Mon Sep 17 00:00:00 2001 From: Juan M Date: Fri, 10 May 2024 22:24:49 -0300 Subject: [PATCH 01/14] Last CS --- src/pages/Last.js | 29 ++++++++++++++--------------- src/utils/number.js | 10 ++++++++++ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/pages/Last.js b/src/pages/Last.js index 9538129..102e9ac 100644 --- a/src/pages/Last.js +++ b/src/pages/Last.js @@ -1,6 +1,7 @@ import { useContext, useEffect } from 'react' import { useNavigate, useSearchParams } from 'react-router-dom' import { HTMLContext } from '../stores/html' +import { getSearchParamNumber } from '../utils/number' import ButtonLink from '../components/ButtonLink' import LastEvents from '../components/LastEvents' import Page from '../components/Page' @@ -13,8 +14,8 @@ function Last() { const { setTitle } = useContext(HTMLContext) const [searchParams, setSearchParams] = useSearchParams() - const currentPage = searchParams.has('page') ? parseInt(searchParams.get('page')) : DEFAULT_PAGE - const perPage = searchParams.has('qty') ? parseInt(searchParams.get('qty')) : DEFAULT_PER_PAGE + const page = getSearchParamNumber(searchParams, 'page', DEFAULT_PAGE) + const perPage = getSearchParamNumber(searchParams, 'qty', DEFAULT_PER_PAGE) useEffect( () => { @@ -27,33 +28,31 @@ function Last() { () => { if (!searchParams.has('page')) { if (perPage !== DEFAULT_PER_PAGE) { - setSearchParams({ page: currentPage, qty: perPage }) + setSearchParams({ page, qty: perPage }) } else { - setSearchParams({ page: currentPage }) + setSearchParams({ page }) } } }, - [currentPage, perPage, searchParams, setSearchParams] + [page, perPage, searchParams, setSearchParams] ) - const changePage = (page, qty) => { - if (qty && qty !== DEFAULT_PER_PAGE) { - setSearchParams({ page, qty }) + const changePage = (newPage, newPerPage) => { + if (newPerPage && newPerPage !== DEFAULT_PER_PAGE) { + setSearchParams({ page: newPage, qty: newPerPage }) + } else if (perPage !== DEFAULT_PER_PAGE) { + setSearchParams({ page: newPage, qty: perPage }) } else { - if (perPage !== DEFAULT_PER_PAGE) { - setSearchParams({ page, qty: perPage }) - } else { - setSearchParams({ page }) - } + setSearchParams({ page: newPage }) } } return (
diff --git a/src/utils/number.js b/src/utils/number.js index 7d10790..d1cc92b 100644 --- a/src/utils/number.js +++ b/src/utils/number.js @@ -11,3 +11,13 @@ export function formatPercentage(n) { export function formatByte(n) { return numbro(n).format({ output: 'byte', base: 'binary', mantissa: 0 }) } + +export function getSearchParamNumber(searchParams, key, defaultValue) { + if (searchParams.has(key)) { + const n = parseInt(searchParams.get(key)) + if (!isNaN(n)) { + return n + } + } + return defaultValue +} From fdabc3359572f7f8c5608c3362508fce6cf6e27b Mon Sep 17 00:00:00 2001 From: Juan M Date: Fri, 10 May 2024 22:43:14 -0300 Subject: [PATCH 02/14] CS Last Events --- src/components/LastEvents.js | 88 ++++++++++++++++++------------------ src/pages/Last.js | 2 +- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/components/LastEvents.js b/src/components/LastEvents.js index 8c7464d..451d018 100644 --- a/src/components/LastEvents.js +++ b/src/components/LastEvents.js @@ -16,9 +16,9 @@ const DEFAULT_PER_PAGE = 8 const DEFAULT_MORE_QTY = 8 function LastEvents({ - currentPage = DEFAULT_PAGE, - perPage = DEFAULT_PER_PAGE, - onPageChange = (page, qty) => {}, + page: initialPage = DEFAULT_PAGE, + perPage: initialPerPage = DEFAULT_PER_PAGE, + onPageChange = (page, perPage) => {}, showRefresh = false, showMore = false, maxPages = 0, @@ -26,8 +26,8 @@ function LastEvents({ showPerPage = false, }) { const navigate = useNavigate() - const [page, setPage] = useState(currentPage) - const [qty, setQty] = useState(perPage) + const [page, setPage] = useState(initialPage) + const [perPage, setPerPage] = useState(initialPerPage) const [pages, setPages] = useState(0) const [total, setTotal] = useState(null) const [loading, setLoading] = useState(false) @@ -36,22 +36,22 @@ function LastEvents({ useEffect( () => { - setPage(currentPage) + setPage(initialPage) }, - [currentPage] + [initialPage] ) useEffect( () => { - setQty(perPage) + setPerPage(initialPerPage) }, - [perPage] + [initialPerPage] ) useEffect( () => { setLoading(true) - getLastEvents(page, qty).then( + getLastEvents(page, perPage).then( (response) => { if (response !== null) { setPages(response.pages) @@ -75,42 +75,42 @@ function LastEvents({ } ) }, - [page, qty] + [page, perPage] ) + const onRefresh = () => { + setLoading(true) + return getLastEvents(page, perPage).then( + (response) => { + if (response !== null) { + setPages(response.pages) + setTotal(response.total) + setCachedEvents(response.lastEvents) + setError(null) + + if (response.total === 0 || response.pages === 0) { + setError(new Error('Empty')) + } + } + setLoading(false) + }, + (err) => { + const error = new Error('Unavailable') + error.reason = err + console.error(err) + setError(error) + setCachedEvents([]) + setLoading(false) + } + ) + } + return (

Last Cached Drops

{showRefresh && cachedEvents.length > 0 && !loading && page === 1 && ( - { - setLoading(true) - return getLastEvents(page, qty).then( - (response) => { - if (response !== null) { - setPages(response.pages) - setTotal(response.total) - setCachedEvents(response.lastEvents) - setError(null) - - if (response.total === 0 || response.pages === 0) { - setError(new Error('Empty')) - } - } - setLoading(false) - }, - (err) => { - const error = new Error('Unavailable') - error.reason = err - console.error(err) - setError(error) - setCachedEvents([]) - setLoading(false) - } - ) - }} - /> + )} {loading && } {!loading && showPerPage && ( @@ -118,20 +118,20 @@ function LastEvents({ Per page:{' '} { - setQty(10) + setPerPage(10) onPageChange(1, 10) }} - disabled={qty === 10} + disabled={perPage === 10} > 10 { - setQty(10) + setPerPage(10) onPageChange(1, 100) }} - disabled={qty === 100} + disabled={perPage === 100} > 100 @@ -163,7 +163,7 @@ function LastEvents({ {maxPages > 0 && showMore && ( + ) } diff --git a/src/components/ShadowText.js b/src/components/ShadowText.js index 96633e2..cfa504a 100644 --- a/src/components/ShadowText.js +++ b/src/components/ShadowText.js @@ -3,7 +3,9 @@ import '../styles/shadow-text.css' function ShadowText({ children, grow = false, medium = false, small = false }) { return (
-
+
{children}
diff --git a/src/components/Stats.js b/src/components/Stats.js index 14cdcc6..a6fcb6a 100644 --- a/src/components/Stats.js +++ b/src/components/Stats.js @@ -47,7 +47,11 @@ function Stats({ stats, highlight }) { ) : ( <> {stat} - {statName} + + {statName} + ) } diff --git a/src/components/Status.js b/src/components/Status.js index 66b4951..6e98f0e 100644 --- a/src/components/Status.js +++ b/src/components/Status.js @@ -2,7 +2,9 @@ import '../styles/status.css' function Status({ loading, caching, error }) { return ( -
+
{loading && 'Loading'} {caching && 'Caching'} {error && 'Error'} From 20aab7e265c19d9748d6583fac2fd79573c7381f Mon Sep 17 00:00:00 2001 From: Juan M Date: Fri, 10 May 2024 23:33:43 -0300 Subject: [PATCH 11/14] Move get random int to utils --- src/components/TokenImage.js | 7 +------ src/models/collection.js | 8 ++------ src/utils/number.js | 6 ++++++ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/components/TokenImage.js b/src/components/TokenImage.js index ada3c58..dd62c21 100644 --- a/src/components/TokenImage.js +++ b/src/components/TokenImage.js @@ -1,11 +1,6 @@ +import { getRandomInt } from '../utils/number' import '../styles/poap.css' -function getRandomInt(min, max) { - min = Math.ceil(min); - max = Math.floor(max); - return Math.floor(Math.random() * (max - min) + min); // The maximum is exclusive and the minimum is inclusive -} - function TokenImage({ event, size, resize = true, imgix = false, original = false, ...props }) { let imageUrl = original ? event.original_url ?? event.image_url : event.image_url if (resize) { diff --git a/src/models/collection.js b/src/models/collection.js index 1a3c64f..3d7cc55 100644 --- a/src/models/collection.js +++ b/src/models/collection.js @@ -1,3 +1,5 @@ +import { getRandomInt } from '../utils/number' + function Collection(collection) { if ( typeof collection !== 'object' || @@ -44,12 +46,6 @@ function CollectionWithDrops(collectionWithDrops) { const COLLECTIONS_LIMIT = 7 -function getRandomInt(min, max) { - min = Math.ceil(min); - max = Math.floor(max); - return Math.floor(Math.random() * (max - min) + min); // The maximum is exclusive and the minimum is inclusive -} - function resizeCollectionImageUrl(imageUrl, size) { if (imageUrl.indexOf('collections-media-production') >= 0) { const url = new URL(imageUrl) diff --git a/src/utils/number.js b/src/utils/number.js index d1cc92b..4768e34 100644 --- a/src/utils/number.js +++ b/src/utils/number.js @@ -21,3 +21,9 @@ export function getSearchParamNumber(searchParams, key, defaultValue) { } return defaultValue } + +export function getRandomInt(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min) + min); // The maximum is exclusive and the minimum is inclusive +} From a169c50dc49ad28887bbdefa8a81fc8375523e79 Mon Sep 17 00:00:00 2001 From: Juan M Date: Fri, 10 May 2024 23:47:48 -0300 Subject: [PATCH 12/14] Search CS --- src/components/Search.js | 202 +++++++++++++++++++++++++++++++-------- 1 file changed, 163 insertions(+), 39 deletions(-) diff --git a/src/components/Search.js b/src/components/Search.js index 9f3cf3d..5b7eeaa 100644 --- a/src/components/Search.js +++ b/src/components/Search.js @@ -16,9 +16,21 @@ function Search() { const queryRef = useRef() const { trackSiteSearch } = useMatomo() const { settings } = useContext(SettingsContext) - const [loadingById, setLoadingById] = useState({ eventId: null, state: false, controller: null }) - const [loadingSearch, setLoadingSearch] = useState({ query: null, state: false, controller: null }) - const [loadingSearchCollections, setLoadingSearchCollections] = useState({ query: null, state: false, controller: null }) + const [loadingById, setLoadingById] = useState({ + eventId: null, + state: false, + controller: null, + }) + const [loadingSearch, setLoadingSearch] = useState({ + query: null, + state: false, + controller: null, + }) + const [loadingSearchCollections, setLoadingSearchCollections] = useState({ + query: null, + state: false, + controller: null, + }) const [timeoutId, setTimeoutId] = useState(null) const [errorById, setErrorById] = useState(null) const [errorSearch, setErrorSearch] = useState(null) @@ -62,7 +74,11 @@ function Search() { setEventById(null) fetchEvent(eventId, /*includeDescription*/false, controller.signal).then( (result) => { - setLoadingById({ eventId: null, state: false, controller: null }) + setLoadingById({ + eventId: null, + state: false, + controller: null, + }) if (result) { setEventById(result) } else { @@ -76,7 +92,11 @@ function Search() { setErrorById(err) } } - setLoadingById({ eventId: null, state: false, controller: null }) + setLoadingById({ + eventId: null, + state: false, + controller: null, + }) } ) } @@ -86,14 +106,15 @@ function Search() { setErrorSearch(null) setQueryEvents([]) setQueryTotal(null) - if (queryTotal == null || (page - 1) * SEARCH_LIMIT <= queryTotal) { + const offset = (page - 1) * SEARCH_LIMIT + if (queryTotal == null || offset <= queryTotal) { const controller = new AbortController() setLoadingSearch({ query: value, state: true, controller, }) - searchEvents(value, controller.signal, (page - 1) * SEARCH_LIMIT, SEARCH_LIMIT).then( + searchEvents(value, controller.signal, offset, SEARCH_LIMIT).then( (results) => { if (page === 1) { trackSiteSearch({ @@ -122,7 +143,11 @@ function Search() { setErrorSearch(err) } } - setLoadingSearch({ query: null, state: false, controller: null }) + setLoadingSearch({ + query: null, + state: false, + controller: null, + }) } ) } @@ -132,7 +157,7 @@ function Search() { if ( settings.showCollections && ( queryTotalCollections == null || - (page - 1) * SEARCH_LIMIT <= queryTotalCollections + offset <= queryTotalCollections ) ) { const controller = new AbortController() @@ -141,7 +166,7 @@ function Search() { state: true, controller, }) - searchCollections(value, (page - 1) * SEARCH_LIMIT, SEARCH_LIMIT, controller.signal).then( + searchCollections(value, offset, SEARCH_LIMIT, controller.signal).then( (results) => { if (page === 1) { trackSiteSearch({ @@ -150,7 +175,11 @@ function Search() { count: results.total == null ? undefined : results.total, }) } - setLoadingSearchCollections({ query: null, state: false, controller: null }) + setLoadingSearchCollections({ + query: null, + state: false, + controller: null, + }) if (queryRef.current && String(value) === queryRef.current.value) { setQueryCollections(results.items) if (results.total) { @@ -167,7 +196,11 @@ function Search() { setErrorSearchCollections(err) } } - setLoadingSearchCollections({ query: null, state: false, controller: null }) + setLoadingSearchCollections({ + query: null, + state: false, + controller: null, + }) } ) } @@ -270,9 +303,21 @@ function Search() { setQueryCollections([]) setQueryTotal(null) setQueryPage(1) - setLoadingById({ eventId: null, state: false, controller: null }) - setLoadingSearch({ query: null, state: false, controller: null }) - setLoadingSearchCollections({ query: null, state: false, controller: null }) + setLoadingById({ + eventId: null, + state: false, + controller: null, + }) + setLoadingSearch({ + query: null, + state: false, + controller: null, + }) + setLoadingSearchCollections({ + query: null, + state: false, + controller: null, + }) } } @@ -281,14 +326,20 @@ function Search() { const event = queryEvents.find((queried) => queried.id === eventId) if (event) { setSelectedEvents((prevSelectedEvents) => { - if (prevSelectedEvents.findIndex((prevSelectedEvent) => prevSelectedEvent.id === event.id) !== -1) { + const exists = -1 !== prevSelectedEvents.findIndex( + (prevSelectedEvent) => prevSelectedEvent.id === event.id + ) + if (exists) { return prevSelectedEvents } return [...prevSelectedEvents, event] }) } else if (eventById) { setSelectedEvents((prevSelectedEvents) => { - if (prevSelectedEvents.findIndex((prevSelectedEvent) => prevSelectedEvent.id === eventById.id) !== -1) { + const exists = -1 !== prevSelectedEvents.findIndex( + (prevSelectedEvent) => prevSelectedEvent.id === eventById.id + ) + if (exists) { return prevSelectedEvents } return [...prevSelectedEvents, eventById] @@ -296,7 +347,9 @@ function Search() { setEventById(null) } } else { - const selectedIndex = selectedEvents.findIndex((selected) => selected.id === eventId) + const selectedIndex = selectedEvents.findIndex( + (selected) => selected.id === eventId + ) if (selectedIndex !== -1) { setSelectedEvents((prevSelectedEvents) => { const newSelectedEvents = [...prevSelectedEvents] @@ -313,17 +366,24 @@ function Search() { function onSelectCollectionChange(collectionId, checked) { if (checked) { - const collection = queryCollections.find((queried) => queried.id === collectionId) + const collection = queryCollections.find( + (queried) => queried.id === collectionId + ) if (collection) { setSelectedCollections((prevSelectedCollections) => { - if (prevSelectedCollections.findIndex((prevSelectedCollection) => prevSelectedCollection.id === collection.id) !== -1) { + const exists = -1 !== prevSelectedCollections.findIndex( + (prevSelectedCollection) => prevSelectedCollection.id === collection.id + ) + if (exists) { return prevSelectedCollections } return [...prevSelectedCollections, collection] }) } } else { - const selectedIndex = selectedCollections.findIndex((selected) => selected.id === collectionId) + const selectedIndex = selectedCollections.findIndex( + (selected) => selected.id === collectionId + ) if (selectedIndex !== -1) { setSelectedCollections((prevSelectedCollections) => { const newSelectedCollections = [...prevSelectedCollections] @@ -340,13 +400,20 @@ function Search() { const selectedNotInEvents = selectedEvents .filter( - (selected) => queryEvents.findIndex((queried) => queried.id === selected.id) === -1 + (selected) => -1 === queryEvents.findIndex( + (queried) => queried.id === selected.id + ) ) const selectedNotInCollections = selectedCollections .filter( - (selected) => queryCollections.findIndex((queried) => queried.id === selected.id) === -1 + (selected) => -1 === queryCollections.findIndex( + (queried) => queried.id === selected.id + ) ) - const selectedCollectionsTotalDrops = selectedCollections.reduce((total, collection) => total + collection.dropIds.length, 0) + const selectedCollectionsTotalDrops = selectedCollections.reduce( + (total, collection) => total + collection.dropIds.length, + 0 + ) const renderEvent = (event) => (
@@ -362,8 +429,12 @@ function Search() {
selected.id === event.id) !== -1} - onChange={(changeEvent) => onSelectEventChange(event.id, !!changeEvent.target.checked)} + checked={-1 !== selectedEvents.findIndex( + (selected) => selected.id === event.id + )} + onChange={(changeEvent) => { + onSelectEventChange(event.id, !!changeEvent.target.checked) + }} />
@@ -375,7 +446,10 @@ function Search() { {collection.banner_image_url && (
@@ -388,7 +462,10 @@ function Search() { className="collection-link" > @@ -403,17 +480,29 @@ function Search() {
selected.id === collection.id) !== -1} - onChange={(changeEvent) => onSelectCollectionChange(collection.id, !!changeEvent.target.checked)} + checked={-1 !== selectedCollections.findIndex( + (selected) => selected.id === collection.id + )} + onChange={(changeEvent) => { + onSelectCollectionChange(collection.id, !!changeEvent.target.checked) + }} />
) + const pages = Math.ceil(Math.max(queryTotal, queryTotalCollections) / SEARCH_LIMIT) + return ( -
{ event.preventDefault(); onSearch() }}> + { + event.preventDefault() + onSearch() + }} + >
- {!errorById && !errorSearch && !errorSearchCollections && !errorSubmit && selectedEvents.length === 0 && selectedCollections.length === 0 && queryEvents.length === 0 && queryCollections.length === 0 && !loadingById.state && !loadingSearch.state && !loadingSearchCollections.state && !eventById && ( + {( + !errorById && + !errorSearch && + !errorSearchCollections && + !errorSubmit && + selectedEvents.length === 0 && + selectedCollections.length === 0 && + queryEvents.length === 0 && + queryCollections.length === 0 && + !loadingById.state && + !loadingSearch.state && + !loadingSearchCollections.state && + !eventById + ) && (
manually enter collections
@@ -460,7 +564,12 @@ function Search() {

{errorSubmit.message}

)} - {(selectedEvents.length > 0 || selectedCollections.length > 0 || queryEvents.length > 0 || queryCollections.length > 0) && ( + {( + selectedEvents.length > 0 || + selectedCollections.length > 0 || + queryEvents.length > 0 || + queryCollections.length > 0 + ) && (
{selectedCollections.length > 0 && ( <> @@ -478,7 +587,16 @@ function Search() { {selectedNotInEvents.length > 0 && ( <>{selectedNotInEvents.map((event) => renderEvent(event))} )} - {(selectedNotInCollections.length > 0 || selectedNotInEvents.length > 0) && (queryEvents.length > 0 || queryCollections.length > 0 || loadingById.state || loadingSearch.state || loadingSearchCollections.state) && ( + {( + selectedNotInCollections.length > 0 || + selectedNotInEvents.length > 0 + ) && ( + queryEvents.length > 0 || + queryCollections.length > 0 || + loadingById.state || + loadingSearch.state || + loadingSearchCollections.state + ) && (
)} {(loadingById.state || loadingSearch.state || loadingSearchCollections.state) && ( @@ -490,13 +608,19 @@ function Search() {
)} {eventById && renderEvent(eventById)} - {queryCollections.length > 0 && queryCollections.map((collection) => renderCollection(collection))} - {queryEvents.length > 0 && queryEvents.map((event) => (!eventById || eventById.id !== event.id) && renderEvent(event))} - {queryEvents.length > 0 && Math.ceil(Math.max(queryTotal, queryTotalCollections) / SEARCH_LIMIT) > 1 && ( + {queryCollections.length > 0 && ( + queryCollections.map((collection) => renderCollection(collection)) + )} + {queryEvents.length > 0 && ( + queryEvents.map((event) => (!eventById || eventById.id !== event.id) && ( + renderEvent(event) + )) + )} + {queryEvents.length > 0 && pages > 1 && (
{ const value = queryRef.current ? queryRef.current.value : '' From 7a4a4ca58191b7e6b8d0e0e2c9696a2006faabc4 Mon Sep 17 00:00:00 2001 From: Juan M Date: Fri, 10 May 2024 23:55:58 -0300 Subject: [PATCH 13/14] CS --- src/components/AddressesList.js | 7 +++++- src/components/ButtonExpand.js | 12 +++++++---- src/components/CachedEventList.js | 4 +++- src/components/CollectionList.js | 10 +++++++-- src/components/EventButtons.js | 7 +++++- src/components/EventsPageError.js | 4 +++- src/components/InCommon.js | 36 ++++++++++++++++++++++++++----- src/components/LinkButton.js | 9 +++++++- src/components/Page.js | 2 +- src/components/Progress.js | 9 +++++++- 10 files changed, 82 insertions(+), 18 deletions(-) diff --git a/src/components/AddressesList.js b/src/components/AddressesList.js index 80e0767..dd27935 100644 --- a/src/components/AddressesList.js +++ b/src/components/AddressesList.js @@ -12,7 +12,12 @@ function AddressesList({
    {addresses.map((address) => (
  1. - + {address in ensNames ? {ensNames[address]} : {address} diff --git a/src/components/ButtonExpand.js b/src/components/ButtonExpand.js index 1c0a048..38ce5c4 100644 --- a/src/components/ButtonExpand.js +++ b/src/components/ButtonExpand.js @@ -6,9 +6,11 @@ import Button from './Button' function ButtonExpand({ addresses, eventIds, link = false, ...props }) { const navigate = useNavigate() - const queryString = eventIds && Array.isArray(eventIds) && eventIds.length > 0 - ? `?events=${eventIds.join(',')}` - : '' + const queryString = ( + eventIds && Array.isArray(eventIds) && eventIds.length > 0 + ? `?events=${eventIds.join(',')}` + : '' + ) return (
    @@ -28,7 +30,9 @@ function ButtonExpand({ addresses, eventIds, link = false, ...props }) { {...props} secondary={true} icon={} - onClick={() => navigate(`/addresses${queryString}#${addresses.join(',')}`)} + onClick={() => { + navigate(`/addresses${queryString}#${addresses.join(',')}`) + }} > Expand diff --git a/src/components/CachedEventList.js b/src/components/CachedEventList.js index 29eda50..68e02c1 100644 --- a/src/components/CachedEventList.js +++ b/src/components/CachedEventList.js @@ -26,7 +26,9 @@ function CachedEventList({

    {cachedEvent.name}

    - {showClear && onClear(cachedEvent.id)}>clear} + {showClear && ( + onClear(cachedEvent.id)}>clear + )}
    {showCachedTs && diff --git a/src/components/CollectionList.js b/src/components/CollectionList.js index 226fe1d..88132bd 100644 --- a/src/components/CollectionList.js +++ b/src/components/CollectionList.js @@ -44,7 +44,10 @@ function CollectionList({
    {collection.banner_image_url && ( event.target.style.display = 'none'} alt="" /> @@ -54,7 +57,10 @@ function CollectionList({ {showLogo && collection.logo_image_url && (
    diff --git a/src/components/EventButtons.js b/src/components/EventButtons.js index 020ad40..7a6d308 100644 --- a/src/components/EventButtons.js +++ b/src/components/EventButtons.js @@ -1,7 +1,12 @@ import LinkButton from './LinkButton' import '../styles/event-buttons.css' -function EventButtons({ event, buttons, viewInGallery = true, invert = false }) { +function EventButtons({ + event, + buttons, + viewInGallery = true, + invert = false, +}) { return (
    {viewInGallery && ( diff --git a/src/components/EventsPageError.js b/src/components/EventsPageError.js index 6106bd8..87d9b28 100644 --- a/src/components/EventsPageError.js +++ b/src/components/EventsPageError.js @@ -7,7 +7,9 @@ function EventsPageError() { const { eventIds: rawEventIds } = useParams() const delEvent = (eventId) => { - const eventIds = parseEventIds(rawEventIds).filter((paramEventId) => String(paramEventId) !== String(eventId)) + const eventIds = parseEventIds(rawEventIds).filter( + (paramEventId) => String(paramEventId) !== String(eventId) + ) if (eventIds.length === 1) { navigate(`/event/${eventIds[0]}`) } else if (eventIds.length > 0) { diff --git a/src/components/InCommon.js b/src/components/InCommon.js index efdd5bf..a1d6c31 100644 --- a/src/components/InCommon.js +++ b/src/components/InCommon.js @@ -16,6 +16,13 @@ import TokenImage from './TokenImage' import ButtonClose from './ButtonClose' import '../styles/in-common.css' +function getColorForAddress(address) { + return new toColor(address, { + brightness: 3.25, + saturation: .25, + }).getColor().hsl.formatted +} + function InCommon({ children, inCommon = {}, @@ -89,7 +96,10 @@ function InCommon({ ) ) .map( - (address) => [address, new toColor(address, { brightness: 3.25, saturation: .25 }).getColor().hsl.formatted] + (address) => [ + address, + getColorForAddress(address), + ] ) ) @@ -120,7 +130,10 @@ function InCommon({ owner in liRefs[eventId] && liRefs[eventId][owner].current ) { - liRefs[eventId][owner].current.scrollIntoView({ behavior: 'smooth', block: 'center' }) + liRefs[eventId][owner].current.scrollIntoView({ + behavior: 'smooth', + block: 'center', + }) } } if ( @@ -128,14 +141,27 @@ function InCommon({ owner in liRefs[activeEventId] && liRefs[activeEventId][owner].current ) { - liRefs[activeEventId][owner].current.scrollIntoView({ behavior: 'smooth', block: 'center' }) + liRefs[activeEventId][owner].current.scrollIntoView({ + behavior: 'smooth', + block: 'center', + }) } } - setOwnerHighlighted((current) => current !== owner && owner in activeAdressesColors ? owner : current) + setOwnerHighlighted((current) => ( + current !== owner && + owner in activeAdressesColors + ? owner + : current + )) } const onOwnerLeave = (activeEventId, owner) => { - setOwnerHighlighted((current) => current === owner && owner in activeAdressesColors ? null : current) + setOwnerHighlighted((current) => ( + current === owner && + owner in activeAdressesColors + ? null + : current + )) } return ( diff --git a/src/components/LinkButton.js b/src/components/LinkButton.js index 69b1cd9..b3c5b10 100644 --- a/src/components/LinkButton.js +++ b/src/components/LinkButton.js @@ -1,7 +1,14 @@ import { OpenNewWindow } from 'iconoir-react' import '../styles/link-button.css' -function LinkButton({ title, icon, href, children, external = false, secondary = false }) { +function LinkButton({ + title, + icon, + href, + children, + external = false, + secondary = false, +}) { if (external && !icon) { icon = } diff --git a/src/components/Page.js b/src/components/Page.js index 7ecf31e..a225eed 100644 --- a/src/components/Page.js +++ b/src/components/Page.js @@ -1,10 +1,10 @@ import { useContext } from 'react' +import { QuestionMark } from 'iconoir-react' import { SettingsContext } from '../stores/cache' import CornerBackground from '../images/Corner_Background.svg' import Feedback from './Feedback' import LogoMenu from './LogoMenu' import MenuItem from './MenuItem' -import { QuestionMark } from 'iconoir-react' import '../styles/page.css' function Page({ children, showCorner = true }) { diff --git a/src/components/Progress.js b/src/components/Progress.js index 3314808..c0a064d 100644 --- a/src/components/Progress.js +++ b/src/components/Progress.js @@ -3,7 +3,14 @@ import { secondsInTheFuture } from '../utils/date' import { formatByte, formatPercentage } from '../utils/number' import '../styles/progress.css' -function Progress({ value, max, showValue = false, showPercent = false, eta, rate }) { +function Progress({ + value, + max, + showValue = false, + showPercent = false, + eta, + rate, +}) { const [showDetails, setShowDetails] = useState(true) const hasDetails = typeof eta === 'number' || typeof rate === 'number' From 5f07c3253d547a92a64327ffc79c9b2ddaf60f5d Mon Sep 17 00:00:00 2001 From: Juan M Date: Fri, 10 May 2024 23:57:23 -0300 Subject: [PATCH 14/14] Version 1.12.15 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ede8ade..7cf1eae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@poap-xyz/poap-family", - "version": "1.12.14", + "version": "1.12.15", "author": { "name": "POAP", "url": "https://poap.xyz"