mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-01-13 01:12:59 +01:00
refs #4653 Add account switching shortcut
This commit is contained in:
parent
49f0cd2937
commit
5e7cbbb0a1
@ -25,6 +25,7 @@
|
||||
"flowbite-react": "^0.7.0",
|
||||
"megalodon": "^9.1.1",
|
||||
"react-blurhash": "^0.3.0",
|
||||
"react-hotkeys-hook": "^4.4.1",
|
||||
"react-icons": "^4.11.0",
|
||||
"react-intl": "^6.5.1",
|
||||
"react-virtuoso": "^4.6.2",
|
||||
|
@ -9,6 +9,7 @@ import { FormattedMessage, useIntl } from 'react-intl'
|
||||
import generateNotification from '@/utils/notification'
|
||||
import generator, { Entity, WebSocketInterface } from 'megalodon'
|
||||
import { Context } from '@/utils/i18n'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
|
||||
type LayoutProps = {
|
||||
children: React.ReactNode
|
||||
@ -24,6 +25,15 @@ export default function Layout({ children }: LayoutProps) {
|
||||
const { formatMessage } = useIntl()
|
||||
const streamings = useRef<Array<WebSocketInterface>>([])
|
||||
|
||||
for (let i = 1; i < 9; i++) {
|
||||
useHotkeys(`ctrl+${i}`, () => {
|
||||
const acct = accounts[i - 1]
|
||||
if (acct && acct.id) {
|
||||
router.push(`/accounts/${acct.id}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
loadSettings()
|
||||
const fn = async () => {
|
||||
|
@ -7095,6 +7095,11 @@ react-dom@^18.2.0:
|
||||
loose-envify "^1.1.0"
|
||||
scheduler "^0.23.0"
|
||||
|
||||
react-hotkeys-hook@^4.4.1:
|
||||
version "4.4.1"
|
||||
resolved "https://registry.yarnpkg.com/react-hotkeys-hook/-/react-hotkeys-hook-4.4.1.tgz#1f7a7a1c9c21d4fa3280bf340fcca8fd77d81994"
|
||||
integrity sha512-sClBMBioFEgFGYLTWWRKvhxcCx1DRznd+wkFHwQZspnRBkHTgruKIHptlK/U/2DPX8BhHoRGzpMVWUXMmdZlmw==
|
||||
|
||||
react-icons@^4.11.0:
|
||||
version "4.12.0"
|
||||
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.12.0.tgz#54806159a966961bfd5cdb26e492f4dafd6a8d78"
|
||||
|
Loading…
Reference in New Issue
Block a user