@eventcatalog/core 2.24.2 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/catalog-to-astro-content-directory.cjs +0 -1
- package/dist/catalog-to-astro-content-directory.js +1 -1
- package/dist/{chunk-VOOF34RB.js → chunk-7674GE3M.js} +1 -1
- package/dist/{chunk-AMO6QDAS.js → chunk-H6PSWK2Z.js} +1 -1
- package/dist/{chunk-Q77NQ43U.js → chunk-JENKAK6L.js} +1 -1
- package/dist/{chunk-CXKIF3EI.js → chunk-VCR3LHZR.js} +0 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -2
- package/dist/eventcatalog.config.d.cts +1 -0
- package/dist/eventcatalog.config.d.ts +1 -0
- package/dist/eventcatalog.js +4 -4
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +3 -2
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Channel.tsx +82 -54
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Command.tsx +44 -41
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Event.tsx +43 -41
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/MessageContextMenu.tsx +54 -0
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Query.tsx +45 -43
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Service.tsx +112 -42
- package/eventcatalog/src/components/SideNav/TreeView/getTreeView.ts +1 -1
- package/eventcatalog/src/enterprise/ai-assistant/components/ChatSidebar.tsx +1 -9
- package/eventcatalog/src/enterprise/ai-assistant/components/ChatWindow.tsx +240 -118
- package/eventcatalog/src/enterprise/ai-assistant/components/hooks/ChatProvider.tsx +13 -13
- package/eventcatalog/src/enterprise/ai-assistant/components/workers/document-importer.ts +4 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/index.astro +0 -1
- package/eventcatalog/src/pages/docs/_default-docs.mdx +24 -0
- package/eventcatalog/src/pages/docs/index.astro +13 -18
- package/package.json +3 -2
- package/default-files-for-collections/pages.md +0 -7
- package/eventcatalog/src/components/DocsNavigation.astro +0 -145
- package/eventcatalog/src/layouts/CustomDocsPageLayout.astro +0 -131
- package/eventcatalog/src/layouts/PlainPage.astro +0 -29
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-7674GE3M.js";
|
|
4
|
+
import "../chunk-JENKAK6L.js";
|
|
5
|
+
import "../chunk-H6PSWK2Z.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -161,7 +161,7 @@ var import_axios = __toESM(require("axios"), 1);
|
|
|
161
161
|
var import_os = __toESM(require("os"), 1);
|
|
162
162
|
|
|
163
163
|
// package.json
|
|
164
|
-
var version = "2.
|
|
164
|
+
var version = "2.25.0";
|
|
165
165
|
|
|
166
166
|
// src/constants.ts
|
|
167
167
|
var VERSION = version;
|
|
@@ -435,7 +435,6 @@ var ensureAstroCollectionNotEmpty = async (astroDir) => {
|
|
|
435
435
|
"teams",
|
|
436
436
|
"domains",
|
|
437
437
|
"flows",
|
|
438
|
-
"pages",
|
|
439
438
|
"changelogs",
|
|
440
439
|
"queries",
|
|
441
440
|
"channels",
|
package/dist/eventcatalog.js
CHANGED
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
} from "./chunk-OW2FQPYP.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-7674GE3M.js";
|
|
10
|
+
import "./chunk-JENKAK6L.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VCR3LHZR.js";
|
|
14
14
|
import {
|
|
15
15
|
VERSION
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-H6PSWK2Z.js";
|
|
17
17
|
import {
|
|
18
18
|
isBackstagePluginEnabled
|
|
19
19
|
} from "./chunk-XMDPVKIJ.js";
|
|
@@ -427,8 +427,9 @@ const NodeGraph = ({
|
|
|
427
427
|
)}
|
|
428
428
|
|
|
429
429
|
{href && (
|
|
430
|
-
<div className="py-2 w-full text-right">
|
|
431
|
-
<
|
|
430
|
+
<div className="py-2 w-full text-right flex justify-between">
|
|
431
|
+
<span className="text-sm text-gray-500 italic">Right click a node to access documentation</span>
|
|
432
|
+
<a className=" text-sm underline text-gray-800 hover:text-primary" href={href}>
|
|
432
433
|
{hrefLabel} →
|
|
433
434
|
</a>
|
|
434
435
|
</div>
|
|
@@ -3,6 +3,8 @@ import { ArrowsRightLeftIcon } from '@heroicons/react/20/solid';
|
|
|
3
3
|
import type { CollectionMessageTypes, CollectionTypes } from '@types';
|
|
4
4
|
import type { CollectionEntry } from 'astro:content';
|
|
5
5
|
import { Handle } from '@xyflow/react';
|
|
6
|
+
import * as ContextMenu from '@radix-ui/react-context-menu';
|
|
7
|
+
import { buildUrl } from '@utils/url-builder';
|
|
6
8
|
|
|
7
9
|
interface Data {
|
|
8
10
|
title: string;
|
|
@@ -67,67 +69,93 @@ export default function ChannelNode({ data, sourcePosition, targetPosition }: an
|
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
return (
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{targetPosition && <Handle type="target" position={targetPosition} />}
|
|
91
|
-
{sourcePosition && <Handle type="source" position={sourcePosition} />}
|
|
92
|
-
<div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
|
|
93
|
-
<div className="flex justify-between items-center">
|
|
94
|
-
<span className="text-xs font-bold block pb-0.5">{name}</span>
|
|
95
|
-
{Icon && <Icon className="w-5 h-5 opacity-60 p-0.5" />}
|
|
96
|
-
</div>
|
|
97
|
-
<div className="flex justify-between">
|
|
98
|
-
<span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
|
|
99
|
-
{mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Channel</span>}
|
|
72
|
+
<ContextMenu.Root>
|
|
73
|
+
<ContextMenu.Trigger>
|
|
74
|
+
<div
|
|
75
|
+
className={classNames(
|
|
76
|
+
mode === 'simple' ? 'min-h-[3em]' : 'min-h-[6.5em]',
|
|
77
|
+
'w-full rounded-md border flex justify-start bg-white text-black border-gray-400 transform '
|
|
78
|
+
)}
|
|
79
|
+
>
|
|
80
|
+
<div
|
|
81
|
+
className={classNames(
|
|
82
|
+
'bg-gradient-to-b from-gray-500 to-gray-700 relative flex items-center w-5 justify-center rounded-l-sm text-gray-100-500',
|
|
83
|
+
`border-r-[1px] border-gray-500`
|
|
84
|
+
)}
|
|
85
|
+
>
|
|
86
|
+
<ArrowsRightLeftIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
|
|
87
|
+
{mode === 'full' && (
|
|
88
|
+
<span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
|
|
89
|
+
Channel
|
|
90
|
+
</span>
|
|
91
|
+
)}
|
|
100
92
|
</div>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
<div className=
|
|
105
|
-
<
|
|
93
|
+
<div className="p-1 min-w-60 max-w-[min-content]">
|
|
94
|
+
{targetPosition && <Handle type="target" position={targetPosition} />}
|
|
95
|
+
{sourcePosition && <Handle type="source" position={sourcePosition} />}
|
|
96
|
+
<div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
|
|
97
|
+
<div className="flex justify-between items-center">
|
|
98
|
+
<span className="text-xs font-bold block pb-0.5">{name}</span>
|
|
99
|
+
{Icon && <Icon className="w-5 h-5 opacity-60 p-0.5" />}
|
|
100
|
+
</div>
|
|
101
|
+
<div className="flex justify-between">
|
|
102
|
+
<span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
|
|
103
|
+
{mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Channel</span>}
|
|
104
|
+
</div>
|
|
106
105
|
</div>
|
|
107
|
-
{
|
|
108
|
-
<div className="
|
|
109
|
-
<div className="
|
|
110
|
-
<
|
|
111
|
-
<span className="block font-normal ">{getAddress()}</span>
|
|
106
|
+
{mode === 'full' && (
|
|
107
|
+
<div className="divide-y divide-gray-200 ">
|
|
108
|
+
<div className="leading-[10px] py-1 ">
|
|
109
|
+
<span className="text-[8px] font-light">{summary}</span>
|
|
112
110
|
</div>
|
|
113
|
-
{
|
|
114
|
-
<div className="
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
111
|
+
{address && (
|
|
112
|
+
<div className="leading-3 py-1 flex flex-col items-start space-y-0.5">
|
|
113
|
+
<div className="text-[6px] flex items-center space-x-0.5 ">
|
|
114
|
+
<LinkIcon className="w-2 h-2 opacity-60" />
|
|
115
|
+
<span className="block font-normal ">{getAddress()}</span>
|
|
116
|
+
</div>
|
|
117
|
+
{protocols.length > 0 && (
|
|
118
|
+
<div className="text-[6px] font-semibold flex space-x-2 items-center ">
|
|
119
|
+
{[...protocols].map((protocol, index) => {
|
|
120
|
+
const ProtoColIcon = getIconForProtocol(protocol);
|
|
121
|
+
return (
|
|
122
|
+
<span key={index} className="font-normal flex items-center -ml-[1px] space-x-0.5">
|
|
123
|
+
{ProtoColIcon && <ProtoColIcon className="w-2 h-2 opacity-60 inline-block" />}
|
|
124
|
+
<span>{protocol}</span>
|
|
125
|
+
</span>
|
|
126
|
+
);
|
|
127
|
+
})}
|
|
128
|
+
</div>
|
|
129
|
+
)}
|
|
124
130
|
</div>
|
|
125
131
|
)}
|
|
126
132
|
</div>
|
|
127
133
|
)}
|
|
128
134
|
</div>
|
|
129
|
-
|
|
130
|
-
</
|
|
131
|
-
|
|
135
|
+
</div>
|
|
136
|
+
</ContextMenu.Trigger>
|
|
137
|
+
<ContextMenu.Portal>
|
|
138
|
+
<ContextMenu.Content className="min-w-[220px] bg-white rounded-md p-1 shadow-md border border-gray-200">
|
|
139
|
+
<ContextMenu.Item
|
|
140
|
+
asChild
|
|
141
|
+
className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
|
|
142
|
+
>
|
|
143
|
+
<a href={buildUrl(`/docs/channels/${id}/${version}`)}>Read documentation</a>
|
|
144
|
+
</ContextMenu.Item>
|
|
145
|
+
<ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />
|
|
146
|
+
|
|
147
|
+
<ContextMenu.Item asChild>
|
|
148
|
+
<a
|
|
149
|
+
href={buildUrl(`/docs/channels/${id}/${version}/changelog`)}
|
|
150
|
+
className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
|
|
151
|
+
target="_blank"
|
|
152
|
+
rel="noopener noreferrer"
|
|
153
|
+
>
|
|
154
|
+
Read changelog
|
|
155
|
+
</a>
|
|
156
|
+
</ContextMenu.Item>
|
|
157
|
+
</ContextMenu.Content>
|
|
158
|
+
</ContextMenu.Portal>
|
|
159
|
+
</ContextMenu.Root>
|
|
132
160
|
);
|
|
133
161
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChatBubbleLeftIcon } from '@heroicons/react/16/solid';
|
|
2
2
|
import type { CollectionEntry } from 'astro:content';
|
|
3
3
|
import { Handle } from '@xyflow/react';
|
|
4
|
+
import MessageContextMenu from './MessageContextMenu';
|
|
4
5
|
|
|
5
6
|
interface Data {
|
|
6
7
|
title: string;
|
|
@@ -20,52 +21,54 @@ function classNames(...classes: any) {
|
|
|
20
21
|
export default function CommandNode({ data, sourcePosition, targetPosition }: any) {
|
|
21
22
|
const { mode, message } = data as Data;
|
|
22
23
|
|
|
23
|
-
const { name, version, summary, owners = [], producers = [], consumers = [] } = message.data;
|
|
24
|
+
const { id, name, version, summary, owners = [], producers = [], consumers = [], schemaPath } = message.data;
|
|
24
25
|
|
|
25
26
|
return (
|
|
26
|
-
<
|
|
27
|
-
<div
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<div className="p-1 min-w-60 max-w-[min-content]">
|
|
41
|
-
{targetPosition && <Handle type="target" position={targetPosition} />}
|
|
42
|
-
{sourcePosition && <Handle type="source" position={sourcePosition} />}
|
|
43
|
-
<div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
|
|
44
|
-
<span className="text-xs font-bold block pb-0.5">{name}</span>
|
|
45
|
-
<div className="flex justify-between">
|
|
46
|
-
<span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
|
|
47
|
-
{mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Command</span>}
|
|
48
|
-
</div>
|
|
27
|
+
<MessageContextMenu message={message} messageType="commands">
|
|
28
|
+
<div className={classNames('w-full rounded-md border flex justify-start bg-white text-black border-blue-400')}>
|
|
29
|
+
<div
|
|
30
|
+
className={classNames(
|
|
31
|
+
'bg-gradient-to-b from-blue-500 to-blue-700 relative flex items-center w-5 justify-center rounded-l-sm text-blue-100-500',
|
|
32
|
+
`border-r-[1px] border-blue-500`
|
|
33
|
+
)}
|
|
34
|
+
>
|
|
35
|
+
<ChatBubbleLeftIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
|
|
36
|
+
{mode === 'full' && (
|
|
37
|
+
<span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
|
|
38
|
+
Command
|
|
39
|
+
</span>
|
|
40
|
+
)}
|
|
49
41
|
</div>
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</
|
|
55
|
-
<div className="
|
|
56
|
-
<span className="text-
|
|
57
|
-
|
|
58
|
-
</span>
|
|
59
|
-
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
60
|
-
Consumers: {consumers.length}
|
|
61
|
-
</span>
|
|
62
|
-
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
63
|
-
Owners: {owners.length}
|
|
64
|
-
</span>
|
|
42
|
+
<div className="p-1 min-w-60 max-w-[min-content]">
|
|
43
|
+
{targetPosition && <Handle type="target" position={targetPosition} />}
|
|
44
|
+
{sourcePosition && <Handle type="source" position={sourcePosition} />}
|
|
45
|
+
<div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
|
|
46
|
+
<span className="text-xs font-bold block pb-0.5">{name}</span>
|
|
47
|
+
<div className="flex justify-between">
|
|
48
|
+
<span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
|
|
49
|
+
{mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Command</span>}
|
|
65
50
|
</div>
|
|
66
51
|
</div>
|
|
67
|
-
|
|
52
|
+
{mode === 'full' && (
|
|
53
|
+
<div className="divide-y divide-gray-200 ">
|
|
54
|
+
<div className="leading-3 py-1">
|
|
55
|
+
<span className="text-[8px] font-light">{summary}</span>
|
|
56
|
+
</div>
|
|
57
|
+
<div className="grid grid-cols-2 gap-x-4 py-1">
|
|
58
|
+
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
59
|
+
Producers: {producers.length}
|
|
60
|
+
</span>
|
|
61
|
+
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
62
|
+
Consumers: {consumers.length}
|
|
63
|
+
</span>
|
|
64
|
+
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
65
|
+
Owners: {owners.length}
|
|
66
|
+
</span>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
)}
|
|
70
|
+
</div>
|
|
68
71
|
</div>
|
|
69
|
-
</
|
|
72
|
+
</MessageContextMenu>
|
|
70
73
|
);
|
|
71
74
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BoltIcon } from '@heroicons/react/16/solid';
|
|
2
2
|
import type { CollectionEntry } from 'astro:content';
|
|
3
3
|
import { Handle } from '@xyflow/react';
|
|
4
|
+
import MessageContextMenu from './MessageContextMenu';
|
|
4
5
|
|
|
5
6
|
interface Data {
|
|
6
7
|
title: string;
|
|
@@ -19,53 +20,54 @@ function classNames(...classes: any) {
|
|
|
19
20
|
|
|
20
21
|
export default function EventNode({ data, sourcePosition, targetPosition }: any) {
|
|
21
22
|
const { mode, message } = data as Data;
|
|
22
|
-
|
|
23
23
|
const { name, version, summary, owners = [], producers = [], consumers = [] } = message.data;
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
<
|
|
27
|
-
<div
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<div className="p-1 min-w-60 max-w-[min-content]">
|
|
41
|
-
{targetPosition && <Handle type="target" position={targetPosition} />}
|
|
42
|
-
{sourcePosition && <Handle type="source" position={sourcePosition} />}
|
|
43
|
-
<div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
|
|
44
|
-
<span className="text-xs font-bold block pb-0.5">{name}</span>
|
|
45
|
-
<div className="flex justify-between">
|
|
46
|
-
<span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
|
|
47
|
-
{mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Event</span>}
|
|
48
|
-
</div>
|
|
26
|
+
<MessageContextMenu message={message} messageType="events">
|
|
27
|
+
<div className={classNames('w-full rounded-md border flex justify-start bg-white text-black border-orange-400')}>
|
|
28
|
+
<div
|
|
29
|
+
className={classNames(
|
|
30
|
+
'bg-gradient-to-b from-orange-500 to-orange-700 relative flex items-center w-5 justify-center rounded-l-sm text-orange-100-500',
|
|
31
|
+
`border-r-[1px] border-orange-500`
|
|
32
|
+
)}
|
|
33
|
+
>
|
|
34
|
+
<BoltIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
|
|
35
|
+
{mode === 'full' && (
|
|
36
|
+
<span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
|
|
37
|
+
Event
|
|
38
|
+
</span>
|
|
39
|
+
)}
|
|
49
40
|
</div>
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</
|
|
55
|
-
<div className="
|
|
56
|
-
<span className="text-
|
|
57
|
-
|
|
58
|
-
</span>
|
|
59
|
-
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
60
|
-
Consumers: {consumers.length}
|
|
61
|
-
</span>
|
|
62
|
-
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
63
|
-
Owners: {owners.length}
|
|
64
|
-
</span>
|
|
41
|
+
<div className="p-1 min-w-60 max-w-[min-content]">
|
|
42
|
+
{targetPosition && <Handle type="target" position={targetPosition} />}
|
|
43
|
+
{sourcePosition && <Handle type="source" position={sourcePosition} />}
|
|
44
|
+
<div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
|
|
45
|
+
<span className="text-xs font-bold block pb-0.5">{name}</span>
|
|
46
|
+
<div className="flex justify-between">
|
|
47
|
+
<span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
|
|
48
|
+
{mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Event</span>}
|
|
65
49
|
</div>
|
|
66
50
|
</div>
|
|
67
|
-
|
|
51
|
+
{mode === 'full' && (
|
|
52
|
+
<div className="divide-y divide-gray-200 ">
|
|
53
|
+
<div className="leading-3 py-1">
|
|
54
|
+
<span className="text-[8px] font-light">{summary}</span>
|
|
55
|
+
</div>
|
|
56
|
+
<div className="grid grid-cols-2 gap-x-4 py-1">
|
|
57
|
+
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
58
|
+
Producers: {producers.length}
|
|
59
|
+
</span>
|
|
60
|
+
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
61
|
+
Consumers: {consumers.length}
|
|
62
|
+
</span>
|
|
63
|
+
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
64
|
+
Owners: {owners.length}
|
|
65
|
+
</span>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
68
70
|
</div>
|
|
69
|
-
</
|
|
71
|
+
</MessageContextMenu>
|
|
70
72
|
);
|
|
71
73
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as ContextMenu from '@radix-ui/react-context-menu';
|
|
2
|
+
import { buildUrl } from '@utils/url-builder';
|
|
3
|
+
import type { CollectionEntry } from 'astro:content';
|
|
4
|
+
import type { CollectionMessageTypes } from '@types';
|
|
5
|
+
interface Data {
|
|
6
|
+
message: CollectionEntry<CollectionMessageTypes>;
|
|
7
|
+
messageType: CollectionMessageTypes;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function MessageContextMenu(data: Data) {
|
|
12
|
+
const { message, messageType, children } = data;
|
|
13
|
+
const { id, version, name, schemaPath } = message.data;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<ContextMenu.Root>
|
|
17
|
+
<ContextMenu.Trigger>{children}</ContextMenu.Trigger>
|
|
18
|
+
<ContextMenu.Portal>
|
|
19
|
+
<ContextMenu.Content className="min-w-[220px] bg-white rounded-md p-1 shadow-md border border-gray-200">
|
|
20
|
+
<ContextMenu.Item
|
|
21
|
+
asChild
|
|
22
|
+
className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
|
|
23
|
+
>
|
|
24
|
+
<a href={buildUrl(`/docs/${messageType}/${id}/${version}`)}>Read documentation</a>
|
|
25
|
+
</ContextMenu.Item>
|
|
26
|
+
<ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />
|
|
27
|
+
{schemaPath && (
|
|
28
|
+
<ContextMenu.Item asChild>
|
|
29
|
+
<a
|
|
30
|
+
href={buildUrl(`/generated/${messageType}/${id}/schema.json`)}
|
|
31
|
+
download={`${name}(${version})-${schemaPath}`}
|
|
32
|
+
className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
|
|
33
|
+
target="_blank"
|
|
34
|
+
rel="noopener noreferrer"
|
|
35
|
+
>
|
|
36
|
+
Download schema
|
|
37
|
+
</a>
|
|
38
|
+
</ContextMenu.Item>
|
|
39
|
+
)}
|
|
40
|
+
<ContextMenu.Item asChild>
|
|
41
|
+
<a
|
|
42
|
+
href={buildUrl(`/docs/${messageType}/${id}/${version}/changelog`)}
|
|
43
|
+
className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
|
|
44
|
+
target="_blank"
|
|
45
|
+
rel="noopener noreferrer"
|
|
46
|
+
>
|
|
47
|
+
Read changelog
|
|
48
|
+
</a>
|
|
49
|
+
</ContextMenu.Item>
|
|
50
|
+
</ContextMenu.Content>
|
|
51
|
+
</ContextMenu.Portal>
|
|
52
|
+
</ContextMenu.Root>
|
|
53
|
+
);
|
|
54
|
+
}
|