Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRXN23-576] fixes updating description of a project #1642

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading