@greatapps/greatagents-ui 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatapps/greatagents-ui",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Shared agents UI components for Great platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,12 +15,14 @@ import {
15
15
  } from "@greatapps/greatauth-ui/ui";
16
16
  import { Loader2 } from "lucide-react";
17
17
  import { toast } from "sonner";
18
+ import { ImageCropUpload } from "@greatapps/greatauth-ui";
18
19
 
19
20
  interface AgentFormDialogProps {
20
21
  config: GagentsHookConfig;
21
22
  open: boolean;
22
23
  onOpenChange: (open: boolean) => void;
23
24
  agent?: Agent;
25
+ idAccount?: string | number | null;
24
26
  }
25
27
 
26
28
  interface FormState {
@@ -68,6 +70,7 @@ export function AgentFormDialog({
68
70
  open,
69
71
  onOpenChange,
70
72
  agent,
73
+ idAccount,
71
74
  }: AgentFormDialogProps) {
72
75
  const isEditing = !!agent;
73
76
  const createAgent = useCreateAgent(config);
@@ -139,19 +142,17 @@ export function AgentFormDialog({
139
142
  </DialogTitle>
140
143
  </DialogHeader>
141
144
  <form onSubmit={handleSubmit} className="space-y-4">
142
- <div className="space-y-2">
143
- <Label htmlFor="agent-photo">Foto (URL)</Label>
144
- <Input
145
- id="agent-photo"
146
- name="photo"
147
- value={form.photo}
148
- onChange={(e) => updateField("photo", e.target.value)}
149
- placeholder="https://exemplo.com/foto.jpg"
145
+ <div className="flex justify-center">
146
+ <ImageCropUpload
147
+ value={form.photo || null}
148
+ onChange={(url) => updateField("photo", url)}
149
+ onRemove={() => updateField("photo", "")}
150
+ entityType="agents"
151
+ entityId={agent?.id}
152
+ idAccount={typeof idAccount === "string" ? Number(idAccount) : (idAccount ?? Number(config.accountId) ?? 0)}
153
+ name={form.title || null}
150
154
  disabled={isPending}
151
155
  />
152
- <p className="text-xs text-muted-foreground">
153
- URL da imagem de avatar do agente
154
- </p>
155
156
  </div>
156
157
  <div className="space-y-2">
157
158
  <Label htmlFor="agent-title">Nome do Agente *</Label>