diff --git a/src/renderer/src/components/entry-column/context-menu.tsx b/src/renderer/src/components/entry-column/context-menu.tsx
index 73b332eff..fdda5e5ad 100644
--- a/src/renderer/src/components/entry-column/context-menu.tsx
+++ b/src/renderer/src/components/entry-column/context-menu.tsx
@@ -5,6 +5,7 @@ import {
ContextMenuTrigger,
} from "@renderer/components/ui/context-menu"
import { useEntryActions } from "@renderer/hooks/useEntryActions"
+import { EntriesResponse } from "@renderer/lib/types"
export const items = [
[
@@ -18,6 +19,11 @@ export const items = [
className: "i-mingcute-world-2-line",
action: "openInBrowser",
},
+ {
+ name: "Save Images to Eagle",
+ icon: "/eagle.svg",
+ action: "save-to-eagle",
+ },
{
name: "Share",
className: "i-mingcute-share-2-line",
@@ -27,17 +33,20 @@ export const items = [
]
export function EntryContextMenu({
+ entry,
view,
- url,
children,
}: {
+ entry: EntriesResponse[number]
view: number
- url?: string
children: React.ReactNode
}) {
- if (!url) return children
+ if (!entry?.url) return children
- const { execAction } = useEntryActions(url)
+ const { execAction } = useEntryActions({
+ url: entry.url,
+ images: entry.images,
+ })
return (
diff --git a/src/renderer/src/components/entry-content/index.tsx b/src/renderer/src/components/entry-content/index.tsx
index 77d44cf84..8efaacdd4 100644
--- a/src/renderer/src/components/entry-content/index.tsx
+++ b/src/renderer/src/components/entry-content/index.tsx
@@ -17,7 +17,7 @@ export function EntryContent({ entry }: { entry: ActivedEntry }) {
return (
<>
-
+
{items[view].map((item) => (
-
+
- execAction(item.action)}
- />
+ {item.icon ? (
+
execAction(item.action)}
+ />
+ ) : (
+ execAction(item.action)}
+ />
+ )}
{item.name}
diff --git a/src/renderer/src/hooks/useEntryActions.tsx b/src/renderer/src/hooks/useEntryActions.tsx
index a8d017670..2c761cb0b 100644
--- a/src/renderer/src/hooks/useEntryActions.tsx
+++ b/src/renderer/src/hooks/useEntryActions.tsx
@@ -1,7 +1,13 @@
import { useToast } from "@renderer/components/ui/use-toast"
import { useCallback } from "react"
-export const useEntryActions = (url: string) => {
+export const useEntryActions = ({
+ url,
+ images,
+}: {
+ url: string
+ images?: string[]
+}) => {
const { toast } = useToast()
const execAction = useCallback(
@@ -20,6 +26,28 @@ export const useEntryActions = (url: string) => {
case "share":
window.electron.ipcRenderer.send("share-url", url)
break
+ case "save-to-eagle":
+ window.electron.ipcRenderer.once(
+ "save-to-eagle-reply",
+ (_, response) => {
+ if (response?.status === "success") {
+ toast({
+ duration: 3000,
+ description: "Saved to Eagle.",
+ })
+ } else {
+ toast({
+ duration: 3000,
+ description: "Failed to save to Eagle.",
+ })
+ }
+ },
+ )
+ window.electron.ipcRenderer.send("save-to-eagle", {
+ url,
+ images,
+ })
+ break
}
},
[toast],