1- import { selectProject , setActiveProject } from "@/src/reduxStore/states/project" ;
2- import { updateProjectNameAndDescriptionPost } from "@/src/services/base/project" ;
1+ import { selectAllProjects , selectProject , setActiveProject , setAllProjects } from "@/src/reduxStore/states/project" ;
2+ import { getAllProjects , updateProjectNameAndDescriptionPost } from "@/src/services/base/project" ;
33import { TOOLTIPS_DICT } from "@/src/util/tooltip-constants" ;
44import { Tooltip } from "@nextui-org/react" ;
55import { useRouter } from "next/router" ;
6- import { useState } from "react" ;
6+ import { use , useEffect , useMemo , useState } from "react" ;
77import { useDispatch , useSelector } from "react-redux" ;
88import { deleteProjectPost } from "@/src/services/base/project" ;
99import KernButton from "@/submodules/react-components/components/kern-button/KernButton" ;
@@ -14,6 +14,7 @@ export default function ProjectMetaData() {
1414 const dispatch = useDispatch ( ) ;
1515
1616 const project = useSelector ( selectProject ) ;
17+ const allProjects = useSelector ( selectAllProjects ) ;
1718
1819 const [ projectName , setProjectName ] = useState ( '' ) ;
1920 const [ projectDescription , setProjectDescription ] = useState ( '' ) ;
@@ -39,6 +40,14 @@ export default function ProjectMetaData() {
3940 } ) ;
4041 }
4142
43+ useEffect ( ( ) => {
44+ getAllProjects ( ( projects ) => dispatch ( setAllProjects ( projects ) ) ) ;
45+ } , [ ] ) ;
46+
47+ const isIntegrationProject = useMemo ( ( ) => {
48+ return allProjects && allProjects . some ( p => p . id === project . id && p . isIntegrationProject ) ;
49+ } , [ allProjects , project . id ] ) ;
50+
4251 return ( < div >
4352 < div className = "mt-8" >
4453 < div className = "text-gray-900 text-lg leading-6 font-medium" >
@@ -85,7 +94,7 @@ export default function ProjectMetaData() {
8594 < div className = "text-gray-900 text-lg leading-6 font-medium" > Danger zone</ div >
8695 < div className = "text-sm leading-5 font-normal mt-2 text-gray-500 inline-block" > This action can not be reversed.
8796 Are you sure you want to delete this project?</ div >
88- { project . is_integration_project && < div className = "text-sm text-red-500 italic" >
97+ { isIntegrationProject && < div className = "text-sm text-red-500 italic" >
8998 This is an integration project, please do not delete it unless the integration is deleted
9099 </ div > }
91100 < div className = "form-control" >
0 commit comments