Skip to content

Commit

Permalink
add coderabit suggetions
Browse files Browse the repository at this point in the history
  • Loading branch information
CREDO23 committed Nov 26, 2024
1 parent 7f54662 commit 6d23fc4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions apps/web/lib/features/project/create-project-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useOrganizationProjects } from '@/app/hooks';
import { IProject } from '@/app/interfaces';
import { Button, Card, InputField, Modal, Text } from 'lib/components';
import { useTranslations } from 'next-intl';
import { useCallback, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';

interface ICreateProjectModalProps {
open: boolean;
Expand All @@ -24,15 +24,24 @@ export function CreateProjectModal(props: ICreateProjectModalProps) {
const { createOrganizationProject, createOrganizationProjectLoading } = useOrganizationProjects();
const [name, setName] = useState('');

// Cleanup
useEffect(() => {
return () => {
setName('');
};
}, []);

const handleCreateProject = useCallback(async () => {
try {
if (name.trim() === '') {
return;
}
const data = await createOrganizationProject({ name });

if (data) {
onSuccess?.(data);
}

setName('');
closeModal();
} catch (error) {
console.error(error);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
"CLEAR_FILTER": "Clear Filter",
"CLEAR": "Clear",
"APPLY_FILTER": "Apply Filter",
"CREATE_NEW": "Crear nuevo"
"CREATE_NEW": "Create New"
},
"hotkeys": {
"HELP": "Help",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
"CLEAR_FILTER": "Borrar filtro",
"CLEAR": "Borrar",
"APPLY_FILTER": "Aplicar filtro",
"CREATE_NEW": "Create New"
"CREATE_NEW": "Crear nuevo"
},
"hotkeys": {
"HELP": "Ayuda",
Expand Down

0 comments on commit 6d23fc4

Please sign in to comment.