restructure note component

This commit is contained in:
Ren Amamiya
2023-06-20 09:01:48 +07:00
parent aa8531b32b
commit 9b84068e6d
22 changed files with 257 additions and 286 deletions

View File

@@ -11,7 +11,7 @@ import {
import { useActiveAccount } from "@stores/accounts";
import { useComposer } from "@stores/composer";
import { COMPOSE_SHORTCUT } from "@stores/shortcuts";
import { register } from "@tauri-apps/api/globalShortcut";
import { isRegistered, register } from "@tauri-apps/api/globalShortcut";
import { Fragment, useEffect } from "react";
export function Composer() {
@@ -26,14 +26,17 @@ export function Composer() {
};
const registerShortcut = async () => {
await register(COMPOSE_SHORTCUT, () => {
toggle(true);
});
const isShortcutRegistered = await isRegistered(COMPOSE_SHORTCUT);
if (!isShortcutRegistered) {
await register(COMPOSE_SHORTCUT, () => {
toggle(true);
});
}
};
useEffect(() => {
registerShortcut();
}, [registerShortcut]);
}, []);
return (
<>