-
Notifications
You must be signed in to change notification settings - Fork 13
Refine agent visibility controls and browsing filters #1609
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
base: test
Are you sure you want to change the base?
Changes from all commits
a04a94f
a889610
2a2d670
81b6179
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { UseFormReturn } from "react-hook-form"; | ||
| import { Switch } from "@/components/ui/switch"; | ||
| import { CreateAgentFormData } from "./schemas"; | ||
|
|
||
| interface AgentVisibilityControlProps { | ||
| form: UseFormReturn<CreateAgentFormData>; | ||
| } | ||
|
|
||
| const AgentVisibilityControl = ({ form }: AgentVisibilityControlProps) => { | ||
| const isPrivate = form.watch("isPrivate"); | ||
|
|
||
| return ( | ||
| <div className="flex flex-wrap items-center gap-3"> | ||
| <span | ||
| className={`text-sm ${!isPrivate ? "text-foreground" : "text-muted-foreground"}`} | ||
| > | ||
| Public | ||
| </span> | ||
| <Switch | ||
| id="isPrivate" | ||
| checked={isPrivate} | ||
|
Comment on lines
+19
to
+21
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.
This switch is rendered without an associated Useful? React with 👍 / 👎. |
||
| aria-label={isPrivate ? "Private agent" : "Public agent"} | ||
| onCheckedChange={(checked) => | ||
| form.setValue("isPrivate", checked, { | ||
| shouldDirty: true, | ||
| shouldValidate: true, | ||
| }) | ||
| } | ||
| /> | ||
| <span | ||
| className={`text-sm ${isPrivate ? "text-foreground" : "text-muted-foreground"}`} | ||
| > | ||
| Private | ||
| </span> | ||
| </div> | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ); | ||
| }; | ||
|
|
||
| export default AgentVisibilityControl; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { cn } from "@/lib/utils"; | ||
|
|
||
| interface AgentsVisibilityFilterProps { | ||
| isPrivate: boolean; | ||
| togglePrivate: () => void; | ||
| } | ||
|
|
||
| const AgentsVisibilityFilter = ({ | ||
| isPrivate, | ||
| togglePrivate, | ||
| }: AgentsVisibilityFilterProps) => { | ||
| return ( | ||
| <div | ||
| role="group" | ||
| aria-label="Agent visibility filter" | ||
| className="inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground" | ||
| > | ||
| <button | ||
| type="button" | ||
| aria-pressed={!isPrivate} | ||
| onClick={() => { | ||
| if (isPrivate) togglePrivate(); | ||
| }} | ||
| className={cn( | ||
| "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all cursor-pointer", | ||
| !isPrivate | ||
| ? "bg-background text-foreground shadow" | ||
| : "text-muted-foreground hover:text-foreground" | ||
| )} | ||
| > | ||
| Public | ||
| </button> | ||
| <button | ||
| type="button" | ||
| aria-pressed={isPrivate} | ||
| onClick={() => { | ||
| if (!isPrivate) togglePrivate(); | ||
| }} | ||
| className={cn( | ||
| "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all cursor-pointer", | ||
| isPrivate | ||
| ? "bg-background text-foreground shadow" | ||
| : "text-muted-foreground hover:text-foreground" | ||
| )} | ||
| > | ||
| Private | ||
| </button> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default AgentsVisibilityFilter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new reset effect now depends on the entire
agentobject, so while the dialog is open any background query refresh that replacesagent(for example React Query refetch on window focus) will callform.reset(...)and discard unsaved edits. This is a user-facing data-loss regression inAgentEditDialogbecause typing into the form can be silently wiped mid-edit; the reset should be keyed to opening the dialog (or a stable identity change likeagent.id) rather than every object refresh.Useful? React with 👍 / 👎.