mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
Change dashboard websites to use ordered list
This commit is contained in:
parent
3926d3fe93
commit
5bd83b8127
@ -5,8 +5,21 @@ import Page from 'components/layout/Page';
|
|||||||
import EmptyPlaceholder from 'components/common/EmptyPlaceholder';
|
import EmptyPlaceholder from 'components/common/EmptyPlaceholder';
|
||||||
import Arrow from 'assets/arrow-right.svg';
|
import Arrow from 'assets/arrow-right.svg';
|
||||||
import styles from './WebsiteList.module.css';
|
import styles from './WebsiteList.module.css';
|
||||||
|
import { orderByWebsiteMap } from 'lib/format';
|
||||||
|
import { useMemo } from 'react';
|
||||||
|
import useStore from 'store/app';
|
||||||
|
|
||||||
|
const selector = state => state.dashboard;
|
||||||
|
|
||||||
export default function WebsiteList({ websites, showCharts, limit }) {
|
export default function WebsiteList({ websites, showCharts, limit }) {
|
||||||
|
const store = useStore(selector);
|
||||||
|
const { websiteOrdering } = store;
|
||||||
|
|
||||||
|
const ordered = useMemo(
|
||||||
|
() => orderByWebsiteMap(websites, websiteOrdering),
|
||||||
|
[websites, websiteOrdering],
|
||||||
|
);
|
||||||
|
|
||||||
if (websites.length === 0) {
|
if (websites.length === 0) {
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
@ -28,7 +41,7 @@ export default function WebsiteList({ websites, showCharts, limit }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{websites.map(({ website_id, name, domain }, index) =>
|
{ordered.map(({ website_id, name, domain }, index) =>
|
||||||
index < limit ? (
|
index < limit ? (
|
||||||
<div key={website_id} className={styles.website}>
|
<div key={website_id} className={styles.website}>
|
||||||
<WebsiteChart
|
<WebsiteChart
|
||||||
|
Loading…
Reference in New Issue
Block a user