feat: added toggle for command pallete
This commit is contained in:
@@ -2,7 +2,7 @@ import i18n from "i18next";
|
|||||||
import { initReactI18next } from "react-i18next";
|
import { initReactI18next } from "react-i18next";
|
||||||
import LanguageDetector from "i18next-browser-languagedetector";
|
import LanguageDetector from "i18next-browser-languagedetector";
|
||||||
|
|
||||||
import enTranslation from "../locales/translated/en.json";
|
import enTranslation from "../locales/en.json";
|
||||||
import afTranslation from "../locales/translated/af.json";
|
import afTranslation from "../locales/translated/af.json";
|
||||||
import arTranslation from "../locales/translated/ar.json";
|
import arTranslation from "../locales/translated/ar.json";
|
||||||
import bnTranslation from "../locales/translated/bn.json";
|
import bnTranslation from "../locales/translated/bn.json";
|
||||||
|
|||||||
@@ -1971,7 +1971,9 @@
|
|||||||
"themeDark": "Dark",
|
"themeDark": "Dark",
|
||||||
"themeSystem": "System",
|
"themeSystem": "System",
|
||||||
"appearanceDesc": "Select the color theme for the application",
|
"appearanceDesc": "Select the color theme for the application",
|
||||||
"terminalSyntaxHighlightingDesc": "Automatically highlight commands, paths, IPs, and log levels in terminal output"
|
"terminalSyntaxHighlightingDesc": "Automatically highlight commands, paths, IPs, and log levels in terminal output",
|
||||||
|
"enableCommandPaletteShortcut": "Enable Command Palette Shortcut",
|
||||||
|
"enableCommandPaletteShortcutDesc": "Double-tap left Shift to open the Command Palette for quick access to hosts"
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"failedToLoadVersionInfo": "Failed to load version information"
|
"failedToLoadVersionInfo": "Failed to load version information"
|
||||||
|
|||||||
@@ -87,6 +87,11 @@ function AppContent() {
|
|||||||
if (event.repeat) {
|
if (event.repeat) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const shortcutEnabled =
|
||||||
|
localStorage.getItem("commandPaletteShortcutEnabled") !== "false";
|
||||||
|
if (!shortcutEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
if (now - lastShiftPressTime.current < 300) {
|
if (now - lastShiftPressTime.current < 300) {
|
||||||
setIsCommandPaletteOpen((isOpen) => !isOpen);
|
setIsCommandPaletteOpen((isOpen) => !isOpen);
|
||||||
|
|||||||
@@ -136,6 +136,11 @@ export function UserProfile({
|
|||||||
const [disableUpdateCheck, setDisableUpdateCheck] = useState<boolean>(
|
const [disableUpdateCheck, setDisableUpdateCheck] = useState<boolean>(
|
||||||
localStorage.getItem("disableUpdateCheck") === "true",
|
localStorage.getItem("disableUpdateCheck") === "true",
|
||||||
);
|
);
|
||||||
|
const [commandPaletteShortcutEnabled, setCommandPaletteShortcutEnabled] =
|
||||||
|
useState<boolean>(() => {
|
||||||
|
const saved = localStorage.getItem("commandPaletteShortcutEnabled");
|
||||||
|
return saved !== null ? saved === "true" : true;
|
||||||
|
});
|
||||||
const [userRoles, setUserRoles] = useState<UserRole[]>([]);
|
const [userRoles, setUserRoles] = useState<UserRole[]>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -220,6 +225,11 @@ export function UserProfile({
|
|||||||
localStorage.setItem("disableUpdateCheck", enabled.toString());
|
localStorage.setItem("disableUpdateCheck", enabled.toString());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCommandPaletteShortcutToggle = (enabled: boolean) => {
|
||||||
|
setCommandPaletteShortcutEnabled(enabled);
|
||||||
|
localStorage.setItem("commandPaletteShortcutEnabled", enabled.toString());
|
||||||
|
};
|
||||||
|
|
||||||
const handleDeleteAccount = async (e: React.FormEvent) => {
|
const handleDeleteAccount = async (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setDeleteLoading(true);
|
setDeleteLoading(true);
|
||||||
@@ -573,6 +583,20 @@ export function UserProfile({
|
|||||||
onCheckedChange={handleTerminalSyntaxHighlightingToggle}
|
onCheckedChange={handleTerminalSyntaxHighlightingToggle}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<Label className="text-foreground-secondary">
|
||||||
|
{t("profile.enableCommandPaletteShortcut")}
|
||||||
|
</Label>
|
||||||
|
<p className="text-sm text-muted-foreground mt-1">
|
||||||
|
{t("profile.enableCommandPaletteShortcutDesc")}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<Switch
|
||||||
|
checked={commandPaletteShortcutEnabled}
|
||||||
|
onCheckedChange={handleCommandPaletteShortcutToggle}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user