| gio | c31bf14 | 2025-06-16 07:48:20 +0000 | [diff] [blame] | 1 | import { nodeLabelFull, useEnv, useMessages, useProjectId, useStateStore } from "@/lib/state"; |
| gio | 5f2f100 | 2025-03-20 18:38:48 +0400 | [diff] [blame] | 2 | import { Button } from "./ui/button"; |
| 3 | import { useCallback, useEffect, useState } from "react"; |
| gio | c31bf14 | 2025-06-16 07:48:20 +0000 | [diff] [blame] | 4 | import { generateDodoConfig, AppNode } from "config"; |
| gio | 5f2f100 | 2025-03-20 18:38:48 +0400 | [diff] [blame] | 5 | import { useNodes, useReactFlow } from "@xyflow/react"; |
| 6 | import { useToast } from "@/hooks/use-toast"; |
| gio | 818da4e | 2025-05-12 14:45:35 +0000 | [diff] [blame] | 7 | import { |
| 8 | DropdownMenuGroup, |
| 9 | DropdownMenuItem, |
| 10 | DropdownMenu, |
| 11 | DropdownMenuContent, |
| 12 | DropdownMenuTrigger, |
| 13 | } from "./ui/dropdown-menu"; |
| gio | 1037ee2 | 2025-06-26 09:25:43 +0000 | [diff] [blame] | 14 | import { Ellipsis, LoaderCircle, Plus } from "lucide-react"; |
| gio | 8e74dc0 | 2025-06-13 10:19:26 +0000 | [diff] [blame] | 15 | import { ImportModal } from "./import-modal"; |
| gio | 1037ee2 | 2025-06-26 09:25:43 +0000 | [diff] [blame] | 16 | import { Dialog, DialogContent, DialogHeader, DialogTitle } from "./ui/dialog"; |
| 17 | import { Resources } from "./resources"; |
| gio | 5f2f100 | 2025-03-20 18:38:48 +0400 | [diff] [blame] | 18 | |
| gio | da70865 | 2025-04-30 14:57:38 +0400 | [diff] [blame] | 19 | function toNodeType(t: string): string { |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 20 | if (t === "ingress") { |
| 21 | return "gateway-https"; |
| 22 | } else if (t === "service") { |
| 23 | return "app"; |
| 24 | } else { |
| 25 | return t; |
| 26 | } |
| gio | da70865 | 2025-04-30 14:57:38 +0400 | [diff] [blame] | 27 | } |
| 28 | |
| gio | 1037ee2 | 2025-06-26 09:25:43 +0000 | [diff] [blame] | 29 | interface ActionsProps { |
| 30 | isOverview?: boolean; |
| 31 | } |
| 32 | |
| 33 | export function Actions({ isOverview = false }: ActionsProps) { |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 34 | const { toast } = useToast(); |
| 35 | const store = useStateStore(); |
| 36 | const projectId = useProjectId(); |
| 37 | const nodes = useNodes<AppNode>(); |
| 38 | const env = useEnv(); |
| 39 | const messages = useMessages(); |
| 40 | const instance = useReactFlow(); |
| 41 | const [ok, setOk] = useState(false); |
| 42 | const [loading, setLoading] = useState(false); |
| gio | 7d81370 | 2025-05-08 18:29:52 +0000 | [diff] [blame] | 43 | const [reloading, setReloading] = useState(false); |
| gio | 8e74dc0 | 2025-06-13 10:19:26 +0000 | [diff] [blame] | 44 | const [showImportModal, setShowImportModal] = useState(false); |
| gio | 1037ee2 | 2025-06-26 09:25:43 +0000 | [diff] [blame] | 45 | const [showResourcesModal, setShowResourcesModal] = useState(false); |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 46 | const info = useCallback( |
| 47 | (title: string, description?: string, duration?: number) => { |
| 48 | return toast({ |
| 49 | title, |
| 50 | description, |
| 51 | duration: duration ?? 2000, |
| 52 | }); |
| 53 | }, |
| 54 | [toast], |
| 55 | ); |
| 56 | const error = useCallback( |
| 57 | (title: string, description?: string, duration?: number) => { |
| 58 | return toast({ |
| 59 | variant: "destructive", |
| 60 | title, |
| 61 | description, |
| 62 | duration: duration ?? 5000, |
| 63 | }); |
| 64 | }, |
| 65 | [toast], |
| 66 | ); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 67 | useEffect(() => { |
| 68 | setOk(!messages.some((m) => m.type === "FATAL")); |
| 69 | }, [messages, setOk]); |
| 70 | const monitor = useCallback(async () => { |
| 71 | const m = async function () { |
| 72 | const resp = await fetch(`/api/project/${projectId}/status`, { |
| 73 | method: "GET", |
| 74 | headers: { |
| 75 | "Content-Type": "application/json", |
| 76 | }, |
| 77 | }); |
| 78 | if (resp.status !== 200) { |
| 79 | return; |
| 80 | } |
| 81 | const data: { type: string; name: string; status: string }[] = await resp.json(); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 82 | for (const n of nodes) { |
| 83 | if (n.type === "network") { |
| 84 | continue; |
| 85 | } |
| gio | 8fad76a | 2025-05-22 14:01:23 +0000 | [diff] [blame] | 86 | const d = data.find((d) => n.type === toNodeType(d.type) && nodeLabelFull(n) === d.name); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 87 | if (d !== undefined) { |
| 88 | store.updateNodeData(n.id, { |
| 89 | state: d?.status, |
| 90 | }); |
| 91 | } |
| 92 | } |
| 93 | if (data.find((d) => d.status !== "success" && d.status != "failure") !== undefined) { |
| 94 | setTimeout(m, 1000); |
| 95 | } |
| 96 | }; |
| 97 | setTimeout(m, 100); |
| 98 | }, [projectId, nodes, store]); |
| 99 | const deploy = useCallback(async () => { |
| 100 | if (projectId == null) { |
| 101 | return; |
| 102 | } |
| 103 | setLoading(true); |
| 104 | try { |
| gio | 7d81370 | 2025-05-08 18:29:52 +0000 | [diff] [blame] | 105 | const config = generateDodoConfig(projectId, nodes, env); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 106 | if (config == null) { |
| 107 | throw new Error("MUST NOT REACH!"); |
| 108 | } |
| 109 | const resp = await fetch(`/api/project/${projectId}/deploy`, { |
| 110 | method: "POST", |
| 111 | headers: { |
| 112 | "Content-Type": "application/json", |
| 113 | }, |
| 114 | body: JSON.stringify({ |
| gio | bd37a2b | 2025-05-15 04:28:42 +0000 | [diff] [blame] | 115 | state: instance.toObject(), |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 116 | config, |
| 117 | }), |
| 118 | }); |
| 119 | if (resp.ok) { |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 120 | store.setMode("deploy"); |
| 121 | info("Deployment succeeded"); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 122 | monitor(); |
| 123 | } else { |
| gio | 8fad76a | 2025-05-22 14:01:23 +0000 | [diff] [blame] | 124 | error("Deployment failed"); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 125 | } |
| gio | 6223714 | 2025-05-19 10:39:40 +0000 | [diff] [blame] | 126 | store.refreshEnv(); |
| gio | 8fad76a | 2025-05-22 14:01:23 +0000 | [diff] [blame] | 127 | } catch { |
| 128 | error("Deployment failed"); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 129 | } finally { |
| 130 | setLoading(false); |
| 131 | } |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 132 | }, [projectId, instance, nodes, env, setLoading, info, error, monitor, store]); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 133 | const save = useCallback(async () => { |
| 134 | if (projectId == null) { |
| 135 | return; |
| 136 | } |
| 137 | const resp = await fetch(`/api/project/${projectId}/saved`, { |
| 138 | method: "POST", |
| 139 | headers: { |
| 140 | "Content-Type": "application/json", |
| 141 | }, |
| gio | 10ff134 | 2025-07-05 10:22:15 +0000 | [diff] [blame^] | 142 | body: JSON.stringify({ |
| 143 | type: "graph", |
| 144 | graph: instance.toObject(), |
| 145 | }), |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 146 | }); |
| 147 | if (resp.ok) { |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 148 | info("Save succeeded"); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 149 | } else { |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 150 | error("Save failed", await resp.text()); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 151 | } |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 152 | }, [projectId, instance, info, error]); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 153 | const restoreSaved = useCallback(async () => { |
| 154 | if (projectId == null) { |
| 155 | return; |
| 156 | } |
| gio | 818da4e | 2025-05-12 14:45:35 +0000 | [diff] [blame] | 157 | const resp = await fetch(`/api/project/${projectId}/saved/${store.mode === "deploy" ? "deploy" : "draft"}`, { |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 158 | method: "GET", |
| 159 | }); |
| 160 | const inst = await resp.json(); |
| gio | c31bf14 | 2025-06-16 07:48:20 +0000 | [diff] [blame] | 161 | const { x = 0, y = 0, zoom = 1 } = inst.state.viewport; |
| 162 | store.setNodes(inst.state.nodes || []); |
| 163 | store.setEdges(inst.state.edges || []); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 164 | instance.setViewport({ x, y, zoom }); |
| 165 | }, [projectId, instance, store]); |
| 166 | const clear = useCallback(() => { |
| 167 | store.setEdges([]); |
| gio | 6d8b71c | 2025-05-19 12:57:35 +0000 | [diff] [blame] | 168 | store.setNodes(store.nodes.filter((n) => n.type === "network")); |
| 169 | }, [store]); |
| gio | 818da4e | 2025-05-12 14:45:35 +0000 | [diff] [blame] | 170 | const edit = useCallback(async () => { |
| 171 | store.setMode("edit"); |
| 172 | }, [store]); |
| gio | 74ab785 | 2025-05-13 13:19:31 +0000 | [diff] [blame] | 173 | // TODO(gio): refresh projects |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 174 | const deleteProject = useCallback(async () => { |
| 175 | if (projectId == null) { |
| 176 | return; |
| 177 | } |
| gio | 3304672 | 2025-05-16 14:49:55 +0000 | [diff] [blame] | 178 | if (!confirm("Are you sure you want to delete this project? This action cannot be undone.")) { |
| 179 | return; |
| 180 | } |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 181 | const resp = await fetch(`/api/project/${projectId}`, { |
| 182 | method: "DELETE", |
| gio | a71316d | 2025-05-24 09:41:36 +0400 | [diff] [blame] | 183 | headers: { |
| 184 | "Content-Type": "application/json", |
| 185 | }, |
| 186 | body: JSON.stringify({ state: JSON.stringify(instance.toObject()) }), |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 187 | }); |
| 188 | if (resp.ok) { |
| 189 | clear(); |
| 190 | store.setProject(undefined); |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 191 | info("Project deleted"); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 192 | } else { |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 193 | error("Failed to delete project", await resp.text()); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 194 | } |
| gio | a71316d | 2025-05-24 09:41:36 +0400 | [diff] [blame] | 195 | }, [store, clear, projectId, info, error, instance]); |
| gio | 7d81370 | 2025-05-08 18:29:52 +0000 | [diff] [blame] | 196 | const reload = useCallback(async () => { |
| 197 | if (projectId == null) { |
| 198 | return; |
| 199 | } |
| 200 | setReloading(true); |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 201 | const { dismiss } = info("Reloading services", "This may take a while...", Infinity); |
| gio | 7d81370 | 2025-05-08 18:29:52 +0000 | [diff] [blame] | 202 | try { |
| 203 | const resp = await fetch(`/api/project/${projectId}/reload`, { |
| 204 | method: "POST", |
| 205 | headers: { |
| 206 | "Content-Type": "application/json", |
| 207 | }, |
| 208 | }); |
| 209 | if (resp.ok) { |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 210 | dismiss(); |
| 211 | info("Reloaded services successfully"); |
| gio | 7d81370 | 2025-05-08 18:29:52 +0000 | [diff] [blame] | 212 | } else { |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 213 | dismiss(); |
| 214 | error("Reload failed", await resp.text()); |
| gio | 7d81370 | 2025-05-08 18:29:52 +0000 | [diff] [blame] | 215 | } |
| 216 | } catch (e) { |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 217 | dismiss(); |
| 218 | error("Reload failed", e instanceof Error ? e.message : undefined); |
| gio | 7d81370 | 2025-05-08 18:29:52 +0000 | [diff] [blame] | 219 | } finally { |
| 220 | setReloading(false); |
| 221 | } |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 222 | }, [projectId, info, error]); |
| gio | bd37a2b | 2025-05-15 04:28:42 +0000 | [diff] [blame] | 223 | const removeDeployment = useCallback(async () => { |
| 224 | if (projectId == null) { |
| 225 | return; |
| 226 | } |
| 227 | if (!confirm("Are you sure you want to remove this deployment? This action cannot be undone.")) { |
| 228 | return; |
| 229 | } |
| 230 | setReloading(true); |
| 231 | try { |
| 232 | const resp = await fetch(`/api/project/${projectId}/remove-deployment`, { |
| 233 | method: "POST", |
| 234 | headers: { |
| 235 | "Content-Type": "application/json", |
| 236 | }, |
| 237 | }); |
| 238 | if (resp.ok) { |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 239 | info("Deployment removed successfully"); |
| gio | bd37a2b | 2025-05-15 04:28:42 +0000 | [diff] [blame] | 240 | store.setMode("edit"); |
| 241 | } else { |
| 242 | const errorData = await resp.json(); |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 243 | error("Failed to remove deployment", errorData.error || "Unknown error"); |
| gio | bd37a2b | 2025-05-15 04:28:42 +0000 | [diff] [blame] | 244 | } |
| 245 | } catch (e) { |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 246 | error("Failed to remove deployment", e instanceof Error ? e.message : undefined); |
| gio | bd37a2b | 2025-05-15 04:28:42 +0000 | [diff] [blame] | 247 | } finally { |
| gio | b1c5c45 | 2025-05-21 04:16:54 +0000 | [diff] [blame] | 248 | store.refreshEnv(); |
| gio | bd37a2b | 2025-05-15 04:28:42 +0000 | [diff] [blame] | 249 | setReloading(false); |
| 250 | } |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 251 | }, [projectId, info, error, store]); |
| 252 | const [deployProps, setDeployProps] = useState<{ loading?: boolean; disabled?: boolean }>({ |
| 253 | loading: false, |
| 254 | disabled: false, |
| 255 | }); |
| 256 | const [reloadProps, setReloadProps] = useState<{ loading?: boolean; disabled?: boolean }>({ |
| 257 | loading: false, |
| 258 | disabled: false, |
| 259 | }); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 260 | useEffect(() => { |
| 261 | if (loading) { |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 262 | setDeployProps({ loading: true, disabled: true }); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 263 | } else if (ok) { |
| gio | 7d81370 | 2025-05-08 18:29:52 +0000 | [diff] [blame] | 264 | setDeployProps({ disabled: false }); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 265 | } else { |
| gio | 7d81370 | 2025-05-08 18:29:52 +0000 | [diff] [blame] | 266 | setDeployProps({ disabled: true }); |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 267 | } |
| gio | 7d81370 | 2025-05-08 18:29:52 +0000 | [diff] [blame] | 268 | |
| 269 | if (reloading) { |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 270 | setReloadProps({ loading: true, disabled: true }); |
| gio | 7d81370 | 2025-05-08 18:29:52 +0000 | [diff] [blame] | 271 | } else { |
| 272 | setReloadProps({ disabled: projectId === undefined }); |
| 273 | } |
| 274 | }, [ok, loading, reloading, projectId]); |
| gio | 818da4e | 2025-05-12 14:45:35 +0000 | [diff] [blame] | 275 | if (store.mode === "deploy") { |
| 276 | return ( |
| 277 | <div className="flex flex-row gap-1 items-center"> |
| 278 | <Button onClick={edit} {...reloadProps}> |
| 279 | Edit |
| 280 | </Button> |
| 281 | <DropdownMenu> |
| 282 | <DropdownMenuTrigger> |
| gio | 3d0bf03 | 2025-06-05 06:57:26 +0000 | [diff] [blame] | 283 | <Button size="icon"> |
| 284 | <Ellipsis /> |
| 285 | </Button> |
| gio | 818da4e | 2025-05-12 14:45:35 +0000 | [diff] [blame] | 286 | </DropdownMenuTrigger> |
| 287 | <DropdownMenuContent className="w-56"> |
| 288 | <DropdownMenuGroup> |
| 289 | <DropdownMenuItem |
| 290 | onClick={reload} |
| 291 | className="cursor-pointer hover:bg-gray-200" |
| 292 | {...reloadProps} |
| 293 | > |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 294 | {reloadProps.loading ? ( |
| 295 | <> |
| 296 | <LoaderCircle className="animate-spin" /> |
| 297 | Reloading... |
| 298 | </> |
| 299 | ) : ( |
| 300 | "Reload services" |
| 301 | )} |
| gio | 818da4e | 2025-05-12 14:45:35 +0000 | [diff] [blame] | 302 | </DropdownMenuItem> |
| 303 | <DropdownMenuItem |
| gio | bd37a2b | 2025-05-15 04:28:42 +0000 | [diff] [blame] | 304 | onClick={removeDeployment} |
| 305 | disabled={projectId === undefined} |
| 306 | className="cursor-pointer hover:bg-gray-200" |
| 307 | > |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 308 | Remove deployment |
| gio | bd37a2b | 2025-05-15 04:28:42 +0000 | [diff] [blame] | 309 | </DropdownMenuItem> |
| 310 | <DropdownMenuItem |
| gio | 818da4e | 2025-05-12 14:45:35 +0000 | [diff] [blame] | 311 | onClick={deleteProject} |
| 312 | disabled={projectId === undefined} |
| 313 | className="cursor-pointer hover:bg-gray-200" |
| 314 | > |
| gio | e2b955a | 2025-05-15 15:41:05 +0000 | [diff] [blame] | 315 | Delete project |
| gio | 818da4e | 2025-05-12 14:45:35 +0000 | [diff] [blame] | 316 | </DropdownMenuItem> |
| 317 | </DropdownMenuGroup> |
| 318 | </DropdownMenuContent> |
| 319 | </DropdownMenu> |
| 320 | </div> |
| 321 | ); |
| 322 | } else { |
| 323 | return ( |
| gio | 8e74dc0 | 2025-06-13 10:19:26 +0000 | [diff] [blame] | 324 | <> |
| 325 | <div className="flex flex-row gap-1 items-center"> |
| gio | 1037ee2 | 2025-06-26 09:25:43 +0000 | [diff] [blame] | 326 | {isOverview && ( |
| 327 | <Button onClick={() => setShowResourcesModal(true)}> |
| 328 | <Plus className="w-4 h-4 mr-1" /> |
| 329 | Add |
| 330 | </Button> |
| 331 | )} |
| gio | 8e74dc0 | 2025-06-13 10:19:26 +0000 | [diff] [blame] | 332 | <Button onClick={deploy} {...deployProps}> |
| 333 | {deployProps.loading ? ( |
| 334 | <> |
| 335 | <LoaderCircle className="animate-spin" /> |
| 336 | Deploying... |
| 337 | </> |
| 338 | ) : ( |
| 339 | "Deploy" |
| 340 | )} |
| 341 | </Button> |
| 342 | <Button onClick={save}>Save</Button> |
| 343 | <Button onClick={() => setShowImportModal(true)}>Import</Button> |
| 344 | <DropdownMenu> |
| 345 | <DropdownMenuTrigger> |
| 346 | <Button size="icon"> |
| 347 | <Ellipsis /> |
| 348 | </Button> |
| 349 | </DropdownMenuTrigger> |
| 350 | <DropdownMenuContent className="w-56"> |
| 351 | <DropdownMenuGroup> |
| 352 | <DropdownMenuItem |
| 353 | onClick={restoreSaved} |
| 354 | disabled={projectId === undefined} |
| 355 | className="cursor-pointer hover:bg-gray-200" |
| 356 | > |
| 357 | Restore |
| 358 | </DropdownMenuItem> |
| 359 | <DropdownMenuItem onClick={clear} className="cursor-pointer hover:bg-gray-200"> |
| 360 | Clear |
| 361 | </DropdownMenuItem> |
| 362 | <DropdownMenuItem |
| 363 | onClick={deleteProject} |
| 364 | disabled={projectId === undefined} |
| 365 | className="cursor-pointer hover:bg-gray-200" |
| 366 | > |
| 367 | Delete project |
| 368 | </DropdownMenuItem> |
| 369 | </DropdownMenuGroup> |
| 370 | </DropdownMenuContent> |
| 371 | </DropdownMenu> |
| 372 | </div> |
| 373 | <ImportModal open={showImportModal} onOpenChange={setShowImportModal} /> |
| gio | 1037ee2 | 2025-06-26 09:25:43 +0000 | [diff] [blame] | 374 | <Dialog open={showResourcesModal} onOpenChange={setShowResourcesModal}> |
| 375 | <DialogContent className="sm:max-w-md"> |
| 376 | <DialogHeader> |
| 377 | <DialogTitle>Add Resources</DialogTitle> |
| 378 | </DialogHeader> |
| 379 | <div className="py-4"> |
| 380 | <Resources onResourceAdded={() => setShowResourcesModal(false)} /> |
| 381 | </div> |
| 382 | </DialogContent> |
| 383 | </Dialog> |
| gio | 8e74dc0 | 2025-06-13 10:19:26 +0000 | [diff] [blame] | 384 | </> |
| gio | 818da4e | 2025-05-12 14:45:35 +0000 | [diff] [blame] | 385 | ); |
| 386 | } |
| gio | f8acc61 | 2025-04-26 08:20:55 +0400 | [diff] [blame] | 387 | } |