diff --git a/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx b/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx index cced339b1..b8a872685 100644 --- a/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx +++ b/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx @@ -1,6 +1,6 @@ import { observer, useObserver } from 'mobx-react-lite'; import React, { useEffect, useMemo, useState } from 'react'; -import { NoContent, Pagination, Icon } from 'UI'; +import { NoContent, Pagination, Icon, Loader } from 'UI'; import { useStore } from 'App/mstore'; import { sliceListPerPage } from 'App/utils'; import GridView from './GridView'; @@ -22,6 +22,7 @@ function MetricsList({ const dashboard = dashboardStore.selectedDashboard; const existingCardIds = useMemo(() => dashboard?.widgets?.map(i => parseInt(i.metricId)), [dashboard]); const cards = useMemo(() => !!onSelectionChange ? metricStore.filteredCards.filter(i => !existingCardIds?.includes(parseInt(i.metricId))) : metricStore.filteredCards, [metricStore.filteredCards]); + const loading = metricStore.isLoading; useEffect(() => { metricStore.fetchList(); @@ -49,55 +50,57 @@ function MetricsList({ }, []); return ( - - -
- {metricsSearch !== '' ? 'No matching results' : "You haven't created any cards yet"} + + + +
+ {metricsSearch !== '' ? 'No matching results' : "You haven't created any cards yet"} +
- - } - subtext="Utilize cards to visualize key user interactions or product performance metrics." - > - {listView ? ( - - setSelectedMetrics(checked ? cards.map((i: any) => i.metricId).slice(0, 30 - existingCardIds!.length) : []) - } - /> - ) : ( - - )} + } + subtext="Utilize cards to visualize key user interactions or product performance metrics." + > + {listView ? ( + + setSelectedMetrics(checked ? cards.map((i: any) => i.metricId).slice(0, 30 - existingCardIds!.length) : []) + } + /> + ) : ( + + )} -
-
- Showing{' '} - {Math.min(cards.length, metricStore.pageSize)} out - of {cards.length} cards +
+
+ Showing{' '} + {Math.min(cards.length, metricStore.pageSize)} out + of {cards.length} cards +
+ metricStore.updateKey('page', page)} + limit={metricStore.pageSize} + debounceRequest={100} + />
- metricStore.updateKey('page', page)} - limit={metricStore.pageSize} - debounceRequest={100} - /> -
- + + ); }