@@ -10,6 +10,7 @@ import { ErrorBoundary } from 'react-error-boundary'
1010import { ErrorFallbackMessage } from './ErrorFallbackMessage'
1111import { LoadingMessage } from './LoadingMessage'
1212import { usePaginatedCollection } from './usePaginatedCollection'
13+ import { RelayPaginationControls } from './RelayPaginationControls'
1314
1415export default function DmarcByDomainPage ( ) {
1516 const { currentUser } = useUserState ( )
@@ -23,6 +24,7 @@ export default function DmarcByDomainPage() {
2324 `LAST30DAYS, ${ currentDate . getFullYear ( ) } ` ,
2425 )
2526 const [ selectedTableDisplayLimit , setSelectedTableDisplayLimit ] = useState ( 10 )
27+ const displayLimitOptions = [ 5 , 10 , 20 , 50 , 100 ]
2628
2729 const {
2830 loading,
@@ -31,6 +33,7 @@ export default function DmarcByDomainPage() {
3133 nodes,
3234 next,
3335 previous,
36+ resetToFirstPage,
3437 hasNextPage,
3538 hasPreviousPage,
3639 } = usePaginatedCollection ( {
@@ -41,7 +44,7 @@ export default function DmarcByDomainPage() {
4144 month : selectedPeriod ,
4245 year : selectedYear ,
4346 } ,
44- relayRoot : 'findMyDomains ' ,
47+ relayRoot : 'findMyDmarcSummaries ' ,
4548 } )
4649
4750 if ( error ) return < ErrorFallbackMessage error = { error } />
@@ -61,8 +64,8 @@ export default function DmarcByDomainPage() {
6164 else if ( nodes . length > 0 ) {
6265 const formattedData = [ ]
6366 nodes . forEach ( ( node ) => {
64- const domain = node . domain
65- const percentages = { ...node . dmarcSummaryByPeriod . categoryPercentages }
67+ const domain = node . domain . domain
68+ const percentages = { ...node . categoryPercentages }
6669 Object . entries ( percentages ) . forEach ( ( [ key , value ] ) => {
6770 if ( typeof value === 'number' ) percentages [ key ] = Math . round ( value )
6871 } )
@@ -131,16 +134,6 @@ export default function DmarcByDomainPage() {
131134 } ,
132135 ]
133136
134- const displayLimitOptions = [ 5 , 10 , 20 , 50 , 100 ]
135- const paginationConfig = {
136- previous : previous ,
137- hasPreviousPage : hasPreviousPage ,
138- next : next ,
139- hasNextPage : hasNextPage ,
140- displayLimitOptions : displayLimitOptions ,
141- isLoadingMore : isLoadingMore ,
142- }
143-
144137 tableDisplay = (
145138 < DmarcReportTable
146139 data = { formattedData }
@@ -153,9 +146,7 @@ export default function DmarcByDomainPage() {
153146 prependLink = "domains/"
154147 appendLink = { `/dmarc-report/${ selectedPeriod } /${ selectedYear } ` }
155148 frontendPagination = { false }
156- paginationConfig = { paginationConfig }
157149 selectedDisplayLimit = { selectedTableDisplayLimit }
158- setSelectedDisplayLimit = { setSelectedTableDisplayLimit }
159150 />
160151 )
161152 }
@@ -241,6 +232,18 @@ export default function DmarcByDomainPage() {
241232 < ErrorBoundary FallbackComponent = { ErrorFallbackMessage } >
242233 { tableDisplay }
243234 </ ErrorBoundary >
235+ < RelayPaginationControls
236+ onlyPagination = { false }
237+ selectedDisplayLimit = { selectedTableDisplayLimit }
238+ setSelectedDisplayLimit = { setSelectedTableDisplayLimit }
239+ displayLimitOptions = { displayLimitOptions }
240+ resetToFirstPage = { resetToFirstPage }
241+ hasNextPage = { hasNextPage }
242+ hasPreviousPage = { hasPreviousPage }
243+ next = { next }
244+ previous = { previous }
245+ isLoadingMore = { isLoadingMore }
246+ />
244247 </ Box >
245248 )
246249}
0 commit comments