Skip to content

Commit dc50cfb

Browse files
committed
feat(notification): link to Node
1 parent a269e5f commit dc50cfb

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

src/api.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,14 @@
55
--color-log-info: var(--color-green-500);
66
--color-log-warn: var(--color-orange-500);
77
--color-log-error: var(--color-red-500);
8+
9+
--animate-highlight: highlight 1.25s ease-in-out;
10+
@keyframes highlight {
11+
0%, 100% {
12+
box-shadow: 0 0 0 var(--color-surface-100);
13+
}
14+
50% {
15+
box-shadow: 0 0 3em var(--color-surface-100);
16+
}
17+
}
818
}

src/lib/components/node/Node.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import NodeLogLevel from "$lib/components/node/NodeLogLevel.svelte";
1717
import DeleteButton from "$lib/components/delete/DeleteButton.svelte";
1818
import { removeBoilerplate } from "$lib/utils/settings_utils";
19+
import { page } from "$app/state";
1920
2021
interface Props extends NodeProps {
2122
data: {
@@ -59,9 +60,11 @@
5960
6061
const { edges } = useStore()
6162
let hasOutputNode = $derived($edges.some(edge => edge.source === node._id))
63+
64+
const isHighlighted = page.url.searchParams.get("highlightedNode") === node._id;
6265
</script>
6366

64-
<div bind:clientWidth={widths[node._id]} bind:clientHeight={heights[node._id]} class="h-full">
67+
<div bind:clientWidth={widths[node._id]} bind:clientHeight={heights[node._id]} class="h-full" class:animate-highlight={isHighlighted}>
6568
{#if metadata?.input !== null}
6669
<Handle type="target"
6770
position={Position.Left}

src/lib/components/notification/NotificationGoTo.svelte

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,20 @@
1010
1111
interface AttributeLinks {
1212
[key: string]: {
13-
getUrl: (value: string) => string;
13+
getUrl: (value: string, attributes: NotificationAttributes) => string;
1414
getLabel: (value: string) => string;
1515
};
1616
}
1717
1818
const attributeLinks: AttributeLinks = {
1919
"flow.id": {
2020
getUrl: (id: string) => `/flow/${id}`,
21-
getLabel: (_: string) => `Flow`,
21+
getLabel: (_: string) => "Flow",
2222
},
23+
"node.id": {
24+
getUrl: (id: string, attributes: NotificationAttributes) => `/flow/${attributes["flow.id"]}?highlightedNode=${id}`,
25+
getLabel: (_: string) => "Node",
26+
}
2327
};
2428
2529
let open = $state(false);
@@ -29,18 +33,17 @@
2933
{open}
3034
onOpenChange={e => (open = e.open)}
3135
positioning={{placement: "bottom"}}
32-
contentBase="card bg-surface-200-800 p-2 space-y-4 max-w-[320px]"
36+
contentBase="card bg-surface-200-800 max-w-[320px] flex flex-col gap-2 p-2 ring-2 shadow-secondary-950-50"
3337
classes="flex items-center"
34-
arrow
35-
arrowBackground="!bg-surface-200 dark:!bg-surface-800"
3638
>
3739
{#snippet trigger()}<IconLink/>{/snippet}
3840
{#snippet content()}
3941
{#each Object.entries(attributes) as [key, value]}
4042
{@const link = attributeLinks[key]}
4143
{#if link}
42-
<a href={link.getUrl(value)} class="anchor">
43-
{link.getLabel(value)}
44+
<a href={link.getUrl(value, attributes)} class="btn preset-filled">
45+
<span>{link.getLabel(value)}</span>
46+
<span>&rarr;</span>
4447
</a>
4548
{/if}
4649
{/each}

0 commit comments

Comments
 (0)