mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 01:21:48 +03:00
feat: add 2 save buttons on Brain management tab (#1039)
* add 2 save buttons * use translation
This commit is contained in:
parent
f1d6b7892c
commit
d7a508acdd
@ -15,6 +15,7 @@ import {
|
||||
paidModels,
|
||||
} from "@/lib/context/BrainConfigProvider/types";
|
||||
import { defineMaxTokens } from "@/lib/helpers/defineMaxTokens";
|
||||
import { SaveButton } from "@/shared/SaveButton";
|
||||
|
||||
import { PublicPrompts } from "./components/PublicPrompts/PublicPrompts";
|
||||
import { useSettingsTab } from "./hooks/useSettingsTab";
|
||||
@ -140,6 +141,9 @@ export const SettingsTab = ({ brainId }: SettingsTabProps): JSX.Element => {
|
||||
{...register("maxTokens")}
|
||||
/>
|
||||
</fieldset>
|
||||
<div className="flex w-full justify-end py-4">
|
||||
<SaveButton handleSubmit={handleSubmit} />
|
||||
</div>
|
||||
<Divider text={t("customPromptSection", { ns: "config" })} />
|
||||
<PublicPrompts onSelect={pickPublicPrompt} />
|
||||
<Field
|
||||
@ -156,6 +160,9 @@ export const SettingsTab = ({ brainId }: SettingsTabProps): JSX.Element => {
|
||||
className="flex-1"
|
||||
{...register("prompt.content")}
|
||||
/>
|
||||
<div className="flex w-full justify-end py-4">
|
||||
<SaveButton handleSubmit={handleSubmit} />
|
||||
</div>
|
||||
{promptId !== "" && (
|
||||
<Button disabled={isUpdating} onClick={() => void removeBrainPrompt()}>
|
||||
{t("removePrompt", { ns: "config" })}
|
||||
|
@ -43,5 +43,6 @@
|
||||
"comingSoon": "Coming soon",
|
||||
"Viewer": "Viewer",
|
||||
"Editor": "Editor",
|
||||
"Owner": "Owner"
|
||||
"Owner": "Owner",
|
||||
"saveButton": "Save"
|
||||
}
|
@ -43,5 +43,6 @@
|
||||
"Upload": "Subir",
|
||||
"uploadButton": "Subir",
|
||||
"uploadingButton": "Subiendo...",
|
||||
"Viewer": "Espectador"
|
||||
"Viewer": "Espectador",
|
||||
"saveButton": "Guardar"
|
||||
}
|
@ -43,5 +43,6 @@
|
||||
"comingSoon": "Bientôt disponible",
|
||||
"Viewer": "Visualiseur",
|
||||
"Editor": "Éditeur",
|
||||
"Owner": "Propriétaire"
|
||||
"Owner": "Propriétaire",
|
||||
"saveButton": "Sauvegarder"
|
||||
}
|
@ -43,5 +43,6 @@
|
||||
"comingSoon": "Em breve",
|
||||
"Viewer": "Visualizador",
|
||||
"Editor": "Editor",
|
||||
"Owner": "Proprietário"
|
||||
"Owner": "Proprietário",
|
||||
"saveButton": "Salvar"
|
||||
}
|
@ -43,5 +43,6 @@
|
||||
"comingSoon": "Скоро",
|
||||
"Viewer": "Просмотр",
|
||||
"Editor": "Редактор",
|
||||
"Owner": "Владелец"
|
||||
"Owner": "Владелец",
|
||||
"saveButton": "Сохранить"
|
||||
}
|
||||
|
@ -43,5 +43,6 @@
|
||||
"comingSoon": "即将推出",
|
||||
"Viewer": "查看",
|
||||
"Editor": "编辑",
|
||||
"Owner": "作者"
|
||||
"Owner": "作者",
|
||||
"saveButton": "保存"
|
||||
}
|
21
frontend/shared/SaveButton.tsx
Normal file
21
frontend/shared/SaveButton.tsx
Normal file
@ -0,0 +1,21 @@
|
||||
import { ReactElement } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
|
||||
interface Props {
|
||||
handleSubmit: (checkDirty: boolean) => Promise<void>;
|
||||
}
|
||||
export const SaveButton = ({ handleSubmit }: Props): ReactElement => {
|
||||
const { t } = useTranslation(["translation"]);
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant={"primary"}
|
||||
onClick={() => void handleSubmit(true)}
|
||||
type="button"
|
||||
>
|
||||
{t("saveButton")}
|
||||
</Button>
|
||||
);
|
||||
};
|
Loading…
Reference in New Issue
Block a user