Skip to content

Commit

Permalink
Add keyboard shortcut info
Browse files Browse the repository at this point in the history
  • Loading branch information
krokosik committed Jan 19, 2024
1 parent 857b70f commit 8bd8891
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "last_snow",
"version": "0.4.3"
"version": "0.4.4"
},
"plugins": {
"fs": {
Expand Down
11 changes: 7 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
useRef,
useState,
} from "react";
import { ActionButton, LanguageDrawer } from "./components";
import { ActionButton, KeyboardHint, LanguageDrawer } from "./components";
import { DIM, LANGUAGES, LOGIC } from "./const";
import { info, warn } from "@tauri-apps/plugin-log";
import { Store } from "@tauri-apps/plugin-store";
Expand Down Expand Up @@ -191,9 +191,12 @@ export default function App() {
onCompositionEnd={() => setIsComposing(false)}
onKeyDown={suppressTab}
/>
<Text ml="auto">
{formik.values.text.length} / {max_len}
</Text>
<HStack justifyContent="space-between" alignItems="start">
<KeyboardHint language={formik.values.language} />
<Text>
{formik.values.text.length} / {max_len}
</Text>
</HStack>
</Flex>
</Container>
<VStack w={DIM.SIDE_BAR} h={DIM.HEIGHT} justifyContent="space-around">
Expand Down
23 changes: 23 additions & 0 deletions src/components/KeyboardHint.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Kbd, Text } from "@chakra-ui/react";

export const KeyboardHint = ({ language }: { language: string }) => {
console.log(language);

if (language === "jp") {
return (
<Text>
<Kbd>Ctrl</Kbd>+<Kbd>Shift</Kbd>+<Kbd>.</Kbd> - circle Kana mode{" "}
<Kbd>Space</Kbd> - circle suggestions
</Text>
);
} else if (language === "cn") {
return (
<Text>
<Kbd>Ctrl</Kbd>+<Kbd>Shift</Kbd>+<Kbd>f</Kbd> toggle
Traditional/Simplified Chinese
</Text>
);
}

return <Text></Text>;
};
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./ActionButton";
export * from "./KeyboardHint";
export * from "./LanguageButton";
export * from "./LanguageDrawer";

0 comments on commit 8bd8891

Please sign in to comment.