Skip to content

Commit

Permalink
refactor: rename project hook
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulyadav-57 committed Aug 30, 2024
1 parent e82cb2c commit 278b2cc
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/components/project/NewProject/NewProject.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -41,7 +41,7 @@ const NewProject: FC<Props> = ({
name,
}) => {
const [isActive, setIsActive] = useState(active);
const { createProject } = useProjects();
const { createProject } = useProject();
const [isLoading, setIsLoading] = useState(false);

const router = useRouter();
Expand Down
4 changes: 2 additions & 2 deletions src/components/workspace/WorkSpace/WorkSpace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -41,7 +41,7 @@ const WorkSpace: FC = () => {
const [contract, setContract] = useState<any>('');

const { tab } = router.query;
const { activeProject, newFileFolder } = useProjects();
const { activeProject, newFileFolder } = useProject();

const activeFile = workspaceAction.activeFile(activeProject as string);

Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -11,7 +11,7 @@ const ManageProject: FC = () => {
const [isDeleteConfirmOpen, setIsDeleteConfirmOpen] = useState(false);

const { projects, setActiveProject, deleteProject, activeProject } =
useProjects();
useProject();

const projectHeader = () => (
<>
Expand Down
4 changes: 2 additions & 2 deletions src/components/workspace/tree/FileTree/FileTree.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useProjects } from '@/hooks/projectV2.hooks';
import { useProject } from '@/hooks/projectV2.hooks';
import {
DropOptions,
getBackendOptions,
Expand All @@ -16,7 +16,7 @@ interface Props {
}

const FileTree: FC<Props> = ({ projectId }) => {
const { activeProject, projectFiles, moveItem } = useProjects();
const { activeProject, projectFiles, moveItem } = useProject();

const getProjectFiles = (): NodeModel[] => {
if (!activeProject) return [];
Expand Down
4 changes: 2 additions & 2 deletions src/components/workspace/tree/FileTree/TreeNode.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -34,7 +34,7 @@ const TreeNode: FC<Props> = ({ 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 = [
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/projectV2.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface FileNode {
parent?: string;
}

export const useProjects = () => {
export const useProject = () => {
const {
projects,
setProjects,
Expand Down

0 comments on commit 278b2cc

Please sign in to comment.