feat: add context specific search and actions (#1570)

This commit is contained in:
Meier Lukas
2024-12-06 19:07:27 +01:00
committed by GitHub
parent aaa3e7ce0c
commit c840ff85bc
18 changed files with 517 additions and 183 deletions

View File

@@ -8,6 +8,7 @@ import combineClasses from "clsx";
import { clientApi } from "@homarr/api/client";
import { parseAppHrefWithVariablesClient } from "@homarr/common/client";
import { useRegisterSpotlightContextResults } from "@homarr/spotlight";
import { useI18n } from "@homarr/translation/client";
import type { WidgetComponentProps } from "../definition";
@@ -28,6 +29,24 @@ export default function AppWidget({ options, isEditMode }: WidgetComponentProps<
retry: false,
},
);
useRegisterSpotlightContextResults(
`app-${app.id}`,
[
{
id: app.id,
name: app.name,
icon: app.iconUrl,
interaction() {
return {
type: "link",
href: parseAppHrefWithVariablesClient(app.href ?? ""),
newTab: options.openInNewTab,
};
},
},
],
[app, options.openInNewTab],
);
return (
<AppLink