From 278b2cc62a251c535502ce5b5621f59d62dc21c3 Mon Sep 17 00:00:00 2001 From: Rahul Yadav Date: Fri, 30 Aug 2024 08:39:33 +0530 Subject: [PATCH] refactor: rename project hook --- src/components/project/NewProject/NewProject.tsx | 4 ++-- src/components/workspace/WorkSpace/WorkSpace.tsx | 4 ++-- .../workspace/project/ManageProject/ManageProject.tsx | 4 ++-- src/components/workspace/tree/FileTree/FileTree.tsx | 4 ++-- src/components/workspace/tree/FileTree/TreeNode.tsx | 4 ++-- src/hooks/projectV2.hooks.ts | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/project/NewProject/NewProject.tsx b/src/components/project/NewProject/NewProject.tsx index 7082b34..b15d560 100644 --- a/src/components/project/NewProject/NewProject.tsx +++ b/src/components/project/NewProject/NewProject.tsx @@ -1,6 +1,6 @@ import { Tooltip } from '@/components/ui'; import AppIcon, { AppIconType } from '@/components/ui/icon'; -import { useProjects } from '@/hooks/projectV2.hooks'; +import { useProject } from '@/hooks/projectV2.hooks'; import { ContractLanguage, ProjectTemplate, @@ -41,7 +41,7 @@ const NewProject: FC = ({ name, }) => { const [isActive, setIsActive] = useState(active); - const { createProject } = useProjects(); + const { createProject } = useProject(); const [isLoading, setIsLoading] = useState(false); const router = useRouter(); diff --git a/src/components/workspace/WorkSpace/WorkSpace.tsx b/src/components/workspace/WorkSpace/WorkSpace.tsx index ed9916c..28a1d77 100644 --- a/src/components/workspace/WorkSpace/WorkSpace.tsx +++ b/src/components/workspace/WorkSpace/WorkSpace.tsx @@ -3,7 +3,7 @@ import { ProjectTemplate } from '@/components/template'; import { AppConfig } from '@/config/AppConfig'; import { useLogActivity } from '@/hooks/logActivity.hooks'; -import { useProjects } from '@/hooks/projectV2.hooks'; +import { useProject } from '@/hooks/projectV2.hooks'; import { useWorkspaceActions } from '@/hooks/workspace.hooks'; import { Project, Tree } from '@/interfaces/workspace.interface'; import { Analytics } from '@/utility/analytics'; @@ -41,7 +41,7 @@ const WorkSpace: FC = () => { const [contract, setContract] = useState(''); const { tab } = router.query; - const { activeProject, newFileFolder } = useProjects(); + const { activeProject, newFileFolder } = useProject(); const activeFile = workspaceAction.activeFile(activeProject as string); diff --git a/src/components/workspace/project/ManageProject/ManageProject.tsx b/src/components/workspace/project/ManageProject/ManageProject.tsx index c07ce3f..8bb1107 100644 --- a/src/components/workspace/project/ManageProject/ManageProject.tsx +++ b/src/components/workspace/project/ManageProject/ManageProject.tsx @@ -1,7 +1,7 @@ import { NewProject } from '@/components/project'; import { Tooltip } from '@/components/ui'; import AppIcon from '@/components/ui/icon'; -import { useProjects } from '@/hooks/projectV2.hooks'; +import { useProject } from '@/hooks/projectV2.hooks'; import { Project } from '@/interfaces/workspace.interface'; import { Button, Modal, Select, message } from 'antd'; import { FC, useEffect, useState } from 'react'; @@ -11,7 +11,7 @@ const ManageProject: FC = () => { const [isDeleteConfirmOpen, setIsDeleteConfirmOpen] = useState(false); const { projects, setActiveProject, deleteProject, activeProject } = - useProjects(); + useProject(); const projectHeader = () => ( <> diff --git a/src/components/workspace/tree/FileTree/FileTree.tsx b/src/components/workspace/tree/FileTree/FileTree.tsx index 584f64c..0171b43 100644 --- a/src/components/workspace/tree/FileTree/FileTree.tsx +++ b/src/components/workspace/tree/FileTree/FileTree.tsx @@ -1,4 +1,4 @@ -import { useProjects } from '@/hooks/projectV2.hooks'; +import { useProject } from '@/hooks/projectV2.hooks'; import { DropOptions, getBackendOptions, @@ -16,7 +16,7 @@ interface Props { } const FileTree: FC = ({ projectId }) => { - const { activeProject, projectFiles, moveItem } = useProjects(); + const { activeProject, projectFiles, moveItem } = useProject(); const getProjectFiles = (): NodeModel[] => { if (!activeProject) return []; diff --git a/src/components/workspace/tree/FileTree/TreeNode.tsx b/src/components/workspace/tree/FileTree/TreeNode.tsx index e89e8b4..d42931c 100644 --- a/src/components/workspace/tree/FileTree/TreeNode.tsx +++ b/src/components/workspace/tree/FileTree/TreeNode.tsx @@ -1,5 +1,5 @@ import { useLogActivity } from '@/hooks/logActivity.hooks'; -import { useProjects } from '@/hooks/projectV2.hooks'; +import { useProject } from '@/hooks/projectV2.hooks'; import { useWorkspaceActions } from '@/hooks/workspace.hooks'; import { Project, Tree } from '@/interfaces/workspace.interface'; import { fileTypeFromFileName } from '@/utility/utils'; @@ -34,7 +34,7 @@ const TreeNode: FC = ({ node, depth, isOpen, onToggle }) => { const { id: projectId } = router.query; const { openFile, isProjectEditable } = useWorkspaceActions(); - const { deleteProjectFile, renameProjectFile, newFileFolder } = useProjects(); + const { deleteProjectFile, renameProjectFile, newFileFolder } = useProject(); const { createLog } = useLogActivity(); const disallowedFile = [ diff --git a/src/hooks/projectV2.hooks.ts b/src/hooks/projectV2.hooks.ts index 94e1c60..df1568f 100644 --- a/src/hooks/projectV2.hooks.ts +++ b/src/hooks/projectV2.hooks.ts @@ -21,7 +21,7 @@ interface FileNode { parent?: string; } -export const useProjects = () => { +export const useProject = () => { const { projects, setProjects,