-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Simplify rules tab and clean up ui #803
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7200d73
label as copy
elie222 9f468ba
add action icons
elie222 b9665c6
make row clickable. add rule dialog
elie222 12ba91e
when opening create form show one condition or action
elie222 63ee9ba
show examples for create prompt. explain digest to ai
elie222 6a4ea61
unify backend and frontend for ai call
elie222 442e11a
fix up examples
elie222 9ea2b9b
replace circles with icons
elie222 be84996
v2.10.0
elie222 73859f5
update copy
elie222 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
apps/web/app/(app)/[emailAccountId]/assistant/AddRuleDialog.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { PlusIcon } from "lucide-react"; | ||
| import { RulesPrompt } from "@/app/(app)/[emailAccountId]/assistant/RulesPromptNew"; | ||
| import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog"; | ||
| import { Button } from "@/components/ui/button"; | ||
|
|
||
| export function AddRuleDialog() { | ||
| return ( | ||
| <Dialog> | ||
| <DialogTrigger> | ||
| <Button size="sm" Icon={PlusIcon}> | ||
| Add Rule | ||
| </Button> | ||
| </DialogTrigger> | ||
| <DialogContent className="max-w-4xl"> | ||
| <RulesPrompt /> | ||
| </DialogContent> | ||
| </Dialog> | ||
| ); | ||
| } | ||
66 changes: 66 additions & 0 deletions
66
apps/web/app/(app)/[emailAccountId]/assistant/AvailableActionsPanel.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import { ActionType } from "@prisma/client"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing "use client" — this component uses hooks This file calls useAccount(); it must be a Client Component in Next.js app router. + "use client";
+
import { ActionType } from "@prisma/client";
🤖 Prompt for AI Agents |
||
| import { Card, CardContent } from "@/components/ui/card"; | ||
| import { getActionIcon } from "@/utils/action-display"; | ||
| import { SectionHeader } from "@/components/Typography"; | ||
| import { useAccount } from "@/providers/EmailAccountProvider"; | ||
| import { | ||
| getAvailableActions, | ||
| getExtraActions, | ||
| } from "@/utils/ai/rule/create-rule-schema"; | ||
|
|
||
| const actionNames: Record<ActionType, string> = { | ||
| [ActionType.LABEL]: "Label", | ||
| [ActionType.MOVE_FOLDER]: "Move to folder", | ||
| [ActionType.ARCHIVE]: "Archive", | ||
| [ActionType.DRAFT_EMAIL]: "Draft replies", | ||
| [ActionType.REPLY]: "Send replies", | ||
| [ActionType.FORWARD]: "Forward", | ||
| [ActionType.MARK_READ]: "Mark as read", | ||
| [ActionType.MARK_SPAM]: "Mark as spam", | ||
| [ActionType.SEND_EMAIL]: "Send email", | ||
| [ActionType.CALL_WEBHOOK]: "Call webhook", | ||
| [ActionType.DIGEST]: "Add to digest", | ||
| [ActionType.TRACK_THREAD]: "Track thread", | ||
| }; | ||
|
|
||
| export function AvailableActionsPanel() { | ||
| const { provider } = useAccount(); | ||
| return ( | ||
| <Card className="h-fit bg-slate-50 dark:bg-slate-900"> | ||
| <CardContent className="pt-4"> | ||
| <div className="grid gap-2"> | ||
| <ActionSection | ||
| actions={getAvailableActions(provider)} | ||
| title="Available Actions" | ||
| /> | ||
| <ActionSection actions={getExtraActions()} title="Extra" /> | ||
| </div> | ||
| </CardContent> | ||
| </Card> | ||
| ); | ||
| } | ||
|
|
||
| function ActionSection({ | ||
| title, | ||
| actions, | ||
| }: { | ||
| title: string; | ||
| actions: ActionType[]; | ||
| }) { | ||
| return ( | ||
| <div> | ||
| <SectionHeader>{title}</SectionHeader> | ||
| <div className="grid gap-2 mt-1"> | ||
| {actions.map((actionType) => { | ||
| const Icon = getActionIcon(actionType); | ||
| return ( | ||
| <div key={actionType} className="flex items-center gap-2"> | ||
| <Icon className="size-3.5 text-muted-foreground" /> | ||
| <span className="text-sm">{actionNames[actionType]}</span> | ||
| </div> | ||
| ); | ||
| })} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.