mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-09-07 08:26:15 +00:00
- Mobile responsive - new toast design - web document render issue fix - posthog analytics - ui improvements
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { usePromise } from "@raycast/utils"
|
|
import { fetchSettings } from "./api"
|
|
import {
|
|
Action,
|
|
ActionPanel,
|
|
Detail,
|
|
Icon,
|
|
List,
|
|
openExtensionPreferences,
|
|
} from "@raycast/api"
|
|
import type { ComponentType } from "react"
|
|
|
|
export function withSupermemory<P extends object>(Component: ComponentType<P>) {
|
|
return function SupermemoryWrappedComponent(props: P) {
|
|
const { isLoading, data } = usePromise(fetchSettings, [], {
|
|
failureToastOptions: {
|
|
title: "Invalid API Key",
|
|
message:
|
|
"Invalid API key. Please check your API key in preferences. Get a new one from https://supermemory.link/raycast",
|
|
},
|
|
})
|
|
|
|
if (!data) {
|
|
return isLoading ? (
|
|
<Detail isLoading />
|
|
) : (
|
|
<List>
|
|
<List.EmptyView
|
|
icon={Icon.ExclamationMark}
|
|
title="API Key Required"
|
|
description="Please configure your Supermemory API key to search memories"
|
|
actions={
|
|
<ActionPanel>
|
|
<Action
|
|
title="Open Extension Preferences"
|
|
onAction={openExtensionPreferences}
|
|
icon={Icon.Gear}
|
|
/>
|
|
</ActionPanel>
|
|
}
|
|
/>
|
|
</List>
|
|
)
|
|
}
|
|
|
|
return <Component {...props} />
|
|
}
|
|
}
|