Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add 'contact us' in the menu -> help submenu #2454

Merged
merged 4 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 50 additions & 2 deletions packages/neuron-wallet/src/controllers/app/menu.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs'
import path from 'path'
import { app, shell, BrowserWindow, dialog, MenuItemConstructorOptions, Menu } from 'electron'
import { app, shell, clipboard, BrowserWindow, dialog, MenuItemConstructorOptions, Menu } from 'electron'
import { t } from 'i18next'
import { Subject } from 'rxjs'
import { throttleTime } from 'rxjs/operators'
Expand Down Expand Up @@ -31,7 +31,8 @@ enum ExternalURL {
Website = 'https://www.nervos.org/',
Repository = 'https://github.com/nervosnetwork/neuron',
Issues = 'https://github.com/nervosnetwork/neuron/issues',
Doc = 'https://docs.nervos.org/docs/basics/tools#neuron-wallet'
Doc = 'https://docs.nervos.org/docs/basics/tools#neuron-wallet',
MailUs = 'neuron@magickbase.com'
}

const separator: MenuItemConstructorOptions = {
Expand Down Expand Up @@ -400,6 +401,53 @@ const updateApplicationMenu = (mainWindow: BrowserWindow | null) => {
shell.openExternal(ExternalURL.Issues)
}
},
{
label: t('application-menu.help.contact-us'),
click: async () => {
const { response: methodId } = await dialog.showMessageBox(BrowserWindow.getFocusedWindow()!, {
type: 'info',
message: t(`messageBox.mail-us.message`),
buttons: [
t(`messageBox.button.discard`),
t(`messageBox.mail-us.copy-mail-addr`),
t(`messageBox.mail-us.open-client`)
],
defaultId: 1,
cancelId: 0
})

switch (methodId) {
case 1: {
clipboard.writeText(ExternalURL.MailUs)
return
}
case 2: {
try {
await shell.openExternal(
`mailto:${ExternalURL.MailUs}?body=${encodeURIComponent(
t('application-menu.help.contact-us-message') as string
)}`
)
} catch {
const { response: subMethodId } = await dialog.showMessageBox(BrowserWindow.getFocusedWindow()!, {
type: 'info',
message: t(`messageBox.mail-us.fail-message`),
buttons: [t(`messageBox.button.discard`), t(`messageBox.mail-us.copy-mail-addr`)],
defaultId: 1,
cancelId: 0
})
if (subMethodId === 1) {
clipboard.writeText(ExternalURL.MailUs)
}
}
return
}
default: {
return
}
}
}
},
{
label: t('application-menu.help.export-debug-info'),
click: () => {
Expand Down
10 changes: 10 additions & 0 deletions packages/neuron-wallet/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export default {
'nervos-website': 'Nervos Website',
'source-code': 'Source Code',
'report-issue': 'Report Issue',
'contact-us': 'Contact Us',
'contact-us-message':
'> Please append debug information exported by "Menu" -> "Help" -> "Export Debug Information".',
documentation: 'Documentation',
settings: 'Settings',
'export-debug-info': 'Export Debug Information'
Expand Down Expand Up @@ -195,6 +198,13 @@ export default {
'hard-fork-migrate': {
message:
'In order to adapt to the latest version of CKB, Neuron will resynchronize the data on the chain, and the whole synchronization may take a long time.'
},
'mail-us': {
message: 'Please mail us with debug information exported by "Menu" -> "Help" -> "Export Debug Information".',
'open-client': 'Open Mail Client',
'fail-message':
'Unable to launch mail client, please copy the mail address, append debug information exported by "Menu" -> "Help" -> "Export Debug Information" and send us.',
'copy-mail-addr': 'Copy mail address'
}
},
prompt: {
Expand Down
9 changes: 9 additions & 0 deletions packages/neuron-wallet/src/locales/zh-tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export default {
'nervos-website': 'Nervos 官方網站',
'source-code': '原始程式碼',
'report-issue': '回報問題',
'contact-us': '聯繫我們',
'contact-us-message': '> 請通過 "菜單" -> "幫助" -> "導出調試信息" 獲得 Neuron 的調試信息並附在郵件中.',
documentation: '使用說明',
settings: '設定',
'export-debug-info': '導出除錯信息'
Expand Down Expand Up @@ -185,6 +187,13 @@ export default {
},
'hard-fork-migrate': {
message: '為適配最新版本的 CKB 節點,Neuron 將會重新同步鏈上數據,整個同步可能時間較長'
},
'mail-us': {
message: '請將問題及調試信息通過郵件發給我們, 調試信息可以通過 "菜單" -> "幫助" -> "導出調試信息" 獲得',
'open-client': '打開郵件客戶端',
'fail-message':
'未能打開郵件客戶端, 請複製郵件地址, 並通過 "菜單" -> "幫助" -> "導出調試信息" 獲得 Neuron 的調試信息附在郵件中發送給我們',
'copy-mail-addr': '複製郵件地址'
}
},
prompt: {
Expand Down
9 changes: 9 additions & 0 deletions packages/neuron-wallet/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export default {
'nervos-website': 'Nervos 网站',
'source-code': '源代码',
'report-issue': '报告问题',
'contact-us': '联系我们',
'contact-us-message': '> 请通过 "菜单" -> "帮助" -> "导出调试信息" 获得 Neuron 的调试信息并附在邮件中.',
documentation: '使用文档',
settings: '设置',
'export-debug-info': '导出调试信息'
Expand Down Expand Up @@ -186,6 +188,13 @@ export default {
},
'hard-fork-migrate': {
message: '为适配最新版本的 CKB 节点,Neuron 将会重新同步链上数据,整个同步可能时间较长'
},
'mail-us': {
message: '请将问题及调试信息通过邮件发给我们, 调试信息可以通过 "菜单" -> "帮助" -> "导出调试信息" 获得',
'open-client': '打开邮件客户端',
'fail-message':
'未能打开邮件客户端, 请复制邮件地址, 并通过 "菜单" -> "帮助" -> "导出调试信息" 获得 Neuron 的调试信息附在邮件中发送给我们',
'copy-mail-addr': '复制邮件地址'
}
},
prompt: {
Expand Down