Skip to content

Commit 85a8710

Browse files
author
Magomed-Elbi_Dzhukalaev
committed
fix(chat): do not disable name and version when toolset logged in
1 parent c279ab1 commit 85a8710

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

apps/chat/src/components/ToolsetEditor/EditorForm/GeneralForm.tsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { useTranslation } from '@/src/hooks/useTranslation';
77
import { topicToOption } from '@/src/utils/app/application';
88
import { getLastPathSegment } from '@/src/utils/app/common';
99
import { preventEnterDown } from '@/src/utils/app/forms';
10-
import { isToolsetSignedIn } from '@/src/utils/app/toolsets';
1110

1211
import { ScreenState } from '@/src/types/common';
1312
import { ToolsetModel } from '@/src/types/toolsets';
@@ -59,20 +58,12 @@ export const GeneralForm = ({
5958
const screenState = useScreenState();
6059
const isMobileView = screenState === ScreenState.SM;
6160
const isEditing = !!toolset;
62-
const isLoggedIn = toolset && isToolsetSignedIn(toolset);
6361

6462
const { register, control } = useFormContext<ToolsetEditorForm>();
6563
const { errors, isValid } = useFormState<ToolsetEditorForm>({ control });
6664

6765
const topicOptions = useMemo(() => topics.map(topicToOption), [topics]);
6866

69-
const disabledReason = useMemo(() => {
70-
if (isToolsetPublic) return PUBLIC_TOOLSET_TOOLTIP;
71-
if (isLoggedIn) return t(CommonI18nKeys.LogOutBeforeEditingToolset);
72-
73-
return undefined;
74-
}, [isLoggedIn, isToolsetPublic, t]);
75-
7667
const getLogoId = useCallback(
7768
(filesIds: string[]) => files.find((f) => f.id === filesIds[0])?.id,
7869
[files],
@@ -97,9 +88,9 @@ export const GeneralForm = ({
9788
mandatory
9889
placeholder={t(CommonI18nKeys.TypeName)}
9990
id="name"
100-
disabled={!!disabledReason}
91+
disabled={isToolsetPublic}
10192
error={errors.name?.message}
102-
tooltip={disabledReason}
93+
tooltip={isToolsetPublic ? PUBLIC_TOOLSET_TOOLTIP : undefined}
10394
/>
10495
<Field
10596
{...register('version')}
@@ -108,8 +99,8 @@ export const GeneralForm = ({
10899
mandatory
109100
placeholder={DEFAULT_VERSION}
110101
id="version"
111-
disabled={!!disabledReason}
112-
tooltip={disabledReason}
102+
disabled={isToolsetPublic}
103+
tooltip={isToolsetPublic ? PUBLIC_TOOLSET_TOOLTIP : undefined}
113104
error={errors.version?.message}
114105
name="version"
115106
/>

0 commit comments

Comments
 (0)