Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add CustomLoader component and integrate with loading states in Admin, Flow, and Main pages #6047

Merged
merged 5 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading