fix(board): align edit mode with dev's removal of loading overlay
Remove useIsBoardReady and LoadingOverlay from edit mode board, aligning with the dev branch's perf improvement that shows the board immediately without waiting for ready state.
This commit is contained in:
1 file changed
+10
-21
@@ -1,41 +1,30 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Box, LoadingOverlay, Stack } from "@mantine/core";
|
import { Stack } from "@mantine/core";
|
||||||
|
|
||||||
import { useCurrentLayout, useRequiredBoard } from "@homarr/boards/context";
|
import { useCurrentLayout, useRequiredBoard } from "@homarr/boards/context";
|
||||||
|
|
||||||
import { BoardCategorySection } from "~/components/board/sections/category-section";
|
import { BoardCategorySection } from "~/components/board/sections/category-section";
|
||||||
import { BoardEmptySection } from "~/components/board/sections/empty-section";
|
import { BoardEmptySection } from "~/components/board/sections/empty-section";
|
||||||
import { fullHeightWithoutHeaderAndFooter } from "~/constants";
|
|
||||||
import { useIsBoardReady } from "./_ready-context";
|
|
||||||
|
|
||||||
const EditModeBoard = () => {
|
const EditModeBoard = () => {
|
||||||
const board = useRequiredBoard();
|
const board = useRequiredBoard();
|
||||||
const currentLayoutId = useCurrentLayout();
|
const currentLayoutId = useCurrentLayout();
|
||||||
const isReady = useIsBoardReady();
|
|
||||||
|
|
||||||
const fullWidthSortedSections = board.sections
|
const fullWidthSortedSections = board.sections
|
||||||
.filter((section) => section.kind === "empty" || section.kind === "category")
|
.filter((section) => section.kind === "empty" || section.kind === "category")
|
||||||
.sort((sectionA, sectionB) => sectionA.yOffset - sectionB.yOffset);
|
.sort((sectionA, sectionB) => sectionA.yOffset - sectionB.yOffset);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box h="100%" pos="relative">
|
<Stack h="100%">
|
||||||
<LoadingOverlay
|
{fullWidthSortedSections.map((section) =>
|
||||||
visible={!isReady}
|
section.kind === "empty" ? (
|
||||||
transitionProps={{ duration: 500 }}
|
<BoardEmptySection key={`${currentLayoutId}-${section.id}`} section={section} />
|
||||||
loaderProps={{ size: "lg" }}
|
) : (
|
||||||
h={fullHeightWithoutHeaderAndFooter}
|
<BoardCategorySection key={`${currentLayoutId}-${section.id}`} section={section} />
|
||||||
/>
|
),
|
||||||
<Stack h="100%" style={{ visibility: isReady ? "visible" : "hidden" }}>
|
)}
|
||||||
{fullWidthSortedSections.map((section) =>
|
</Stack>
|
||||||
section.kind === "empty" ? (
|
|
||||||
<BoardEmptySection key={`${currentLayoutId}-${section.id}`} section={section} />
|
|
||||||
) : (
|
|
||||||
<BoardCategorySection key={`${currentLayoutId}-${section.id}`} section={section} />
|
|
||||||
),
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
</Box>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user