feat: modernize widget experience

This commit is contained in:
Thomas Camlong authored and ajnart committed 2026-08-13 19:54:48 +02:00
1 parent 6331c88911
commit 1fa345edd1
165 files changed
+3698 -1649

No files matched your search

@@ -1,5 +1,6 @@
import { Spotlight } from "@mantine/spotlight";
import { getSafeApplicationUrl, SAFE_NEW_TAB_REL } from "@homarr/common";
import { Link } from "@homarr/ui";
import type { inferSearchInteractionOptions } from "../../../lib/interaction";
@@ -15,10 +16,18 @@ interface ChildrenActionItemProps {
export const ChildrenActionItem = ({ childrenOptions, action, query, setChildrenOptions }: ChildrenActionItemProps) => {
const interaction = action.useInteraction(childrenOptions.option, query);
const safeHref = interaction.type === "link" ? getSafeApplicationUrl(interaction.href) : undefined;
const renderRoot =
interaction.type === "link"
interaction.type === "link" && safeHref
? (props: Record<string, unknown>) => {
return <Link href={interaction.href} target={interaction.newTab ? "_blank" : undefined} {...props} />;
return (
<Link
href={safeHref}
target={interaction.newTab ? "_blank" : undefined}
rel={interaction.newTab ? SAFE_NEW_TAB_REL : undefined}
{...props}
/>
);
}
: undefined;
@@ -2,6 +2,7 @@ import { Spotlight } from "@mantine/spotlight";
import type { TranslationObject } from "@homarr/translation";
import { Link } from "@homarr/ui";
import { getSafeApplicationUrl, SAFE_NEW_TAB_REL } from "@homarr/common";
import type { SearchGroup } from "../../../lib/group";
import type { inferSearchInteractionOptions } from "../../../lib/interaction";
@@ -30,10 +31,18 @@ export const SpotlightGroupActionItem = <TOption extends Record<string, unknown>
const { key: _reactKey, ...optionProps } = option as unknown as { key?: unknown } & Record<string, unknown>;
const safeHref = interaction.type === "link" ? getSafeApplicationUrl(interaction.href) : undefined;
const renderRoot =
interaction.type === "link"
interaction.type === "link" && safeHref
? (props: Record<string, unknown>) => {
return <Link href={interaction.href} target={interaction.newTab ? "_blank" : undefined} {...props} />;
return (
<Link
href={safeHref}
target={interaction.newTab ? "_blank" : undefined}
rel={interaction.newTab ? SAFE_NEW_TAB_REL : undefined}
{...props}
/>
);
}
: undefined;