chore: 统一为简体中文
This commit is contained in:
@@ -90,7 +90,7 @@ export default function App() {
|
||||
if (re.code == 401)
|
||||
loginDialogRef.current!.open = true
|
||||
else if (re.code != 200) {
|
||||
if (checkApiSuccessOrSncakbar(re, "驗證失敗")) return
|
||||
if (checkApiSuccessOrSncakbar(re, "验证失败")) return
|
||||
} else if (re.code == 200) {
|
||||
setMyUserProfileCache(Client.myUserProfile as User)
|
||||
}
|
||||
@@ -201,7 +201,7 @@ export default function App() {
|
||||
textAlign: 'center',
|
||||
alignSelf: 'center',
|
||||
}}>
|
||||
選擇以開始對話...
|
||||
选择以开始对话......
|
||||
</div>
|
||||
}
|
||||
{
|
||||
|
||||
@@ -92,7 +92,7 @@ export default function AppMobile() {
|
||||
if (re.code == 401)
|
||||
loginDialogRef.current!.open = true
|
||||
else if (re.code != 200) {
|
||||
if (checkApiSuccessOrSncakbar(re, "驗證失敗")) return
|
||||
if (checkApiSuccessOrSncakbar(re, "验证失败")) return
|
||||
} else if (re.code == 200) {
|
||||
setMyUserProfileCache(Client.myUserProfile as User)
|
||||
}
|
||||
@@ -191,8 +191,8 @@ export default function AppMobile() {
|
||||
}}>
|
||||
<mdui-top-app-bar-title>{
|
||||
({
|
||||
Recents: "最近對話",
|
||||
Contacts: "所有對話"
|
||||
Recents: "最近对话",
|
||||
Contacts: "所有对话"
|
||||
})[navigationItemSelected]
|
||||
}</mdui-top-app-bar-title>
|
||||
<div style={{
|
||||
@@ -234,8 +234,8 @@ export default function AppMobile() {
|
||||
position: 'sticky',
|
||||
bottom: '0',
|
||||
}}>
|
||||
<mdui-navigation-bar-item icon="watch_later--outlined" active-icon="watch_later--filled" value="Recents">最近</mdui-navigation-bar-item>
|
||||
<mdui-navigation-bar-item icon="chat--outlined" active-icon="chat--filled" value="Contacts">對話</mdui-navigation-bar-item>
|
||||
<mdui-navigation-bar-item icon="watch_later--outlined" active-icon="watch_later--filled" value="Recents">最近对话</mdui-navigation-bar-item>
|
||||
<mdui-navigation-bar-item icon="chat--outlined" active-icon="chat--filled" value="Contacts">所有对话</mdui-navigation-bar-item>
|
||||
</mdui-navigation-bar>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -52,7 +52,7 @@ const markedInstance = new marked.Marked({
|
||||
export default function ChatFragment({ target, showReturnButton, onReturnButtonClicked, openChatInfoDialog, openUserInfoDialog, ...props }: Args) {
|
||||
const [messagesList, setMessagesList] = React.useState([] as Message[])
|
||||
const [chatInfo, setChatInfo] = React.useState({
|
||||
title: '加載中...'
|
||||
title: '加载中...'
|
||||
} as Chat)
|
||||
|
||||
const [tabItemSelected, setTabItemSelected] = React.useState('None')
|
||||
@@ -68,7 +68,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
||||
target: target,
|
||||
})
|
||||
if (re.code != 200)
|
||||
return target != '' && checkApiSuccessOrSncakbar(re, "對話錯誤")
|
||||
return target != '' && checkApiSuccessOrSncakbar(re, "获取对话信息失败")
|
||||
setChatInfo(re.data as Chat)
|
||||
|
||||
await loadMore()
|
||||
@@ -90,7 +90,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
||||
page: page.current,
|
||||
})
|
||||
|
||||
if (checkApiSuccessOrSncakbar(re, "拉取歷史記錄失敗")) return
|
||||
if (checkApiSuccessOrSncakbar(re, "拉取对话记录失败")) return
|
||||
const returnMsgs = (re.data!.messages as Message[]).reverse()
|
||||
page.current++
|
||||
if (returnMsgs.length == 0) {
|
||||
@@ -150,7 +150,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
||||
target,
|
||||
data: cachedFiles.current[fileName],
|
||||
}, 5000)
|
||||
if (checkApiSuccessOrSncakbar(re, `文件[${fileName}] 上傳失敗`)) return setIsMessageSending(false)
|
||||
if (checkApiSuccessOrSncakbar(re, `文件[${fileName}] 上传失败`)) return setIsMessageSending(false)
|
||||
text = text.replaceAll('(' + fileName + ')', '(' + re.data!.file_path as string + ')')
|
||||
}
|
||||
}
|
||||
@@ -160,12 +160,12 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
||||
target,
|
||||
text,
|
||||
}, 5000)
|
||||
if (checkApiSuccessOrSncakbar(re, "發送失敗")) return setIsMessageSending(false)
|
||||
if (checkApiSuccessOrSncakbar(re, "发送失败")) return setIsMessageSending(false)
|
||||
inputRef.current!.value = ''
|
||||
cachedFiles.current = {}
|
||||
} catch (e) {
|
||||
snackbar({
|
||||
message: '發送失敗: ' + (e as Error).message,
|
||||
message: '发送失败: ' + (e as Error).message,
|
||||
placement: 'top',
|
||||
})
|
||||
}
|
||||
@@ -188,7 +188,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
||||
cachedFiles.current[name] = await data.arrayBuffer()
|
||||
cachedFileNamesCount.current[name] = 1
|
||||
if (type.startsWith('image/'))
|
||||
insertText(``)
|
||||
insertText(``)
|
||||
else if (type.startsWith('video/'))
|
||||
insertText(``)
|
||||
else
|
||||
@@ -227,7 +227,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
||||
<mdui-tab value="Chat">{
|
||||
chatInfo.title
|
||||
}</mdui-tab>
|
||||
<mdui-tab value="Settings">設定</mdui-tab>
|
||||
<mdui-tab value="Settings">设置</mdui-tab>
|
||||
<mdui-tab value="None" style={{ display: 'none' }}></mdui-tab>
|
||||
<div style={{
|
||||
flexGrow: '1',
|
||||
@@ -265,7 +265,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
||||
<span style={{
|
||||
alignSelf: 'center',
|
||||
paddingLeft: '12px',
|
||||
}}>加載中...</span>
|
||||
}}>加载中...</span>
|
||||
</div>
|
||||
<div style={{
|
||||
display: showNoMoreMessagesTip ? undefined : 'none',
|
||||
@@ -372,7 +372,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
||||
addFile(type as string, getFileNameOrRandom(url), re)
|
||||
} catch (e) {
|
||||
snackbar({
|
||||
message: '無法解析連結: ' + (e as Error).message,
|
||||
message: '无法解析链接: ' + (e as Error).message,
|
||||
placement: 'top',
|
||||
})
|
||||
}
|
||||
@@ -385,7 +385,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
||||
}
|
||||
}
|
||||
}}>
|
||||
<mdui-text-field variant="outlined" placeholder="喵呜~" autosize ref={inputRef as any} max-rows={6} onChange={() => {
|
||||
<mdui-text-field variant="outlined" placeholder="(。・ω・。)" autosize ref={inputRef as any} max-rows={6} onChange={() => {
|
||||
if (inputRef.current?.value.trim() == '')
|
||||
cachedFiles.current = {}
|
||||
}} onKeyDown={(event) => {
|
||||
@@ -415,7 +415,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
||||
<div style={{
|
||||
display: 'none'
|
||||
}}>
|
||||
<input accept="*/*" type="file" name="選擇附加文檔" multiple ref={attachFileInputRef}></input>
|
||||
<input accept="*/*" type="file" name="添加文件" multiple ref={attachFileInputRef}></input>
|
||||
</div>
|
||||
</div>
|
||||
</mdui-tab-panel>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Dropdown, Dialog } from "mdui"
|
||||
import { Dropdown, Dialog, dialog } from "mdui"
|
||||
import { $ } from "mdui/jq"
|
||||
import Client from "../../api/Client.ts"
|
||||
import Data_Message from "../../api/client_data/Message.ts"
|
||||
@@ -131,9 +131,9 @@ export default function Message({ userId, rawData, renderHTML, message, openUser
|
||||
e.stopPropagation()
|
||||
setDropDownOpen(false)
|
||||
}}>
|
||||
<mdui-menu-item icon="content_copy" onClick={() => copyToClipboard($(dropDownRef.current as HTMLElement).find('#msg').text().trim())}>複製文字</mdui-menu-item>
|
||||
<mdui-menu-item icon="content_copy" onClick={() => copyToClipboard(rawData)}>複製原文</mdui-menu-item>
|
||||
<mdui-menu-item icon="info" onClick={() => messageJsonDialogRef.current!.open = true}>查看詳情</mdui-menu-item>
|
||||
<mdui-menu-item icon="content_copy" onClick={() => copyToClipboard($(dropDownRef.current as HTMLElement).find('#msg').text().trim())}>复制文字</mdui-menu-item>
|
||||
<mdui-menu-item icon="content_copy" onClick={() => copyToClipboard(rawData)}>复制原文</mdui-menu-item>
|
||||
<mdui-menu-item icon="info" onClick={() => messageJsonDialogRef.current!.open = true}>JSON</mdui-menu-item>
|
||||
</mdui-menu>
|
||||
</mdui-dropdown>
|
||||
</mdui-card>
|
||||
|
||||
@@ -20,10 +20,10 @@ customElements.define('chat-image', class extends HTMLElement {
|
||||
e.onerror = () => {
|
||||
const src = $(this).attr('src')
|
||||
$(this).html(`<mdui-icon name="broken_image" style="font-size: 2rem;"></mdui-icon>`)
|
||||
$(this).attr('alt', '無法加載圖像')
|
||||
$(this).attr('alt', '无法加载: ' + $(this).attr('alt'))
|
||||
$(this).on('click', () => {
|
||||
snackbar({
|
||||
message: `圖片 (${src}) 無法加載!`,
|
||||
message: `图片 (${src}) 无法加载!`,
|
||||
placement: 'top'
|
||||
})
|
||||
})
|
||||
|
||||
@@ -6,7 +6,7 @@ customElements.define('chat-video', class extends HTMLElement {
|
||||
}
|
||||
connectedCallback() {
|
||||
this.style.display = 'block'
|
||||
const e = new DOMParser().parseFromString(`<video controls>視頻無法播放</video>`, 'text/html').body.firstChild as HTMLVideoElement
|
||||
const e = new DOMParser().parseFromString(`<video controls></video>`, 'text/html').body.firstChild as HTMLVideoElement
|
||||
e.style.width = "100%"
|
||||
e.style.height = "100%"
|
||||
e.style.borderRadius = "var(--mdui-shape-corner-medium)"
|
||||
|
||||
@@ -35,8 +35,8 @@ export default function AddContactDialog({
|
||||
}
|
||||
|
||||
return (
|
||||
<mdui-dialog close-on-overlay-click close-on-esc headline="添加對話" ref={addContactDialogRef}>
|
||||
<mdui-text-field clearable label="对话 ID / 用戶 ID / 用戶名" ref={inputTargetRef as any} onKeyDown={(event) => {
|
||||
<mdui-dialog close-on-overlay-click close-on-esc headline="添加对话" ref={addContactDialogRef}>
|
||||
<mdui-text-field clearable label="对话 ID / 用户 ID / 用户名" ref={inputTargetRef as any} onKeyDown={(event) => {
|
||||
if (event.key == 'Enter')
|
||||
addContact()
|
||||
}}></mdui-text-field>
|
||||
|
||||
@@ -26,7 +26,7 @@ export default function ChatInfoDialog({ chat, chatInfoDialogRef, openChatFragme
|
||||
target: chat.id,
|
||||
})
|
||||
if (re.code != 200)
|
||||
return checkApiSuccessOrSncakbar(re, '獲取對話訊息失敗')
|
||||
return checkApiSuccessOrSncakbar(re, '获取对话信息失败')
|
||||
setChatInfo(re.data!.chat_info as Chat)
|
||||
})
|
||||
|
||||
|
||||
@@ -32,20 +32,20 @@ export default function LoginDialog({
|
||||
password: CryptoJS.SHA256(password).toString(CryptoJS.enc.Hex),
|
||||
})
|
||||
|
||||
if (checkApiSuccessOrSncakbar(re, "登錄失敗")) return
|
||||
if (checkApiSuccessOrSncakbar(re, "登录失败")) return
|
||||
|
||||
data.access_token = re.data!.access_token as string
|
||||
data.apply()
|
||||
location.reload()
|
||||
})
|
||||
return (
|
||||
<mdui-dialog headline="登錄" ref={loginDialogRef}>
|
||||
<mdui-dialog headline="登录" ref={loginDialogRef}>
|
||||
|
||||
<mdui-text-field label="用戶 ID / 用戶名" ref={loginInputAccountRef as any}></mdui-text-field>
|
||||
<mdui-text-field label="用户 ID / 用户名" ref={loginInputAccountRef as any}></mdui-text-field>
|
||||
<div style={{
|
||||
height: "10px",
|
||||
}}></div>
|
||||
<mdui-text-field label="密碼" type="password" toggle-password ref={loginInputPasswordRef as any}></mdui-text-field>
|
||||
<mdui-text-field label="密码" type="password" toggle-password ref={loginInputPasswordRef as any}></mdui-text-field>
|
||||
|
||||
<mdui-button slot="action" variant="text" ref={registerButtonRef}>注册</mdui-button>
|
||||
<mdui-button slot="action" variant="text" ref={loginButtonRef}>登录</mdui-button>
|
||||
|
||||
@@ -30,9 +30,9 @@ export default function MyProfileDialog({
|
||||
avatar: file
|
||||
})
|
||||
|
||||
if (checkApiSuccessOrSncakbar(re, "修改失敗")) return
|
||||
if (checkApiSuccessOrSncakbar(re, "修改失败")) return
|
||||
snackbar({
|
||||
message: "修改成功 (刷新頁面以更新)",
|
||||
message: "修改成功 (刷新页面以更新)",
|
||||
placement: "top",
|
||||
})
|
||||
})
|
||||
@@ -74,8 +74,8 @@ export default function MyProfileDialog({
|
||||
marginBottom: "10px",
|
||||
}}></mdui-divider>
|
||||
<mdui-list-item icon="logout" rounded onClick={() => dialog({
|
||||
headline: "退出登錄",
|
||||
description: "確定要退出登錄嗎? (若您的賬號未設定 用戶名, 請無務必複製 用戶 ID, 以免丟失賬號!)",
|
||||
headline: "退出登录",
|
||||
description: "请确保在退出登录前, 设定了用户名或者已经记录下了用户 ID, 以免无法登录账号",
|
||||
actions: [
|
||||
{
|
||||
text: "取消",
|
||||
@@ -84,7 +84,7 @@ export default function MyProfileDialog({
|
||||
},
|
||||
},
|
||||
{
|
||||
text: "確定",
|
||||
text: "确定",
|
||||
onClick: () => {
|
||||
data.access_token = ''
|
||||
data.apply()
|
||||
@@ -93,7 +93,7 @@ export default function MyProfileDialog({
|
||||
},
|
||||
}
|
||||
],
|
||||
})}>退出登錄</mdui-list-item>
|
||||
})}>退出登录</mdui-list-item>
|
||||
</mdui-list>
|
||||
</mdui-dialog>
|
||||
{
|
||||
@@ -103,7 +103,7 @@ export default function MyProfileDialog({
|
||||
<div style={{
|
||||
display: "none"
|
||||
}}>
|
||||
<input type="file" name="選擇頭像" ref={chooseAvatarFileRef}
|
||||
<input type="file" name="选择头像" ref={chooseAvatarFileRef}
|
||||
accept="image/*" />
|
||||
</div>
|
||||
|
||||
@@ -115,7 +115,7 @@ export default function MyProfileDialog({
|
||||
width: '50px',
|
||||
height: '50px',
|
||||
}} />
|
||||
<mdui-text-field variant="outlined" placeholder="昵稱" ref={editNickNameRef as any} style={{
|
||||
<mdui-text-field variant="outlined" placeholder="昵称" ref={editNickNameRef as any} style={{
|
||||
marginLeft: "15px",
|
||||
}} value={user?.nickname}></mdui-text-field>
|
||||
</div>
|
||||
@@ -123,12 +123,12 @@ export default function MyProfileDialog({
|
||||
marginTop: "10px",
|
||||
}}></mdui-divider>
|
||||
|
||||
<mdui-text-field style={{ marginTop: "10px", }} variant="outlined" label="用戶 ID" value={user?.id || ''} readonly onClick={(e) => {
|
||||
<mdui-text-field style={{ marginTop: "10px", }} variant="outlined" label="用户 ID" value={user?.id || ''} readonly onClick={(e) => {
|
||||
const input = e.target as HTMLInputElement
|
||||
input.select()
|
||||
input.setSelectionRange(0, 1145141919810)
|
||||
}}></mdui-text-field>
|
||||
<mdui-text-field style={{ marginTop: "20px", }} variant="outlined" label="用戶名" value={user?.username || ''} ref={editUserNameRef as any}></mdui-text-field>
|
||||
<mdui-text-field style={{ marginTop: "20px", }} variant="outlined" label="用户名" value={user?.username || ''} ref={editUserNameRef as any}></mdui-text-field>
|
||||
|
||||
<mdui-button slot="action" variant="text" onClick={() => userProfileEditDialogRef.current!.open = false}>取消</mdui-button>
|
||||
<mdui-button slot="action" variant="text" onClick={async () => {
|
||||
@@ -138,9 +138,9 @@ export default function MyProfileDialog({
|
||||
username: editUserNameRef.current?.value,
|
||||
})
|
||||
|
||||
if (checkApiSuccessOrSncakbar(re, "修改失敗")) return
|
||||
if (checkApiSuccessOrSncakbar(re, "修改失败")) return
|
||||
snackbar({
|
||||
message: "修改成功 (刷新頁面以更新)",
|
||||
message: "修改成功 (刷新页面以更新)",
|
||||
placement: "top",
|
||||
})
|
||||
userProfileEditDialogRef.current!.open = false
|
||||
|
||||
@@ -34,7 +34,7 @@ export default function RegisterDialog({
|
||||
password: CryptoJS.SHA256(registerInputPasswordRef.current!.value).toString(CryptoJS.enc.Hex),
|
||||
})
|
||||
|
||||
if (checkApiSuccessOrSncakbar(re, "注冊失敗")) return
|
||||
if (checkApiSuccessOrSncakbar(re, "注册失败")) return
|
||||
loginInputAccountRef.current!.value = username == "" ? re.data!.userid as string : username
|
||||
loginInputPasswordRef.current!.value = registerInputPasswordRef.current!.value
|
||||
|
||||
@@ -43,25 +43,25 @@ export default function RegisterDialog({
|
||||
registerInputPasswordRef.current!.value = ""
|
||||
registerDialogRef.current!.open = false
|
||||
snackbar({
|
||||
message: "注冊成功!",
|
||||
message: "注册成功!",
|
||||
placement: "top",
|
||||
})
|
||||
})
|
||||
return (
|
||||
<mdui-dialog headline="注冊" ref={registerDialogRef}>
|
||||
<mdui-dialog headline="注册" ref={registerDialogRef}>
|
||||
|
||||
<mdui-text-field label="用戶名 (可選)" ref={registerInputUserNameRef as any}></mdui-text-field>
|
||||
<mdui-text-field label="用户名 (可选)" ref={registerInputUserNameRef as any}></mdui-text-field>
|
||||
<div style={{
|
||||
height: "10px",
|
||||
}}></div>
|
||||
<mdui-text-field label="昵稱" ref={registerInputNickNameRef as any}></mdui-text-field>
|
||||
<mdui-text-field label="昵称" ref={registerInputNickNameRef as any}></mdui-text-field>
|
||||
<div style={{
|
||||
height: "10px",
|
||||
}}></div>
|
||||
<mdui-text-field label="密码" type="password" toggle-password ref={registerInputPasswordRef as any}></mdui-text-field>
|
||||
|
||||
<mdui-button slot="action" variant="text" ref={registerBackButtonRef}>返回</mdui-button>
|
||||
<mdui-button slot="action" variant="text" ref={doRegisterButtonRef}>注冊</mdui-button>
|
||||
<mdui-button slot="action" variant="text" ref={doRegisterButtonRef}>注册</mdui-button>
|
||||
</mdui-dialog>
|
||||
)
|
||||
}
|
||||
@@ -38,7 +38,7 @@ export default function ContactsList({
|
||||
token: data.access_token,
|
||||
})
|
||||
if (re.code != 200)
|
||||
return checkApiSuccessOrSncakbar(re, "获取對話列表失败")
|
||||
return checkApiSuccessOrSncakbar(re, "获取所有对话列表失败")
|
||||
|
||||
setContactsList(re.data!.contacts_list as Chat[])
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export default function ContactsList({
|
||||
<mdui-list-item rounded style={{
|
||||
width: '100%',
|
||||
marginTop: '13px',
|
||||
}} icon="person_add" onClick={() => addContactDialogRef.current!.open = true}>添加對話</mdui-list-item>
|
||||
}} icon="person_add" onClick={() => addContactDialogRef.current!.open = true}>添加对话</mdui-list-item>
|
||||
<mdui-list-item rounded style={{
|
||||
width: '100%',
|
||||
}} icon="group_add" onClick={() => createGroupDialogRef.current!.open = true}>创建群组</mdui-list-item>
|
||||
|
||||
@@ -36,7 +36,7 @@ export default function RecentsList({
|
||||
token: data.access_token,
|
||||
})
|
||||
if (re.code != 200)
|
||||
return checkApiSuccessOrSncakbar(re, "获取最近對話列表失败")
|
||||
return checkApiSuccessOrSncakbar(re, "获取最近对话列表失败")
|
||||
|
||||
setRecentsList(re.data!.recent_chats as RecentChat[])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user