chore: Add CustomLoader component and integrate with loading states in Admin, Flow, and Main pages (#6047)
* feat: Add CustomLoader component and integrate with loading states in Admin, Flow, and Main pages * refactor: simplify CustomLoader component and remove conditional loading logic * feat: add configurable size to CustomLoader component
This commit is contained in:
parent
f9e41f93a0
commit
141e6736d6
5 changed files with 24 additions and 6 deletions
16
src/frontend/src/customization/components/custom-loader.tsx
Normal file
16
src/frontend/src/customization/components/custom-loader.tsx
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import LoadingComponent from "@/components/common/loadingComponent";
|
||||||
|
import { ENABLE_DATASTAX_LANGFLOW } from "../feature-flags";
|
||||||
|
|
||||||
|
type CustomLoaderProps = {
|
||||||
|
remSize?: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
const CustomLoader = ({ remSize = 30 }: CustomLoaderProps) => {
|
||||||
|
return ENABLE_DATASTAX_LANGFLOW ? (
|
||||||
|
<></>
|
||||||
|
) : (
|
||||||
|
<LoadingComponent remSize={remSize} />
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CustomLoader;
|
||||||
|
|
@ -45,6 +45,8 @@ export function getCurlRunCode({
|
||||||
* @param {string} options.endpointName - The name of the webhook endpoint.
|
* @param {string} options.endpointName - The name of the webhook endpoint.
|
||||||
* @returns {string} The cURL command.
|
* @returns {string} The cURL command.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// KEEP THIS FOR LFOSS
|
||||||
export function getCurlWebhookCode({
|
export function getCurlWebhookCode({
|
||||||
flowId,
|
flowId,
|
||||||
isAuth,
|
isAuth,
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ import {
|
||||||
useGetUsers,
|
useGetUsers,
|
||||||
useUpdateUser,
|
useUpdateUser,
|
||||||
} from "@/controllers/API/queries/auth";
|
} from "@/controllers/API/queries/auth";
|
||||||
|
import CustomLoader from "@/customization/components/custom-loader";
|
||||||
import { cloneDeep } from "lodash";
|
import { cloneDeep } from "lodash";
|
||||||
import { useContext, useEffect, useRef, useState } from "react";
|
import { useContext, useEffect, useRef, useState } from "react";
|
||||||
import IconComponent from "../../components/common/genericIconComponent";
|
import IconComponent from "../../components/common/genericIconComponent";
|
||||||
import LoadingComponent from "../../components/common/loadingComponent";
|
|
||||||
import ShadTooltip from "../../components/common/shadTooltipComponent";
|
import ShadTooltip from "../../components/common/shadTooltipComponent";
|
||||||
import { Button } from "../../components/ui/button";
|
import { Button } from "../../components/ui/button";
|
||||||
import { CheckBoxDiv } from "../../components/ui/checkbox";
|
import { CheckBoxDiv } from "../../components/ui/checkbox";
|
||||||
|
|
@ -303,7 +303,7 @@ export default function AdminPage() {
|
||||||
</div>
|
</div>
|
||||||
{isPending || isIdle ? (
|
{isPending || isIdle ? (
|
||||||
<div className="flex h-full w-full items-center justify-center">
|
<div className="flex h-full w-full items-center justify-center">
|
||||||
<LoadingComponent remSize={12} />
|
<CustomLoader remSize={12} />
|
||||||
</div>
|
</div>
|
||||||
) : userList.current.length === 0 && !isIdle ? (
|
) : userList.current.length === 0 && !isIdle ? (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import { DefaultEdge } from "@/CustomEdges";
|
||||||
import NoteNode from "@/CustomNodes/NoteNode";
|
import NoteNode from "@/CustomNodes/NoteNode";
|
||||||
|
|
||||||
import ForwardedIconComponent from "@/components/common/genericIconComponent";
|
import ForwardedIconComponent from "@/components/common/genericIconComponent";
|
||||||
import LoadingComponent from "@/components/common/loadingComponent";
|
|
||||||
import CanvasControls, {
|
import CanvasControls, {
|
||||||
CustomControlButton,
|
CustomControlButton,
|
||||||
} from "@/components/core/canvasControlsComponent";
|
} from "@/components/core/canvasControlsComponent";
|
||||||
|
|
@ -14,6 +13,7 @@ import {
|
||||||
NOTE_NODE_MIN_WIDTH,
|
NOTE_NODE_MIN_WIDTH,
|
||||||
} from "@/constants/constants";
|
} from "@/constants/constants";
|
||||||
import { useGetBuildsQuery } from "@/controllers/API/queries/_builds";
|
import { useGetBuildsQuery } from "@/controllers/API/queries/_builds";
|
||||||
|
import CustomLoader from "@/customization/components/custom-loader";
|
||||||
import { track } from "@/customization/utils/analytics";
|
import { track } from "@/customization/utils/analytics";
|
||||||
import useAutoSaveFlow from "@/hooks/flows/use-autosave-flow";
|
import useAutoSaveFlow from "@/hooks/flows/use-autosave-flow";
|
||||||
import useUploadFlow from "@/hooks/flows/use-upload-flow";
|
import useUploadFlow from "@/hooks/flows/use-upload-flow";
|
||||||
|
|
@ -638,7 +638,7 @@ export default function Page({ view }: { view?: boolean }): JSX.Element {
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex h-full w-full items-center justify-center">
|
<div className="flex h-full w-full items-center justify-center">
|
||||||
<LoadingComponent remSize={30} />
|
<CustomLoader remSize={30} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import LoadingComponent from "@/components/common/loadingComponent";
|
|
||||||
import CardsWrapComponent from "@/components/core/cardsWrapComponent";
|
import CardsWrapComponent from "@/components/core/cardsWrapComponent";
|
||||||
import SideBarFoldersButtonsComponent from "@/components/core/folderSidebarComponent/components/sideBarFolderButtons";
|
import SideBarFoldersButtonsComponent from "@/components/core/folderSidebarComponent/components/sideBarFolderButtons";
|
||||||
import { SidebarProvider } from "@/components/ui/sidebar";
|
import { SidebarProvider } from "@/components/ui/sidebar";
|
||||||
import { useDeleteFolders } from "@/controllers/API/queries/folders";
|
import { useDeleteFolders } from "@/controllers/API/queries/folders";
|
||||||
|
import CustomLoader from "@/customization/components/custom-loader";
|
||||||
import { useCustomNavigate } from "@/customization/hooks/use-custom-navigate";
|
import { useCustomNavigate } from "@/customization/hooks/use-custom-navigate";
|
||||||
import useAlertStore from "@/stores/alertStore";
|
import useAlertStore from "@/stores/alertStore";
|
||||||
import useFlowsManagerStore from "@/stores/flowsManagerStore";
|
import useFlowsManagerStore from "@/stores/flowsManagerStore";
|
||||||
|
|
@ -90,7 +90,7 @@ export default function CollectionPage(): JSX.Element {
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex h-full w-full items-center justify-center">
|
<div className="flex h-full w-full items-center justify-center">
|
||||||
<LoadingComponent remSize={30} />
|
<CustomLoader remSize={30} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</main>
|
</main>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue