mirror of
https://github.com/docmost/docmost.git
synced 2026-08-29 10:05:03 +08:00
feat(base): show table skeleton instead of centered loader on load
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { useCallback, useEffect, useMemo } from "react";
|
import { useCallback, useEffect, useMemo } from "react";
|
||||||
import { Loader, Text, Stack } from "@mantine/core";
|
import { Text, Stack } from "@mantine/core";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { IconDatabase } from "@tabler/icons-react";
|
import { IconDatabase } from "@tabler/icons-react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -20,6 +20,7 @@ import { useBaseTable } from "@/features/base/hooks/use-base-table";
|
|||||||
import { useRowSelection } from "@/features/base/hooks/use-row-selection";
|
import { useRowSelection } from "@/features/base/hooks/use-row-selection";
|
||||||
import { GridContainer } from "@/features/base/components/grid/grid-container";
|
import { GridContainer } from "@/features/base/components/grid/grid-container";
|
||||||
import { BaseToolbar } from "@/features/base/components/base-toolbar";
|
import { BaseToolbar } from "@/features/base/components/base-toolbar";
|
||||||
|
import { BaseTableSkeleton } from "@/features/base/components/base-table-skeleton";
|
||||||
import classes from "@/features/base/styles/grid.module.css";
|
import classes from "@/features/base/styles/grid.module.css";
|
||||||
|
|
||||||
type BaseTableProps = {
|
type BaseTableProps = {
|
||||||
@@ -155,11 +156,7 @@ export function BaseTable({ baseId }: BaseTableProps) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (baseLoading || rowsLoading) {
|
if (baseLoading || rowsLoading) {
|
||||||
return (
|
return <BaseTableSkeleton />;
|
||||||
<div className={classes.loadingOverlay}>
|
|
||||||
<Loader size="md" />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (baseError) {
|
if (baseError) {
|
||||||
|
|||||||
@@ -287,13 +287,6 @@
|
|||||||
gap: var(--mantine-spacing-xs);
|
gap: var(--mantine-spacing-xs);
|
||||||
}
|
}
|
||||||
|
|
||||||
.loadingOverlay {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: var(--mantine-spacing-xl);
|
|
||||||
}
|
|
||||||
|
|
||||||
.primaryCell {
|
.primaryCell {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user