feat: Add fullscreen mode notification with localized message

This commit is contained in:
ousugo 2025-02-25 13:11:35 +08:00 committed by 亢奋猫
parent 68df5cd211
commit 26dd931f70
6 changed files with 30 additions and 5 deletions

View File

@ -1,6 +1,8 @@
import '@renderer/databases'
import store, { persistor } from '@renderer/store'
import { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import { Provider } from 'react-redux'
import { HashRouter, Route, Routes } from 'react-router-dom'
import { PersistGate } from 'redux-persist/integration/react'
@ -21,6 +23,24 @@ import SettingsPage from './pages/settings/SettingsPage'
import TranslatePage from './pages/translate/TranslatePage'
function App(): JSX.Element {
const { t } = useTranslation()
useEffect(() => {
const cleanup = window.electron.ipcRenderer.on('fullscreen-status-changed', (_, isFullscreen) => {
if (isFullscreen) {
window.message.info({
content: t('common.fullscreen'),
duration: 3,
key: 'fullscreen-notification'
})
}
})
return () => {
cleanup()
}
}, [t])
return (
<Provider store={store}>
<ThemeProvider>

View File

@ -190,7 +190,8 @@
"select": "Select",
"topics": "Topics",
"warning": "Warning",
"you": "You"
"you": "You",
"fullscreen": "Entered fullscreen mode. Press F11 to exit"
},
"docs": {
"title": "Docs"

View File

@ -190,7 +190,8 @@
"select": "選択",
"topics": "トピック",
"warning": "警告",
"you": "あなた"
"you": "あなた",
"fullscreen": "全画面モードに入りました。F11キーで終了します"
},
"docs": {
"title": "ドキュメント"

View File

@ -190,7 +190,8 @@
"select": "Выбрать",
"topics": "Топики",
"warning": "Предупреждение",
"you": "Вы"
"you": "Вы",
"fullscreen": "Вы вошли в полноэкранный режим. Нажмите F11 для выхода"
},
"docs": {
"title": "Документация"

View File

@ -190,7 +190,8 @@
"select": "选择",
"topics": "话题",
"warning": "警告",
"you": "用户"
"you": "用户",
"fullscreen": "已进入全屏模式,按 F11 退出"
},
"docs": {
"title": "帮助文档"

View File

@ -190,7 +190,8 @@
"select": "選擇",
"topics": "話題",
"warning": "警告",
"you": "您"
"you": "您",
"fullscreen": "已進入全螢幕模式,按 F11 退出"
},
"docs": {
"title": "幫助文件"