From 3c7e9c5f764e20595e876945ded65c279411f60b Mon Sep 17 00:00:00 2001 From: jinhojang6 Date: Mon, 16 Dec 2024 21:33:10 +0900 Subject: [PATCH] feat: grid limit to 200 and adjust toast --- .../Explore/OperatorGrid/OperatorGrid.tsx | 109 +++++++++++------- src/components/Toast/Toast.tsx | 40 ++++--- 2 files changed, 91 insertions(+), 58 deletions(-) diff --git a/src/components/Explore/OperatorGrid/OperatorGrid.tsx b/src/components/Explore/OperatorGrid/OperatorGrid.tsx index 6679693a87..10d3b9aeba 100644 --- a/src/components/Explore/OperatorGrid/OperatorGrid.tsx +++ b/src/components/Explore/OperatorGrid/OperatorGrid.tsx @@ -13,6 +13,7 @@ interface OperatorGridProps { } const OFFSET = 18 +const LIMIT = 200 const OperatorGrid: React.FC = ({ data, isLoading }) => { const [itemsCount, setItemsCount] = useState(18) @@ -24,7 +25,12 @@ const OperatorGrid: React.FC = ({ data, isLoading }) => { const handleObserver = useCallback( (entries: IntersectionObserverEntry[]) => { const target = entries[0] - if (target.isIntersecting && itemsCount < data.length) { + // Less than 200 operators + if ( + target.isIntersecting && + itemsCount < data.length && + itemsCount < LIMIT + ) { setItemsCount((prevCount) => prevCount + OFFSET) } }, @@ -37,7 +43,7 @@ const OperatorGrid: React.FC = ({ data, isLoading }) => { observerRef.current = new IntersectionObserver(handleObserver, { root: null, rootMargin: '20px', - threshold: 1.0, + threshold: 0.8, }) if (lastElementRef.current) @@ -57,47 +63,53 @@ const OperatorGrid: React.FC = ({ data, isLoading }) => { ))} ) : ( - - {data.slice(0, itemsCount).map((operator, index) => { - if (index === itemsCount - 1) { - return ( - - - {`Operator - - - ) - } else { - return ( - - - {`Operator - - - ) - } - })} - + <> + + {data.slice(0, itemsCount).map((operator, index) => { + if (index === itemsCount - 1) { + return ( + + + {`Operator + + + ) + } else { + return ( + + + {`Operator + + + ) + } + })} + + {itemsCount >= LIMIT && ( + Please refresh the page to see other Operators. + )} + ) } @@ -138,4 +150,15 @@ const Placeholder = styled.div` opacity: 0.5; ` +const GridLimit = styled.p` + display: flex; + align-items: center; + justify-content: center; + width: 100%; + text-align: center; + color: white; + padding-top: 32px; + padding-bottom: 64px; +` + export default OperatorGrid diff --git a/src/components/Toast/Toast.tsx b/src/components/Toast/Toast.tsx index 2158939060..41698dafce 100644 --- a/src/components/Toast/Toast.tsx +++ b/src/components/Toast/Toast.tsx @@ -1,6 +1,7 @@ import { breakpoints } from '@/configs/ui.configs' import styled from '@emotion/styled' import { useAtomValue } from 'jotai' +import Link from 'next/link' import { useEffect, useState } from 'react' import { userInfoAtom } from '../../../atoms/userInfo' @@ -45,6 +46,12 @@ const Toast: React.FC = () => { return () => clearInterval(interval) }, []) + const handleClose = (e: React.MouseEvent) => { + e.preventDefault() + e.stopPropagation() + setShowTopToast(false) + } + return userInfo?.alert_message?.length > 0 ? ( {/*
Logos Operators Ordinals Mint Is Live
@@ -53,23 +60,25 @@ const Toast: React.FC = () => { */} {userInfo.alert_message}
-
) : ( - - - Logos Ordinals Mint Begins 16th December, 2024 at 1PM UTC - Time remaining : {time} - -
- -
-
+ + + Logos Operators mint is LIVE +
+ +
+
+
) } @@ -93,7 +102,7 @@ const ToastContainer = styled.div<{ showTopToast: boolean }>` a { color: #fe740c; - margin-left: 20px; + margin-left: 8px; } .close-button { @@ -129,8 +138,9 @@ const ToastContainer = styled.div<{ showTopToast: boolean }>` } ` -const TimeRemaining = styled.div` - margin-left: 20px; +const CustomLink = styled(Link)` + text-decoration: none; + color: inherit; ` export default Toast