mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
New goals page. Upgraded prisma.
This commit is contained in:
parent
99330a1a4d
commit
49bcbfd7f9
65 changed files with 769 additions and 1195 deletions
|
|
@ -1,36 +1,36 @@
|
|||
import { ReactNode } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { Loading } from '@umami/react-zen';
|
||||
import { Spinner, Dots } from '@umami/react-zen';
|
||||
import { ErrorMessage } from '@/components/common/ErrorMessage';
|
||||
import { Empty } from '@/components/common/Empty';
|
||||
import styles from './LoadingPanel.module.css';
|
||||
|
||||
export function LoadingPanel({
|
||||
data,
|
||||
error,
|
||||
isEmpty,
|
||||
isFetched,
|
||||
isLoading,
|
||||
loadingIcon = 'dots',
|
||||
renderEmpty = () => <Empty />,
|
||||
className,
|
||||
children,
|
||||
}: {
|
||||
data?: any;
|
||||
error?: Error;
|
||||
isEmpty?: boolean;
|
||||
isFetched?: boolean;
|
||||
isLoading?: boolean;
|
||||
loadingIcon?: 'dots' | 'spinner';
|
||||
isEmpty?: boolean;
|
||||
renderEmpty?: () => ReactNode;
|
||||
className?: string;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const isEmpty = !isLoading && isFetched && data && Array.isArray(data) && data.length === 0;
|
||||
|
||||
return (
|
||||
<div className={classNames(styles.panel, className)}>
|
||||
{isLoading && !isFetched && <Loading className={styles.loading} icon={loadingIcon} />}
|
||||
{isLoading && !isFetched && (loadingIcon === 'dots' ? <Dots /> : <Spinner />)}
|
||||
{error && <ErrorMessage />}
|
||||
{!error && isEmpty && <Empty />}
|
||||
{!error && !isEmpty && data && children}
|
||||
{!error && !isLoading && isEmpty && renderEmpty()}
|
||||
{!error && !isLoading && !isEmpty && children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue