hide mobile submitkey

This commit is contained in:
jimengdie 2023-04-07 16:46:51 +08:00
parent f83859113e
commit 63659fe616
6 changed files with 60 additions and 33 deletions

View File

@ -26,7 +26,7 @@ import {
import { Avatar } from "./chat"; import { Avatar } from "./chat";
import Locale, { AllLangs, changeLang, getLang } from "../locales"; import Locale, { AllLangs, changeLang, getLang } from "../locales";
import { getCurrentVersion, getEmojiUrl } from "../utils"; import { getCurrentVersion, getEmojiUrl, isMobileScreen } from "../utils";
import Link from "next/link"; import Link from "next/link";
import { UPDATE_URL } from "../constant"; import { UPDATE_URL } from "../constant";
import { SearchService, usePromptStore } from "../store/prompt"; import { SearchService, usePromptStore } from "../store/prompt";
@ -231,6 +231,7 @@ export function Settings(props: { closeSettings: () => void }) {
)} )}
</SettingItem> </SettingItem>
{isMobileScreen() ? null : (
<SettingItem title={Locale.Settings.SendKey}> <SettingItem title={Locale.Settings.SendKey}>
<select <select
value={config.submitKey} value={config.submitKey}
@ -248,6 +249,7 @@ export function Settings(props: { closeSettings: () => void }) {
))} ))}
</select> </select>
</SettingItem> </SettingItem>
)}
<ListItem> <ListItem>
<div className={styles["settings-title"]}> <div className={styles["settings-title"]}>

View File

@ -1,4 +1,5 @@
import { SubmitKey } from "../store/app"; import { SubmitKey } from "../store/app";
import { isMobileScreen } from "../utils";
const cn = { const cn = {
WIP: "该功能仍在开发中……", WIP: "该功能仍在开发中……",
@ -21,10 +22,14 @@ const cn = {
Rename: "重命名对话", Rename: "重命名对话",
Typing: "正在输入…", Typing: "正在输入…",
Input: (submitKey: string) => { Input: (submitKey: string) => {
if (!isMobileScreen()) {
var inputHints = `输入消息,${submitKey} 发送`; var inputHints = `输入消息,${submitKey} 发送`;
if (submitKey === String(SubmitKey.Enter)) { if (submitKey === String(SubmitKey.Enter)) {
inputHints += "Shift + Enter 换行"; inputHints += "Shift + Enter 换行";
} }
} else {
var inputHints = "输入消息";
}
return inputHints; return inputHints;
}, },
Send: "发送", Send: "发送",

View File

@ -1,5 +1,6 @@
import { SubmitKey } from "../store/app"; import { SubmitKey } from "../store/app";
import type { LocaleType } from "./index"; import type { LocaleType } from "./index";
import { isMobileScreen } from "../utils";
const en: LocaleType = { const en: LocaleType = {
WIP: "WIP...", WIP: "WIP...",
@ -23,10 +24,14 @@ const en: LocaleType = {
Rename: "Rename Chat", Rename: "Rename Chat",
Typing: "Typing…", Typing: "Typing…",
Input: (submitKey: string) => { Input: (submitKey: string) => {
if (!isMobileScreen()) {
var inputHints = `Type something and press ${submitKey} to send`; var inputHints = `Type something and press ${submitKey} to send`;
if (submitKey === String(SubmitKey.Enter)) { if (submitKey === String(SubmitKey.Enter)) {
inputHints += ", press Shift + Enter to newline"; inputHints += ", press Shift + Enter to newline";
} }
} else {
var inputHints = "Type something";
}
return inputHints; return inputHints;
}, },
Send: "Send", Send: "Send",

View File

@ -1,5 +1,6 @@
import { SubmitKey } from "../store/app"; import { SubmitKey } from "../store/app";
import type { LocaleType } from "./index"; import type { LocaleType } from "./index";
import { isMobileScreen } from "../utils";
const es: LocaleType = { const es: LocaleType = {
WIP: "En construcción...", WIP: "En construcción...",
@ -23,10 +24,14 @@ const es: LocaleType = {
Rename: "Renombrar chat", Rename: "Renombrar chat",
Typing: "Escribiendo...", Typing: "Escribiendo...",
Input: (submitKey: string) => { Input: (submitKey: string) => {
if (!isMobileScreen()) {
var inputHints = `Escribe algo y presiona ${submitKey} para enviar`; var inputHints = `Escribe algo y presiona ${submitKey} para enviar`;
if (submitKey === String(SubmitKey.Enter)) { if (submitKey === String(SubmitKey.Enter)) {
inputHints += ", presiona Shift + Enter para nueva línea"; inputHints += ", presiona Shift + Enter para nueva línea";
} }
} else {
var inputHints = "Escribe algo";
}
return inputHints; return inputHints;
}, },
Send: "Enviar", Send: "Enviar",

View File

@ -1,5 +1,6 @@
import { SubmitKey } from "../store/app"; import { SubmitKey } from "../store/app";
import type { LocaleType } from "./index"; import type { LocaleType } from "./index";
import { isMobileScreen } from "../utils";
const it: LocaleType = { const it: LocaleType = {
WIP: "Work in progress...", WIP: "Work in progress...",
@ -23,10 +24,14 @@ const it: LocaleType = {
Rename: "Rinomina Chat", Rename: "Rinomina Chat",
Typing: "Typing…", Typing: "Typing…",
Input: (submitKey: string) => { Input: (submitKey: string) => {
if (!isMobileScreen()) {
var inputHints = `Scrivi qualcosa e premi ${submitKey} per inviare`; var inputHints = `Scrivi qualcosa e premi ${submitKey} per inviare`;
if (submitKey === String(SubmitKey.Enter)) { if (submitKey === String(SubmitKey.Enter)) {
inputHints += ", premi Shift + Enter per andare a capo"; inputHints += ", premi Shift + Enter per andare a capo";
} }
} else {
var inputHints = "Scrivi qualcosa";
}
return inputHints; return inputHints;
}, },
Send: "Invia", Send: "Invia",

View File

@ -1,5 +1,6 @@
import { SubmitKey } from "../store/app"; import { SubmitKey } from "../store/app";
import type { LocaleType } from "./index"; import type { LocaleType } from "./index";
import { isMobileScreen } from "../utils";
const tw: LocaleType = { const tw: LocaleType = {
WIP: "該功能仍在開發中……", WIP: "該功能仍在開發中……",
@ -22,10 +23,14 @@ const tw: LocaleType = {
Rename: "重命名對話", Rename: "重命名對話",
Typing: "正在輸入…", Typing: "正在輸入…",
Input: (submitKey: string) => { Input: (submitKey: string) => {
if (!isMobileScreen()) {
var inputHints = `輸入訊息後,按下 ${submitKey} 鍵即可發送`; var inputHints = `輸入訊息後,按下 ${submitKey} 鍵即可發送`;
if (submitKey === String(SubmitKey.Enter)) { if (submitKey === String(SubmitKey.Enter)) {
inputHints += "Shift + Enter 鍵換行"; inputHints += "Shift + Enter 鍵換行";
} }
} else {
var inputHints = "輸入訊息";
}
return inputHints; return inputHints;
}, },
Send: "發送", Send: "發送",