mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-20 19:30:41 -05:00
fix: Remove unnecessary loader in actions tab (#2371)
Co-authored-by: ShubhamPalriwala <spalriwalau@gmail.com> Co-authored-by: Johannes <72809645+jobenjada@users.noreply.github.com>
This commit is contained in:
+18
-16
@@ -7,7 +7,7 @@ import { useMembershipRole } from "@formbricks/lib/membership/hooks/useMembershi
|
||||
import { getAccessFlags } from "@formbricks/lib/membership/utils";
|
||||
import { TActionClass } from "@formbricks/types/actionClasses";
|
||||
import { Button } from "@formbricks/ui/Button";
|
||||
import { LoadingWrapper } from "@formbricks/ui/LoadingWrapper";
|
||||
import { ErrorComponent } from "@formbricks/ui/ErrorComponent";
|
||||
|
||||
import ActionDetailModal from "./ActionDetailModal";
|
||||
import AddNoCodeActionModal from "./AddActionModal";
|
||||
@@ -42,23 +42,25 @@ export default function ActionClassesTable({
|
||||
setActiveActionClass(actionClass);
|
||||
setActionDetailModalOpen(true);
|
||||
};
|
||||
|
||||
if (error) {
|
||||
return <ErrorComponent />;
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<LoadingWrapper isLoading={isLoading} error={error}>
|
||||
{!isViewer && (
|
||||
<div className="mb-6 text-right">
|
||||
<Button
|
||||
variant="darkCTA"
|
||||
onClick={() => {
|
||||
setAddActionModalOpen(true);
|
||||
}}>
|
||||
<MousePointerClickIcon className="mr-2 h-5 w-5 text-white" />
|
||||
Add Action
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</LoadingWrapper>
|
||||
{!isViewer && (
|
||||
<div className="mb-6 text-right">
|
||||
<Button
|
||||
loading={isLoading}
|
||||
variant="darkCTA"
|
||||
onClick={() => {
|
||||
setAddActionModalOpen(true);
|
||||
}}>
|
||||
<MousePointerClickIcon className="mr-2 h-5 w-5 text-white" />
|
||||
{isLoading ? "Loading" : "Add Action"}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="rounded-lg border border-slate-200">
|
||||
{TableHeading}
|
||||
<div className="grid-cols-7" id="actionClassesWrapper">
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import { ReactNode } from "react";
|
||||
|
||||
import { ErrorComponent } from "../ErrorComponent";
|
||||
import LoadingSpinner from "../LoadingSpinner";
|
||||
|
||||
type AccessWrapperProps = {
|
||||
isLoading: boolean;
|
||||
children: ReactNode;
|
||||
error: string;
|
||||
};
|
||||
|
||||
export const LoadingWrapper = ({ isLoading, children, error }: AccessWrapperProps) => {
|
||||
if (isLoading) return <LoadingSpinner />;
|
||||
|
||||
if (error.length > 0) {
|
||||
console.error(error);
|
||||
return <ErrorComponent />;
|
||||
}
|
||||
|
||||
return <>{children}</>;
|
||||
};
|
||||
Reference in New Issue
Block a user