@@ -314,15 +314,14 @@ export const FeedList = ({
314314 }
315315 const closeAllDropdowns = ( ) => setOpenDropdownId ( null )
316316 const paginate = ( pageNumber ) => setCurrentPage ( String ( pageNumber ) )
317- // Disable pagination for deprecating feeds by using a very high page size
318- const addrPerPage = ecosystem === "deprecating" ? 10000 : 8
317+ const addrPerPage = ecosystem === "deprecating" && isStreams ? 10 : ecosystem === "deprecating" ? 10000 : 8
319318 const lastAddr = Number ( currentPage ) * addrPerPage
320319 const firstAddr = lastAddr - addrPerPage
321320
322321 // Pagination for testnet table
323322 const [ testnetCurrentPage , setTestnetCurrentPage ] = useQueryString ( "testnetPage" , "1" )
324323 const testnetPaginate = ( pageNumber ) => setTestnetCurrentPage ( String ( pageNumber ) )
325- const testnetAddrPerPage = ecosystem === "deprecating" ? 10000 : 8
324+ const testnetAddrPerPage = ecosystem === "deprecating" && isStreams ? 10 : ecosystem === "deprecating" ? 10000 : 8
326325 const testnetLastAddr = Number ( testnetCurrentPage ) * testnetAddrPerPage
327326 const testnetFirstAddr = testnetLastAddr - testnetAddrPerPage
328327
@@ -744,49 +743,194 @@ export const FeedList = ({
744743 dataFeedType === "streamsExRate" ||
745744 dataFeedType === "streamsBacked"
746745 ) {
747- // For deprecating streams, show a consolidated table across all networks
746+ // For deprecating streams, show two separate tables: mainnet and testnet
748747 if ( isDeprecating ) {
749- const allDeprecatingStreams : any [ ] = [ ]
750-
751- // Check both chainMetadata and initialCache for deprecating streams
752- const networksToCheck =
753- chainMetadata . processedData ?. networks ||
754- ( initialCache && initialCache . deprecated ? ( initialCache . deprecated as any ) . networks : [ ] )
755-
756- networksToCheck . forEach ( ( network : any ) => {
757- network . metadata ?. forEach ( ( item : any ) => {
758- // Only include items that are actual streams (have verifier contract type and feedId)
759- // and have a shutdown date
760- if ( item . contractType === "verifier" && item . feedId && item . docs ?. shutdownDate ) {
761- allDeprecatingStreams . push ( {
762- ...item ,
763- networkName : network . name ,
748+ const mainnetDeprecatingStreams : any [ ] = [ ]
749+ const testnetDeprecatingStreams : any [ ] = [ ]
750+
751+ if ( initialCache ) {
752+ Object . values ( initialCache ) . forEach ( ( chainData : any ) => {
753+ // Only check Arbitrum chains for streams
754+ if ( chainData . page === "arbitrum" ) {
755+ chainData . networks ?. forEach ( ( network : any ) => {
756+ network . metadata ?. forEach ( ( item : any ) => {
757+ // Only include items that are actual streams (have verifier contract type and feedId)
758+ // and have a shutdown date
759+ if ( item . contractType === "verifier" && item . feedId && item . docs ?. shutdownDate ) {
760+ const streamWithNetwork = {
761+ ...item ,
762+ networkName : network . name ,
763+ }
764+ if ( network . networkType === "mainnet" ) {
765+ mainnetDeprecatingStreams . push ( streamWithNetwork )
766+ } else if ( network . networkType === "testnet" ) {
767+ testnetDeprecatingStreams . push ( streamWithNetwork )
768+ }
769+ }
770+ } )
764771 } )
765772 }
766773 } )
774+ }
775+
776+ // Sort alphabetically by asset name or product name
777+ const sortStreams = ( streams : any [ ] ) => {
778+ return streams . sort ( ( a , b ) => {
779+ const nameA = ( a . assetName || a . docs ?. clicProductName || "" ) . toUpperCase ( )
780+ const nameB = ( b . assetName || b . docs ?. clicProductName || "" ) . toUpperCase ( )
781+ return nameA . localeCompare ( nameB )
782+ } )
783+ }
784+
785+ sortStreams ( mainnetDeprecatingStreams )
786+ sortStreams ( testnetDeprecatingStreams )
787+
788+ // Apply search filter for mainnet
789+ const filteredMainnetStreams = mainnetDeprecatingStreams . filter ( ( stream ) => {
790+ if ( ! searchValue || typeof searchValue !== "string" ) return true
791+ const searchLower = searchValue . toLowerCase ( )
792+ return (
793+ stream . feedId ?. toLowerCase ( ) . includes ( searchLower ) ||
794+ stream . assetName ?. toLowerCase ( ) . includes ( searchLower ) ||
795+ stream . feedType ?. toLowerCase ( ) . includes ( searchLower ) ||
796+ stream . networkName ?. toLowerCase ( ) . includes ( searchLower ) ||
797+ stream . docs ?. clicProductName ?. toLowerCase ( ) . includes ( searchLower )
798+ )
799+ } )
800+
801+ // Apply search filter for testnet
802+ const filteredTestnetStreams = testnetDeprecatingStreams . filter ( ( stream ) => {
803+ if ( ! testnetSearchValue || typeof testnetSearchValue !== "string" ) return true
804+ const searchLower = testnetSearchValue . toLowerCase ( )
805+ return (
806+ stream . feedId ?. toLowerCase ( ) . includes ( searchLower ) ||
807+ stream . assetName ?. toLowerCase ( ) . includes ( searchLower ) ||
808+ stream . feedType ?. toLowerCase ( ) . includes ( searchLower ) ||
809+ stream . networkName ?. toLowerCase ( ) . includes ( searchLower ) ||
810+ stream . docs ?. clicProductName ?. toLowerCase ( ) . includes ( searchLower )
811+ )
767812 } )
768813
814+ // Calculate mainnet pagination
815+ const paginatedMainnetStreams = filteredMainnetStreams . slice ( firstAddr , lastAddr )
816+
817+ // Calculate testnet pagination
818+ const paginatedTestnetStreams = filteredTestnetStreams . slice ( testnetFirstAddr , testnetLastAddr )
819+
769820 return (
770821 < >
771822 { chainMetadata . loading && ! chainMetadata . processedData && ! initialCache && < p > Loading...</ p > }
772823 { chainMetadata . error && < p > There was an error loading the streams...</ p > }
773824
774- { allDeprecatingStreams . length > 0 ? (
775- < SectionWrapper title = "Deprecating Streams" depth = { 2 } >
776- < div className = { feedList . tableWrapper } >
777- < table className = { clsx ( tableStyles . table ) } >
778- < StreamsTHead />
779- < tbody >
780- { allDeprecatingStreams . map ( ( stream , index ) => (
781- < StreamsTr key = { `${ stream . feedId } -${ index } ` } metadata = { stream } isMainnet = { true } />
782- ) ) }
783- </ tbody >
784- </ table >
785- </ div >
786- </ SectionWrapper >
787- ) : (
788- ! chainMetadata . loading && < p > No deprecating streams found at this time.</ p >
789- ) }
825+ < SectionWrapper title = "Mainnet Deprecating Streams" depth = { 2 } >
826+ < form class = { feedList . filterDropdown_search } >
827+ < input
828+ id = "search"
829+ class = { feedList . filterDropdown_searchInput }
830+ placeholder = "Search"
831+ value = { typeof searchValue === "string" ? searchValue : "" }
832+ onInput = { ( event ) => {
833+ setSearchValue ( ( event . target as HTMLInputElement ) . value )
834+ setCurrentPage ( "1" )
835+ } }
836+ />
837+ </ form >
838+ { filteredMainnetStreams . length > 0 ? (
839+ < >
840+ < div className = { feedList . tableWrapper } >
841+ < table className = { clsx ( tableStyles . table ) } >
842+ < StreamsTHead />
843+ < tbody >
844+ { paginatedMainnetStreams . map ( ( stream , index ) => (
845+ < StreamsTr key = { `${ stream . feedId } -${ index } ` } metadata = { stream } isMainnet = { true } />
846+ ) ) }
847+ </ tbody >
848+ </ table >
849+ </ div >
850+ { filteredMainnetStreams . length > addrPerPage && (
851+ < div className = { tableStyles . pagination } role = "navigation" aria-label = "Table pagination" >
852+ < button
853+ className = { button . secondary }
854+ disabled = { Number ( currentPage ) === 1 }
855+ onClick = { ( ) => paginate ( Number ( currentPage ) - 1 ) }
856+ >
857+ Prev
858+ </ button >
859+ < p aria-live = "polite" >
860+ { firstAddr + 1 } -
861+ { lastAddr > filteredMainnetStreams . length ? filteredMainnetStreams . length : lastAddr } of{ " " }
862+ { filteredMainnetStreams . length }
863+ </ p >
864+ < button
865+ className = { button . secondary }
866+ disabled = { lastAddr >= filteredMainnetStreams . length }
867+ onClick = { ( ) => paginate ( Number ( currentPage ) + 1 ) }
868+ >
869+ Next
870+ </ button >
871+ </ div >
872+ ) }
873+ </ >
874+ ) : (
875+ < p > No mainnet deprecating streams found.</ p >
876+ ) }
877+ </ SectionWrapper >
878+
879+ < SectionWrapper title = "Testnet Deprecating Streams" depth = { 2 } >
880+ < form class = { feedList . filterDropdown_search } >
881+ < input
882+ id = "testnetSearch"
883+ class = { feedList . filterDropdown_searchInput }
884+ placeholder = "Search"
885+ value = { typeof testnetSearchValue === "string" ? testnetSearchValue : "" }
886+ onInput = { ( event ) => {
887+ setTestnetSearchValue ( ( event . target as HTMLInputElement ) . value )
888+ setTestnetCurrentPage ( "1" )
889+ } }
890+ />
891+ </ form >
892+ { filteredTestnetStreams . length > 0 ? (
893+ < >
894+ < div className = { feedList . tableWrapper } >
895+ < table className = { clsx ( tableStyles . table ) } >
896+ < StreamsTHead />
897+ < tbody >
898+ { paginatedTestnetStreams . map ( ( stream , index ) => (
899+ < StreamsTr key = { `${ stream . feedId } -${ index } ` } metadata = { stream } isMainnet = { false } />
900+ ) ) }
901+ </ tbody >
902+ </ table >
903+ </ div >
904+ { filteredTestnetStreams . length > testnetAddrPerPage && (
905+ < div className = { tableStyles . pagination } role = "navigation" aria-label = "Table pagination" >
906+ < button
907+ className = { button . secondary }
908+ disabled = { Number ( testnetCurrentPage ) === 1 }
909+ onClick = { ( ) => testnetPaginate ( Number ( testnetCurrentPage ) - 1 ) }
910+ >
911+ Prev
912+ </ button >
913+ < p aria-live = "polite" >
914+ { testnetFirstAddr + 1 } -
915+ { testnetLastAddr > filteredTestnetStreams . length
916+ ? filteredTestnetStreams . length
917+ : testnetLastAddr } { " " }
918+ of { filteredTestnetStreams . length }
919+ </ p >
920+ < button
921+ className = { button . secondary }
922+ disabled = { testnetLastAddr >= filteredTestnetStreams . length }
923+ onClick = { ( ) => testnetPaginate ( Number ( testnetCurrentPage ) + 1 ) }
924+ >
925+ Next
926+ </ button >
927+ </ div >
928+ ) }
929+ </ >
930+ ) : (
931+ < p > No testnet deprecating streams found.</ p >
932+ ) }
933+ </ SectionWrapper >
790934 </ >
791935 )
792936 }
0 commit comments