Skip to content

Commit

Permalink
hide loading onboarding dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
elie222 committed Dec 21, 2024
1 parent 1c4271d commit 51d019d
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions apps/web/app/(app)/automation/RulesPrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import type { RulesPromptResponse } from "@/app/api/user/rules/prompt/route";
import { LoadingContent } from "@/components/LoadingContent";
import { Tooltip } from "@/components/Tooltip";
import { handleActionCall } from "@/utils/server-action";
import { ProcessingPromptFileDialog } from "@/app/(app)/automation/ProcessingPromptFileDialog";
// import { ProcessingPromptFileDialog } from "@/app/(app)/automation/ProcessingPromptFileDialog";

export const examplePrompts = [
'Label newsletters as "Newsletter" and archive them',
Expand Down Expand Up @@ -81,12 +81,12 @@ function RulesPromptForm({
}) {
const [isSubmitting, setIsSubmitting] = useState(false);
const [isGenerating, setIsGenerating] = useState(false);
const [isDialogOpen, setIsDialogOpen] = useState(false);
const [result, setResult] = useState<{
createdRules: number;
editedRules: number;
removedRules: number;
}>();
// const [isDialogOpen, setIsDialogOpen] = useState(false);
// const [result, setResult] = useState<{
// createdRules: number;
// editedRules: number;
// removedRules: number;
// }>();
const {
register,
handleSubmit,
Expand Down Expand Up @@ -114,19 +114,20 @@ function RulesPromptForm({
throw new Error(result.error);
}

router.push("/automation?tab=rules");
mutate();
setIsSubmitting(false);

return result;
};

setIsDialogOpen(true);
setResult(undefined);
// setIsDialogOpen(true);
// setResult(undefined);

toast.promise(() => saveRulesPromise(data), {
loading: "Saving rules... This may take a while to process...",
success: (result) => {
setResult(result);
// setResult(result);
const { createdRules, editedRules, removedRules } = result || {};

const message = [
Expand All @@ -144,7 +145,7 @@ function RulesPromptForm({
},
});
},
[mutate],
[router, mutate],
);

const addExamplePrompt = useCallback(
Expand All @@ -160,12 +161,12 @@ function RulesPromptForm({
return (
<Card className="grid grid-cols-1 sm:grid-cols-3">
<div className="sm:col-span-2">
<ProcessingPromptFileDialog
{/* <ProcessingPromptFileDialog
open={isDialogOpen}
result={result}
onOpenChange={setIsDialogOpen}
isLoading={isGenerating}
/>
/> */}

<CardHeader>
<CardTitle>
Expand Down

0 comments on commit 51d019d

Please sign in to comment.