feat: add general assist feature and enhance shortcut management

- Introduced a new "General Assist" shortcut, allowing users to open SurfSense from anywhere.
- Updated shortcut management to include the new general assist functionality in both the desktop and web applications.
- Enhanced the UI to reflect changes in shortcut labels and descriptions for better clarity.
- Improved the Electron API to support the new shortcut configuration.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-04-07 03:42:46 -07:00
parent e574b5ec4a
commit 27e9e8d873
10 changed files with 159 additions and 33 deletions

View file

@ -2,7 +2,7 @@
import { IconBrandGoogleFilled } from "@tabler/icons-react";
import { useAtom } from "jotai";
import { Clipboard, Eye, EyeOff, Keyboard, Sparkles } from "lucide-react";
import { AppWindow, Clipboard, Eye, EyeOff, Keyboard, Sparkles } from "lucide-react";
import Image from "next/image";
import { useRouter } from "next/navigation";
import { useCallback, useEffect, useState } from "react";
@ -48,7 +48,7 @@ export default function DesktopLoginPage() {
}, [api]);
const updateShortcut = useCallback(
(key: "quickAsk" | "autocomplete", accelerator: string) => {
(key: "generalAssist" | "quickAsk" | "autocomplete", accelerator: string) => {
setShortcuts((prev) => {
const updated = { ...prev, [key]: accelerator };
api?.setShortcuts?.({ [key]: accelerator }).catch(() => {
@ -62,7 +62,7 @@ export default function DesktopLoginPage() {
);
const resetShortcut = useCallback(
(key: "quickAsk" | "autocomplete") => {
(key: "generalAssist" | "quickAsk" | "autocomplete") => {
updateShortcut(key, DEFAULT_SHORTCUTS[key]);
},
[updateShortcut]
@ -132,12 +132,21 @@ export default function DesktopLoginPage() {
<Keyboard className="size-3" />
Keyboard Shortcuts
</div>
<ShortcutRecorder
value={shortcuts.generalAssist}
onChange={(accel) => updateShortcut("generalAssist", accel)}
onReset={() => resetShortcut("generalAssist")}
defaultValue={DEFAULT_SHORTCUTS.generalAssist}
label="General Assist"
description="Open SurfSense from anywhere"
icon={AppWindow}
/>
<ShortcutRecorder
value={shortcuts.quickAsk}
onChange={(accel) => updateShortcut("quickAsk", accel)}
onReset={() => resetShortcut("quickAsk")}
defaultValue={DEFAULT_SHORTCUTS.quickAsk}
label="Quick Ask"
label="Quick Assist"
description="Copy selected text and ask AI about it"
icon={Clipboard}
/>
@ -146,8 +155,8 @@ export default function DesktopLoginPage() {
onChange={(accel) => updateShortcut("autocomplete", accel)}
onReset={() => resetShortcut("autocomplete")}
defaultValue={DEFAULT_SHORTCUTS.autocomplete}
label="Autocomplete"
description="Get AI writing suggestions from a screenshot"
label="Extreme Assist"
description="AI writing powered by your screen and knowledge base"
icon={Sparkles}
/>
<p className="text-[11px] text-muted-foreground text-center">