diff --git a/extensions/open-with-app/package-lock.json b/extensions/open-with-app/package-lock.json index b21727ea5af..28fc53c0434 100644 --- a/extensions/open-with-app/package-lock.json +++ b/extensions/open-with-app/package-lock.json @@ -2397,10 +2397,13 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/mkdirp": { "version": "0.5.5", @@ -5731,9 +5734,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true }, "mkdirp": { diff --git a/extensions/search-notion/package.json b/extensions/search-notion/package.json index 4811d6fdbbf..c56a4b21ca3 100644 --- a/extensions/search-notion/package.json +++ b/extensions/search-notion/package.json @@ -4,7 +4,7 @@ "description": "Search Notion pages and open visited ones faster. No admin access required.", "icon": "command-icon.png", "author": "reckoning-dev", - "version": "1.0.0", + "version": "1.1.0", "license": "MIT", "commands": [ { diff --git a/extensions/search-notion/src/common/View.tsx b/extensions/search-notion/src/common/View.tsx index 20bbd8f3b47..c59e54ccab0 100644 --- a/extensions/search-notion/src/common/View.tsx +++ b/extensions/search-notion/src/common/View.tsx @@ -1,6 +1,15 @@ -import { ActionPanel, CopyToClipboardAction, List, OpenInBrowserAction, Icon } from "@raycast/api"; +import { + ActionPanel, + CopyToClipboardAction, + List, + OpenInBrowserAction, + Icon, + OpenAction, + getApplications, Application +} from "@raycast/api"; import type { QueryResultItem } from "./notionApi"; import { useVisitedUrls } from "./useVisitedUrls"; +import {useEffect, useState} from "react"; type Props = { @@ -11,6 +20,28 @@ type Props = { throttle?: boolean; }; +function OpenFileAction(props: { fileId: string, onOpen: (target: string) => void}) { + const [desktopApp, setDesktopApp] = useState() + + useEffect(() => { + getApplications() + .then((apps) => apps.find((a) => a.bundleId === "notion.id")) + .then(setDesktopApp) + }, []) + + return desktopApp ? ( + props.onOpen(props.fileId)} + /> + ) : ( + props.onOpen(props.fileId)}/> + ) +} + export const View = ({ sectionNames, queryResults, isLoading, onSearchTextChange, throttle }: Props): JSX.Element => { const [urls, onOpen] = useVisitedUrls(); return ( @@ -26,14 +57,14 @@ export const View = ({ sectionNames, queryResults, isLoading, onSearchTextChange - - + + } /> diff --git a/extensions/search-notion/src/common/notionApi.ts b/extensions/search-notion/src/common/notionApi.ts index f68062d9e3b..21faf11d022 100644 --- a/extensions/search-notion/src/common/notionApi.ts +++ b/extensions/search-notion/src/common/notionApi.ts @@ -16,7 +16,7 @@ export type QueryResultItem = { id: string; title: string; subtitle: string; - url: string; + fileId: string; accessoryTitle: string; icon: string; }; @@ -32,7 +32,7 @@ const parseRepositoryItem = (data: any) => { id: `${item.id}`, title: `${reg_title}`, subtitle: '', - url: `https://www.notion.so/`+ `${item.id}`.replace(/-/g, ''), + fileId: `${item.id}`.replace(/-/g, ''), accessoryTitle: acc_title, icon: page_icon, };