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

Add dialog while waiting for rules to process #296

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
421 changes: 177 additions & 244 deletions apps/web/app/(app)/automation/ProcessingPromptFileDialog.tsx

Large diffs are not rendered by default.

31 changes: 15 additions & 16 deletions apps/web/app/(app)/automation/RulesPrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { AutomationOnboarding } from "@/app/(app)/automation/AutomationOnboardin
import { examplePrompts, personas } from "@/app/(app)/automation/examples";
import { PersonaDialog } from "@/app/(app)/automation/PersonaDialog";
import { useModal } from "@/components/Modal";
// import { ProcessingPromptFileDialog } from "@/app/(app)/automation/ProcessingPromptFileDialog";
import { ProcessingPromptFileDialog } from "@/app/(app)/automation/ProcessingPromptFileDialog";

export function RulesPrompt() {
const { data, isLoading, error, mutate } = useSWR<
Expand Down Expand Up @@ -91,12 +91,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 @@ -140,13 +140,13 @@ function RulesPromptForm({
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 Down Expand Up @@ -183,12 +183,11 @@ function RulesPromptForm({

<Card className="grid grid-cols-1 sm:grid-cols-3">
<div className="sm:col-span-2">
{/* <ProcessingPromptFileDialog
open={isDialogOpen}
result={result}
onOpenChange={setIsDialogOpen}
isLoading={isSubmitting}
/> */}
<ProcessingPromptFileDialog
open={isDialogOpen}
result={result}
onOpenChange={setIsDialogOpen}
/>

<CardHeader>
<CardTitle>
Expand Down
263 changes: 0 additions & 263 deletions apps/web/components/ui/carousel.tsx

This file was deleted.

1 change: 0 additions & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"crisp-sdk-web": "^1.0.25",
"date-fns": "^3.6.0",
"diff": "^7.0.0",
"embla-carousel-react": "^8.5.1",
"encoding": "^0.1.13",
"eslint": "^8.57.1",
"eslint-config-next": "14.2.15",
Expand Down
Binary file added apps/web/public/images/automation/process.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/web/public/images/automation/rule-edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/web/public/images/automation/rules.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions apps/web/utils/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ export function generalizeSubject(subject = "") {
.trim()
);
}

export function pluralize(
count: number,
singular: string,
plural = `${singular}s`,
) {
return count === 1 ? singular : plural;
}
28 changes: 0 additions & 28 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading