-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from CambioML/jojo-branch
update for eps Rag, add delete Project
- Loading branch information
Showing
7 changed files
with
146 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import axios from 'axios'; | ||
|
||
interface IParams { | ||
userId: string; | ||
projectIds: string[]; | ||
} | ||
|
||
export const deleteProjects = async ({ userId, projectIds }: IParams) => { | ||
const data = { | ||
userId: userId, | ||
projectIds: projectIds, | ||
}; | ||
return await axios | ||
.post(process.env.NEXT_PUBLIC_PORTFOLIO_INSIGHT_API_URL + '/delete-projects', data) | ||
.then((response) => { | ||
return response.data; | ||
}) | ||
.catch((error) => { | ||
console.error('Error adding attribute. Please try again.'); | ||
throw error; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import useSustainabilityReportDeleteModal from '@/app/hooks/sustainabilityReport/useSustainabilityReportDeleteModal'; | ||
import { Project } from '@/app/types/SustainabilityReportTypes'; | ||
import { Typography } from '@material-tailwind/react'; | ||
import { X } from '@phosphor-icons/react'; | ||
|
||
interface ProjectContainerProps { | ||
project: Project; | ||
} | ||
|
||
const ProjectContainer = ({ project }: ProjectContainerProps) => { | ||
const sustainabilityReportDeleteModal = useSustainabilityReportDeleteModal(); | ||
|
||
const handleDeleteProject = () => { | ||
console.log('Deleting project:', project.name); | ||
sustainabilityReportDeleteModal.setDeleteItem(project); | ||
sustainabilityReportDeleteModal.onOpen(); | ||
}; | ||
return ( | ||
<div className="relative px-2 py-1 w-full overflow-hidden flex items-center justify-center group"> | ||
<Typography variant="paragraph" color="blue-gray" className="font-normal w-full overflow-auto text-nowrap pr-10"> | ||
{project.name} | ||
</Typography> | ||
<div | ||
onClick={handleDeleteProject} | ||
className="absolute right-2 p-2 rounded-md cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity duration-300 hover:bg-blue-gray-50" | ||
> | ||
<X size={16} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProjectContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters