diff --git a/apps/app/components/project/sidebar-list.tsx b/apps/app/components/project/sidebar-list.tsx index 34735bb36..c36696460 100644 --- a/apps/app/components/project/sidebar-list.tsx +++ b/apps/app/components/project/sidebar-list.tsx @@ -64,7 +64,7 @@ export const ProjectSidebarList: FC = () => { workspaceSlug ? PROJECTS_LIST(workspaceSlug as string) : null, () => (workspaceSlug ? projectService.getProjects(workspaceSlug as string) : null) ); - const normalProjects = projects?.filter((p) => !p.is_favourite) ?? []; + const normalProjects = projects?.filter((p) => !p.is_favorite) ?? []; const handleCopyText = (projectId: string) => { const originURL = diff --git a/apps/app/components/project/single-project-card.tsx b/apps/app/components/project/single-project-card.tsx index 99ee69793..c689d2acd 100644 --- a/apps/app/components/project/single-project-card.tsx +++ b/apps/app/components/project/single-project-card.tsx @@ -46,11 +46,11 @@ export const SingleProjectCard: React.FC = ({ project.id ); - const handleAddToFavourites = () => { + const handleAddToFavorites = () => { if (!workspaceSlug) return; projectService - .addProjectToFavourites(workspaceSlug as string, { + .addProjectToFavorites(workspaceSlug as string, { project: project.id, }) .then(() => { @@ -59,7 +59,7 @@ export const SingleProjectCard: React.FC = ({ (prevData) => (prevData ?? []).map((p) => ({ ...p, - is_favourite: p.id === project.id ? true : p.is_favourite, + is_favorite: p.id === project.id ? true : p.is_favorite, })), false ); @@ -68,30 +68,30 @@ export const SingleProjectCard: React.FC = ({ setToastAlert({ type: "success", title: "Success!", - message: "Successfully added the project to favourites.", + message: "Successfully added the project to favorites.", }); }) .catch(() => { setToastAlert({ type: "error", title: "Error!", - message: "Couldn't remove the project from favourites. Please try again.", + message: "Couldn't remove the project from favorites. Please try again.", }); }); }; - const handleRemoveFromFavourites = () => { + const handleRemoveFromFavorites = () => { if (!workspaceSlug || !project) return; projectService - .removeProjectFromFavourites(workspaceSlug as string, project.id) + .removeProjectFromFavorites(workspaceSlug as string, project.id) .then(() => { mutate( PROJECTS_LIST(workspaceSlug as string), (prevData) => (prevData ?? []).map((p) => ({ ...p, - is_favourite: p.id === project.id ? false : p.is_favourite, + is_favorite: p.id === project.id ? false : p.is_favorite, })), false ); @@ -104,14 +104,14 @@ export const SingleProjectCard: React.FC = ({ setToastAlert({ type: "success", title: "Success!", - message: "Successfully removed the project from favourites.", + message: "Successfully removed the project from favorites.", }); }) .catch(() => { setToastAlert({ type: "error", title: "Error!", - message: "Couldn't remove the project from favourites. Please try again.", + message: "Couldn't remove the project from favorites. Please try again.", }); }); }; @@ -163,7 +163,7 @@ export const SingleProjectCard: React.FC = ({ ) : ( Member )} - {project.is_favourite && ( + {project.is_favorite && ( @@ -212,13 +212,13 @@ export const SingleProjectCard: React.FC = ({ Delete project )} - {project.is_favourite ? ( - - Remove from favourites + {project.is_favorite ? ( + + Remove from favorites ) : ( - - Add to favourites + + Add to favorites )} diff --git a/apps/app/services/project.service.ts b/apps/app/services/project.service.ts index a6603b458..cb280596e 100644 --- a/apps/app/services/project.service.ts +++ b/apps/app/services/project.service.ts @@ -258,28 +258,28 @@ class ProjectServices extends APIService { } async getFavoriteProjects(workspaceSlug: string): Promise { - return this.get(`/api/workspaces/${workspaceSlug}/user-favourite-projects/`) + return this.get(`/api/workspaces/${workspaceSlug}/user-favorite-projects/`) .then((response) => response?.data) .catch((error) => { throw error?.response?.data; }); } - async addProjectToFavourites( + async addProjectToFavorites( workspaceSlug: string, data: { project: string; } ): Promise { - return this.post(`/api/workspaces/${workspaceSlug}/user-favourite-projects/`, data) + return this.post(`/api/workspaces/${workspaceSlug}/user-favorite-projects/`, data) .then((response) => response?.data) .catch((error) => { throw error?.response?.data; }); } - async removeProjectFromFavourites(workspaceSlug: string, projectId: string): Promise { - return this.delete(`/api/workspaces/${workspaceSlug}/user-favourite-projects/${projectId}/`) + async removeProjectFromFavorites(workspaceSlug: string, projectId: string): Promise { + return this.delete(`/api/workspaces/${workspaceSlug}/user-favorite-projects/${projectId}/`) .then((response) => response?.data) .catch((error) => { throw error?.response?.data; diff --git a/apps/app/types/projects.d.ts b/apps/app/types/projects.d.ts index 92b3a6fc3..a25f26a26 100644 --- a/apps/app/types/projects.d.ts +++ b/apps/app/types/projects.d.ts @@ -10,7 +10,7 @@ export interface IProject { icon: string; id: string; identifier: string; - is_favourite: boolean; + is_favorite: boolean; module_view: boolean; name: string; network: number;