make "deploy new relay" open the modal

This commit is contained in:
x032205
2025-10-17 23:25:48 -04:00
parent 0024013a8b
commit 4c1b13d959
3 changed files with 25 additions and 3 deletions
@@ -166,7 +166,7 @@ export const DeployGatewayModal = ({ isOpen, onOpenChange }: Props) => {
onChange={(newValue) => {
if ((newValue as SingleValue<{ id: string }>)?.id === "_create") {
navigate({
search: { selectedTab: "relays" }
search: (prev) => ({ ...prev, selectedTab: "relays", action: "deploy-relay" })
});
return;
}
@@ -1,4 +1,4 @@
import { useState } from "react";
import { useEffect, useState } from "react";
import {
faArrowUpRightFromSquare,
faBookOpen,
@@ -12,6 +12,7 @@ import {
faTrash
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { formatRelative } from "date-fns";
import { createNotification } from "@app/components/notifications";
@@ -36,6 +37,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
import {
OrgPermissionSubjects,
OrgRelayPermissionActions
@@ -75,6 +77,25 @@ export const RelayTab = withPermission(
"deployRelay"
] as const);
const action = useSearch({
from: ROUTE_PATHS.Organization.NetworkingPage.id,
select: (s) => s.action
});
const navigate = useNavigate({
from: ROUTE_PATHS.Organization.NetworkingPage.path
});
useEffect(() => {
if (action === "deploy-relay") {
handlePopUpOpen("deployRelay");
navigate({
search: (prev) => ({ ...prev, action: undefined }),
replace: true
});
}
}, [action]);
const deleteRelayById = useDeleteRelayById();
const handleDeleteRelay = async () => {
@@ -5,7 +5,8 @@ import { z } from "zod";
import { NetworkingPage } from "./NetworkingPage";
const NetworkingPageQueryParams = z.object({
selectedTab: z.string().catch("gateways")
selectedTab: z.string().catch("gateways"),
action: z.string().optional()
});
export const Route = createFileRoute(