Skip to content

Commit

Permalink
chore: Add CustomLoader component and integrate with loading states i…
Browse files Browse the repository at this point in the history
…n 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
  • Loading branch information
deon-sanchez authored Feb 7, 2025
1 parent f9e41f9 commit 141e673
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
16 changes: 16 additions & 0 deletions src/frontend/src/customization/components/custom-loader.tsx
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 2 additions & 0 deletions src/frontend/src/modals/apiModal/utils/get-curl-code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export function getCurlRunCode({
* @param {string} options.endpointName - The name of the webhook endpoint.
* @returns {string} The cURL command.
*/

// KEEP THIS FOR LFOSS
export function getCurlWebhookCode({
flowId,
isAuth,
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/pages/AdminPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
useGetUsers,
useUpdateUser,
} from "@/controllers/API/queries/auth";
import CustomLoader from "@/customization/components/custom-loader";
import { cloneDeep } from "lodash";
import { useContext, useEffect, useRef, useState } from "react";
import IconComponent from "../../components/common/genericIconComponent";
import LoadingComponent from "../../components/common/loadingComponent";
import ShadTooltip from "../../components/common/shadTooltipComponent";
import { Button } from "../../components/ui/button";
import { CheckBoxDiv } from "../../components/ui/checkbox";
Expand Down Expand Up @@ -303,7 +303,7 @@ export default function AdminPage() {
</div>
{isPending || isIdle ? (
<div className="flex h-full w-full items-center justify-center">
<LoadingComponent remSize={12} />
<CustomLoader remSize={12} />
</div>
) : userList.current.length === 0 && !isIdle ? (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { DefaultEdge } from "@/CustomEdges";
import NoteNode from "@/CustomNodes/NoteNode";

import ForwardedIconComponent from "@/components/common/genericIconComponent";
import LoadingComponent from "@/components/common/loadingComponent";
import CanvasControls, {
CustomControlButton,
} from "@/components/core/canvasControlsComponent";
Expand All @@ -14,6 +13,7 @@ import {
NOTE_NODE_MIN_WIDTH,
} from "@/constants/constants";
import { useGetBuildsQuery } from "@/controllers/API/queries/_builds";
import CustomLoader from "@/customization/components/custom-loader";
import { track } from "@/customization/utils/analytics";
import useAutoSaveFlow from "@/hooks/flows/use-autosave-flow";
import useUploadFlow from "@/hooks/flows/use-upload-flow";
Expand Down Expand Up @@ -638,7 +638,7 @@ export default function Page({ view }: { view?: boolean }): JSX.Element {
</div>
) : (
<div className="flex h-full w-full items-center justify-center">
<LoadingComponent remSize={30} />
<CustomLoader remSize={30} />
</div>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/pages/MainPage/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import LoadingComponent from "@/components/common/loadingComponent";
import CardsWrapComponent from "@/components/core/cardsWrapComponent";
import SideBarFoldersButtonsComponent from "@/components/core/folderSidebarComponent/components/sideBarFolderButtons";
import { SidebarProvider } from "@/components/ui/sidebar";
import { useDeleteFolders } from "@/controllers/API/queries/folders";
import CustomLoader from "@/customization/components/custom-loader";
import { useCustomNavigate } from "@/customization/hooks/use-custom-navigate";
import useAlertStore from "@/stores/alertStore";
import useFlowsManagerStore from "@/stores/flowsManagerStore";
Expand Down Expand Up @@ -90,7 +90,7 @@ export default function CollectionPage(): JSX.Element {
</div>
) : (
<div className="flex h-full w-full items-center justify-center">
<LoadingComponent remSize={30} />
<CustomLoader remSize={30} />
</div>
)}
</main>
Expand Down

0 comments on commit 141e673

Please sign in to comment.