summaryrefslogtreecommitdiff
path: root/extension/react-app/src/util/index.ts
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-07-15 15:06:32 -0700
committerNate Sesti <sestinj@gmail.com>2023-07-15 15:06:32 -0700
commit46883738a287a5eb1cfae71ab1f6127450f7554f (patch)
tree057ade81f0c5b218c36bd19c0932bd0ff8dbb1e6 /extension/react-app/src/util/index.ts
parent925c3e0ef45d9eb01a8f6c1efd239fa011492bd2 (diff)
downloadsncontinue-46883738a287a5eb1cfae71ab1f6127450f7554f.tar.gz
sncontinue-46883738a287a5eb1cfae71ab1f6127450f7554f.tar.bz2
sncontinue-46883738a287a5eb1cfae71ab1f6127450f7554f.zip
use correct label for meta key
Diffstat (limited to 'extension/react-app/src/util/index.ts')
-rw-r--r--extension/react-app/src/util/index.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/extension/react-app/src/util/index.ts b/extension/react-app/src/util/index.ts
index ad711321..c4168e13 100644
--- a/extension/react-app/src/util/index.ts
+++ b/extension/react-app/src/util/index.ts
@@ -1,6 +1,6 @@
type Platform = "mac" | "linux" | "windows" | "unknown";
-function getPlatform(): Platform {
+export function getPlatform(): Platform {
const platform = window.navigator.platform.toUpperCase();
if (platform.indexOf("MAC") >= 0) {
return "mac";
@@ -13,7 +13,7 @@ function getPlatform(): Platform {
}
}
-function isMetaEquivalentKeyPressed(event: {
+export function isMetaEquivalentKeyPressed(event: {
metaKey: boolean;
ctrlKey: boolean;
}): boolean {
@@ -28,3 +28,16 @@ function isMetaEquivalentKeyPressed(event: {
return event.metaKey;
}
}
+
+export function getMetaKeyLabel(): string {
+ const platform = getPlatform();
+ switch (platform) {
+ case "mac":
+ return "⌘";
+ case "linux":
+ case "windows":
+ return "^";
+ default:
+ return "⌘";
+ }
+}