Rename "Save & Submit" to "Generate" (#396)

* Rename to generate

* edit view buttons reorder buttons and colors

---------

Co-authored-by: Jing Hua <tohjinghua123@gmail.com>
Co-authored-by: Jing Hua <59118459+ztjhz@users.noreply.github.com>
This commit is contained in:
Ayaka 2023-08-03 22:29:03 +08:00 committed by GitHub
parent 5b642f043f
commit d0ddcfea6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 40 additions and 41 deletions

View file

@ -1,6 +1,6 @@
{
"save": "Gem",
"saveAndSubmit": "Gem & Send",
"generate": "Generere",
"cancel": "Annuller",
"confirm": "Bekræft",
"warning": "Advarsel",

View file

@ -1,6 +1,6 @@
{
"save": "Speichern",
"saveAndSubmit": "Speichern & Absenden",
"generate": "Generieren",
"cancel": "Abbrechen",
"confirm": "Bestätigen",
"warning": "Achtung",

View file

@ -1,6 +1,6 @@
{
"save": "Save",
"saveAndSubmit": "Save & Submit",
"generate": "Generate",
"cancel": "Cancel",
"confirm": "Confirm",
"warning": "Warning",

View file

@ -1,6 +1,6 @@
{
"save": "Save",
"saveAndSubmit": "Save & Submit",
"generate": "Generate",
"cancel": "Cancel",
"confirm": "Confirm",
"warning": "Warning",

View file

@ -1,6 +1,6 @@
{
"save": "Guardar",
"saveAndSubmit": "Guardar y enviar",
"generate": "Generar",
"cancel": "Cancelar",
"confirm": "Aceptar",
"warning": "Aviso",

View file

@ -1,6 +1,6 @@
{
"save": "Enregistrer",
"saveAndSubmit": "Enregistrer et Soumettre",
"generate": "Générer",
"cancel": "Annuler",
"confirm": "Confirmer",
"warning": "Attention",

View file

@ -1,6 +1,6 @@
{
"save": "Salva",
"saveAndSubmit": "Salva & Invia",
"generate": "Generare",
"cancel": "Annulla",
"confirm": "Conferma",
"warning": "Attenzione",

View file

@ -1,6 +1,6 @@
{
"save": "保存",
"saveAndSubmit": "保存して送信",
"generate": "生成",
"cancel": "キャンセル",
"confirm": "確認",
"warning": "警告",

View file

@ -1,6 +1,6 @@
{
"save": "Simpan",
"saveAndSubmit": "Simpan & Hantar",
"generate": "Hasilkan",
"cancel": "Batal",
"confirm": "Sahkan",
"warning": "Amaran",

View file

@ -1,6 +1,6 @@
{
"save": "Lagre",
"saveAndSubmit": "Lagre & Send inn",
"generate": "Generere",
"cancel": "Avbryt",
"confirm": "Bekreft",
"warning": "Advarsel",

View file

@ -1,6 +1,6 @@
{
"save": "Salvează",
"saveAndSubmit": "Salvați și trimiteți",
"generate": "Generează",
"cancel": "Anulează",
"confirm": "Confirmați",
"warning": "Avertisment",

View file

@ -1,6 +1,6 @@
{
"save": "Сохранить",
"saveAndSubmit": "Сохранить и отправить",
"generate": "Генерировать",
"cancel": "Отмена",
"confirm": "Подтвердить",
"warning": "Предупреждение",

View file

@ -1,6 +1,6 @@
{
"save": "Spara",
"saveAndSubmit": "Spara & Skicka in",
"generate": "Generera",
"cancel": "Avbryt",
"confirm": "Bekräfta",
"warning": "Varning",

View file

@ -1,6 +1,6 @@
{
"save": "保存",
"saveAndSubmit": "保存并提交",
"generate": "生成",
"cancel": "取消",
"confirm": "确认",
"warning": "警告",

View file

@ -1,6 +1,6 @@
{
"save": "儲存",
"saveAndSubmit": "儲存並提交",
"generate": "生成",
"cancel": "取消",
"confirm": "確認",
"warning": "警告",

View file

@ -1,6 +1,6 @@
{
"save": "儲存",
"saveAndSubmit": "儲存並提交",
"generate": "生成",
"cancel": "取消",
"confirm": "確認",
"warning": "警告",

View file

@ -46,7 +46,7 @@ const EditView = ({
if (e.ctrlKey && e.shiftKey) {
e.preventDefault();
handleSaveAndSubmit();
handleGenerate();
resetTextAreaHeight();
} else if (
(enterToSubmit && !e.shiftKey) ||
@ -54,7 +54,7 @@ const EditView = ({
) {
if (sticky) {
e.preventDefault();
handleSaveAndSubmit();
handleGenerate();
resetTextAreaHeight();
} else {
handleSave();
@ -81,7 +81,7 @@ const EditView = ({
};
const { handleSubmit } = useSubmit();
const handleSaveAndSubmit = () => {
const handleGenerate = () => {
if (useStore.getState().generating) return;
const updatedChats: ChatInterface[] = JSON.parse(
JSON.stringify(useStore.getState().chats)
@ -142,7 +142,7 @@ const EditView = ({
</div>
<EditViewButtons
sticky={sticky}
handleSaveAndSubmit={handleSaveAndSubmit}
handleGenerate={handleGenerate}
handleSave={handleSave}
setIsModalOpen={setIsModalOpen}
setIsEdit={setIsEdit}
@ -153,7 +153,7 @@ const EditView = ({
setIsModalOpen={setIsModalOpen}
title={t('warning') as string}
message={t('clearMessageWarning') as string}
handleConfirm={handleSaveAndSubmit}
handleConfirm={handleGenerate}
/>
)}
</>
@ -163,14 +163,14 @@ const EditView = ({
const EditViewButtons = memo(
({
sticky = false,
handleSaveAndSubmit,
handleGenerate,
handleSave,
setIsModalOpen,
setIsEdit,
_setContent,
}: {
sticky?: boolean;
handleSaveAndSubmit: () => void;
handleGenerate: () => void;
handleSave: () => void;
setIsModalOpen: React.Dispatch<React.SetStateAction<boolean>>;
setIsEdit: React.Dispatch<React.SetStateAction<boolean>>;
@ -188,11 +188,24 @@ const EditViewButtons = memo(
className={`btn relative mr-2 btn-primary ${
generating ? 'cursor-not-allowed opacity-40' : ''
}`}
onClick={handleSaveAndSubmit}
aria-label={t('saveAndSubmit') as string}
onClick={handleGenerate}
aria-label={t('generate') as string}
>
<div className='flex items-center justify-center gap-2'>
{t('saveAndSubmit')}
{t('generate')}
</div>
</button>
)}
{sticky || (
<button
className='btn relative mr-2 btn-primary'
onClick={() => {
!generating && setIsModalOpen(true);
}}
>
<div className='flex items-center justify-center gap-2'>
{t('generate')}
</div>
</button>
)}
@ -203,7 +216,7 @@ const EditViewButtons = memo(
? `btn-neutral ${
generating ? 'cursor-not-allowed opacity-40' : ''
}`
: 'btn-primary'
: 'btn-neutral'
}`}
onClick={handleSave}
aria-label={t('save') as string}
@ -213,20 +226,6 @@ const EditViewButtons = memo(
</div>
</button>
{sticky || (
<button
className='btn relative mr-2 btn-neutral'
onClick={() => {
!generating && setIsModalOpen(true);
}}
aria-label={t('saveAndSubmit') as string}
>
<div className='flex items-center justify-center gap-2'>
{t('saveAndSubmit')}
</div>
</button>
)}
{sticky || (
<button
className='btn relative btn-neutral'