Skip to content

Commit

Permalink
fix: close preject options
Browse files Browse the repository at this point in the history
  • Loading branch information
bugwheels94 committed Jan 12, 2024
1 parent 453d44d commit 3d1d636
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/super-terminal.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>Super Terminal</title>
</head>
<body>
<div id="root"></div>
Expand Down
20 changes: 16 additions & 4 deletions ui/src/pages/Project/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ function ProjectPage({ project, projectId }: { project: Project; projectId: numb
}, [queryClient, project.id]);
const { data: runningProjects } = useGetRunningProjects();

const { mutate: deleteProjectRunningStatus } = useDeleteProjectRunningStatus(project.id);

const data = useMemo(
() =>
[
Expand Down Expand Up @@ -291,12 +293,22 @@ function ProjectPage({ project, projectId }: { project: Project; projectId: numb
}, 0);
},
},

...(project.slug !== ''
? [
{
heading: 'Global Actions',
title: 'Close Project',
icon: <BsFolderX style={{ verticalAlign: 'middle' }} />,
onClick: () => {
deleteProjectRunningStatus();
navigate('/');
},
},

{
heading: 'Global Actions',
title: <>Switch to Untitled Project</>,
icon: <BsFolderX style={{ verticalAlign: 'middle' }} />,
onClick: () => {
navigate('/');
},
Expand Down Expand Up @@ -594,8 +606,8 @@ function ManageProject({
currentProjectId: number;
setContextMenuPosition: (_: Position | null) => void;
}) {
const { mutateAsync } = useDeleteProject(project.id);
const { mutateAsync: deleteProjectRunningStatus } = useDeleteProjectRunningStatus(project.id);
const { mutate } = useDeleteProject(project.id);
const { mutate: deleteProjectRunningStatus } = useDeleteProjectRunningStatus(project.id);
const [isModalOpen, setIsModalOpen] = useState(false);
const navigate = useNavigate();
//* reloading cause the context menu is not behaving */
Expand Down Expand Up @@ -635,7 +647,7 @@ function ManageProject({
title="Are you sure you want to delete the project?"
onCancel={() => setIsModalOpen(false)}
onOk={() => {
mutateAsync();
mutate();
setIsModalOpen(false);
}}
></Modal>
Expand Down

0 comments on commit 3d1d636

Please sign in to comment.