Skip to content

Commit

Permalink
fixes updating description of a project
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgnlez committed Feb 1, 2024
1 parent c7c1eb0 commit 873fb31
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 4 additions & 2 deletions app/layout/project/sidebar/header/title/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const EditableTitle = ({
title: string;
description?: string;
className?: HTMLAttributes<HTMLDivElement>['className'];
onEditTitle: (newName: string) => void;
onEditTitle: (
newName: Parameters<ComponentProps<typeof FormRFF<FormFields>>['onSubmit']>[0]
) => void;
}): JSX.Element => {
const { query } = useRouter();
const { pid } = query as { pid: string };
Expand All @@ -40,7 +42,7 @@ const EditableTitle = ({
const handleSubmit = useCallback(
(data: Parameters<ComponentProps<typeof FormRFF<FormFields>>['onSubmit']>[0]) => {
titleInputRef.current?.blur();
onEditTitle(data.name);
onEditTitle(data);
setEditting(false);
},
[onEditTitle, titleInputRef]
Expand Down
10 changes: 4 additions & 6 deletions app/layout/project/sidebar/project/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ const InventoryProjectHeader = (): JSX.Element => {
},
});

const onEditProjectName = useCallback(
(newName: Parameters<ComponentProps<typeof Title>['onEditTitle']>[0]) => {
const onEditInfo = useCallback(
(data: Parameters<ComponentProps<typeof Title>['onEditTitle']>[0]) => {
saveProjectMutation.mutate(
{
id: pid,
data: {
name: newName,
},
data,
},
{
onSuccess: async () => {
Expand All @@ -47,7 +45,7 @@ const InventoryProjectHeader = (): JSX.Element => {
return (
<div className="flex items-start justify-between">
<UnderModeration />
<Title title={name} description={description} onEditTitle={onEditProjectName} />
<Title title={name} description={description} onEditTitle={onEditInfo} />
<div className="mt-4 flex items-center space-x-5">
<Contributors />
<ProjectButton />
Expand Down
4 changes: 2 additions & 2 deletions app/layout/project/sidebar/scenario/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export const ScenarioHeader = (): JSX.Element => {
const { name, description } = scenarioQuery.data;

const onEditScenarioName = useCallback(
(newName: Parameters<ComponentProps<typeof Title>['onEditTitle']>[0]) => {
(data: Parameters<ComponentProps<typeof Title>['onEditTitle']>[0]) => {
saveScenarioMutation.mutate({
id: sid,
data: {
name: newName,
name: data.name,
},
});
},
Expand Down

0 comments on commit 873fb31

Please sign in to comment.