@buoy-gg/events 7.0.28 → 7.0.30
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/lib/commonjs/components/EventsModal.js +2 -1
- package/lib/commonjs/components/EventsModal.js.map +1 -1
- package/lib/module/components/EventsModal.js +2 -1
- package/lib/module/components/EventsModal.js.map +1 -1
- package/lib/typescript/components/EventsModal.d.ts.map +1 -1
- package/package.json +7 -8
- package/src/components/EventsCopySettingsView.tsx +0 -781
- package/src/components/EventsModal.tsx +0 -536
- package/src/components/ReactQueryEventDetail.tsx +0 -418
- package/src/components/UnifiedEventDetail.tsx +0 -596
- package/src/components/UnifiedEventFilters.tsx +0 -226
- package/src/components/UnifiedEventItem.tsx +0 -467
- package/src/components/UnifiedEventList.tsx +0 -216
- package/src/components/UnifiedEventViewer.tsx +0 -133
- package/src/hooks/useUnifiedEvents.ts +0 -573
- package/src/index.tsx +0 -128
- package/src/preset.tsx +0 -57
- package/src/sources/sourceIds.ts +0 -25
- package/src/stores/unifiedEventStore.ts +0 -686
- package/src/sync/__tests__/eventsSyncAdapter.test.ts +0 -471
- package/src/sync/eventsSyncAdapter.ts +0 -391
- package/src/types/copySettings.ts +0 -299
- package/src/types/index.ts +0 -101
- package/src/utils/autoDiscoverEventSources.ts +0 -1087
- package/src/utils/badgeSelectionStorage.ts +0 -81
- package/src/utils/copySettingsStorage.ts +0 -61
- package/src/utils/correlationUtils.ts +0 -146
- package/src/utils/eventExportFormatter.ts +0 -2066
- package/src/utils/eventTransformers.ts +0 -567
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UnifiedEventFilters
|
|
3
|
-
*
|
|
4
|
-
* Filter bar showing toggleable badges for each available event source.
|
|
5
|
-
* Badges are sorted: enabled first, disabled last.
|
|
6
|
-
* Toggling a badge enables/disables event listening for that source.
|
|
7
|
-
*
|
|
8
|
-
* Badge layout (inspired by React Query DevTools):
|
|
9
|
-
* [subscriber_count] • Label [event_count]
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { View, Text, TouchableOpacity, StyleSheet, ScrollView } from "react-native";
|
|
13
|
-
import { memo } from "react";
|
|
14
|
-
import { night } from "@buoy-gg/shared-ui";
|
|
15
|
-
import type { EventSource, SourceInfo } from "../types";
|
|
16
|
-
|
|
17
|
-
interface UnifiedEventFiltersProps {
|
|
18
|
-
/** All available sources (already sorted: enabled first) */
|
|
19
|
-
availableSources: SourceInfo[];
|
|
20
|
-
|
|
21
|
-
/** Toggle a source on/off */
|
|
22
|
-
onToggleSource: (source: EventSource) => void;
|
|
23
|
-
|
|
24
|
-
/** Total event count */
|
|
25
|
-
totalCount: number;
|
|
26
|
-
|
|
27
|
-
/** Filtered event count */
|
|
28
|
-
filteredCount: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const UnifiedEventFilters = memo(function UnifiedEventFilters({
|
|
32
|
-
availableSources,
|
|
33
|
-
onToggleSource,
|
|
34
|
-
totalCount,
|
|
35
|
-
filteredCount,
|
|
36
|
-
}: UnifiedEventFiltersProps) {
|
|
37
|
-
if (availableSources.length === 0) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<View style={styles.container}>
|
|
43
|
-
<ScrollView
|
|
44
|
-
horizontal
|
|
45
|
-
showsHorizontalScrollIndicator={false}
|
|
46
|
-
contentContainerStyle={styles.badgesRow}
|
|
47
|
-
>
|
|
48
|
-
{availableSources.map((source) => {
|
|
49
|
-
const isEnabled = source.enabled !== false;
|
|
50
|
-
const subscriberCount = source.subscriberCount;
|
|
51
|
-
const hasSubscriberTracking = subscriberCount !== undefined;
|
|
52
|
-
const eventCount = source.count || 0;
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<TouchableOpacity
|
|
56
|
-
key={source.source}
|
|
57
|
-
style={[
|
|
58
|
-
styles.badge,
|
|
59
|
-
isEnabled
|
|
60
|
-
? {
|
|
61
|
-
backgroundColor: night.color.surface,
|
|
62
|
-
borderColor: source.color + "50",
|
|
63
|
-
}
|
|
64
|
-
: styles.badgeDisabled,
|
|
65
|
-
]}
|
|
66
|
-
onPress={() => onToggleSource(source.source)}
|
|
67
|
-
activeOpacity={0.7}
|
|
68
|
-
>
|
|
69
|
-
{/* Subscriber count on left - only show if tracking is available */}
|
|
70
|
-
{hasSubscriberTracking && (
|
|
71
|
-
<View
|
|
72
|
-
style={[
|
|
73
|
-
styles.countBadge,
|
|
74
|
-
{
|
|
75
|
-
backgroundColor: isEnabled
|
|
76
|
-
? subscriberCount > 0
|
|
77
|
-
? source.color + "25"
|
|
78
|
-
: night.color.fillSecondary
|
|
79
|
-
: night.color.fill,
|
|
80
|
-
},
|
|
81
|
-
]}
|
|
82
|
-
>
|
|
83
|
-
<Text
|
|
84
|
-
style={[
|
|
85
|
-
styles.countText,
|
|
86
|
-
{
|
|
87
|
-
color: isEnabled
|
|
88
|
-
? subscriberCount > 0
|
|
89
|
-
? source.color
|
|
90
|
-
: night.color.textTertiary
|
|
91
|
-
: night.color.textTertiary,
|
|
92
|
-
},
|
|
93
|
-
]}
|
|
94
|
-
>
|
|
95
|
-
{subscriberCount}
|
|
96
|
-
</Text>
|
|
97
|
-
</View>
|
|
98
|
-
)}
|
|
99
|
-
|
|
100
|
-
{/* Dot indicator */}
|
|
101
|
-
<View
|
|
102
|
-
style={[
|
|
103
|
-
styles.dot,
|
|
104
|
-
{
|
|
105
|
-
backgroundColor: isEnabled
|
|
106
|
-
? source.color
|
|
107
|
-
: night.color.fillTertiary,
|
|
108
|
-
},
|
|
109
|
-
]}
|
|
110
|
-
/>
|
|
111
|
-
|
|
112
|
-
{/* Label */}
|
|
113
|
-
<Text
|
|
114
|
-
style={[
|
|
115
|
-
styles.badgeLabel,
|
|
116
|
-
{
|
|
117
|
-
color: isEnabled
|
|
118
|
-
? night.color.text
|
|
119
|
-
: night.color.textTertiary,
|
|
120
|
-
},
|
|
121
|
-
]}
|
|
122
|
-
numberOfLines={1}
|
|
123
|
-
>
|
|
124
|
-
{source.label}
|
|
125
|
-
</Text>
|
|
126
|
-
|
|
127
|
-
{/* Event count on right */}
|
|
128
|
-
<View
|
|
129
|
-
style={[
|
|
130
|
-
styles.countBadge,
|
|
131
|
-
{
|
|
132
|
-
backgroundColor: isEnabled
|
|
133
|
-
? eventCount > 0
|
|
134
|
-
? source.color + "20"
|
|
135
|
-
: night.color.fill
|
|
136
|
-
: night.color.fill,
|
|
137
|
-
},
|
|
138
|
-
]}
|
|
139
|
-
>
|
|
140
|
-
<Text
|
|
141
|
-
style={[
|
|
142
|
-
styles.countText,
|
|
143
|
-
{
|
|
144
|
-
color: isEnabled
|
|
145
|
-
? eventCount > 0
|
|
146
|
-
? source.color
|
|
147
|
-
: night.color.textTertiary
|
|
148
|
-
: night.color.textTertiary,
|
|
149
|
-
},
|
|
150
|
-
]}
|
|
151
|
-
>
|
|
152
|
-
{eventCount}
|
|
153
|
-
</Text>
|
|
154
|
-
</View>
|
|
155
|
-
</TouchableOpacity>
|
|
156
|
-
);
|
|
157
|
-
})}
|
|
158
|
-
</ScrollView>
|
|
159
|
-
|
|
160
|
-
{/* Show filter indicator if not all events shown */}
|
|
161
|
-
{filteredCount < totalCount && (
|
|
162
|
-
<Text style={styles.filterInfo}>
|
|
163
|
-
Showing {filteredCount} of {totalCount}
|
|
164
|
-
</Text>
|
|
165
|
-
)}
|
|
166
|
-
</View>
|
|
167
|
-
);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
const styles = StyleSheet.create({
|
|
171
|
-
container: {
|
|
172
|
-
paddingVertical: 8,
|
|
173
|
-
// Transparent so the night sheet's star field shows through.
|
|
174
|
-
backgroundColor: "transparent",
|
|
175
|
-
borderBottomWidth: 1,
|
|
176
|
-
borderBottomColor: night.color.border,
|
|
177
|
-
},
|
|
178
|
-
badgesRow: {
|
|
179
|
-
flexDirection: "row",
|
|
180
|
-
gap: 8,
|
|
181
|
-
paddingHorizontal: 12,
|
|
182
|
-
},
|
|
183
|
-
badge: {
|
|
184
|
-
flexDirection: "row",
|
|
185
|
-
alignItems: "center",
|
|
186
|
-
paddingVertical: 5,
|
|
187
|
-
paddingHorizontal: 6,
|
|
188
|
-
borderRadius: 20,
|
|
189
|
-
borderWidth: 1,
|
|
190
|
-
gap: 6,
|
|
191
|
-
flexShrink: 0,
|
|
192
|
-
},
|
|
193
|
-
badgeDisabled: {
|
|
194
|
-
backgroundColor: night.color.surface,
|
|
195
|
-
borderColor: night.color.border,
|
|
196
|
-
opacity: 0.5,
|
|
197
|
-
},
|
|
198
|
-
dot: {
|
|
199
|
-
width: 7,
|
|
200
|
-
height: 7,
|
|
201
|
-
borderRadius: 4,
|
|
202
|
-
},
|
|
203
|
-
badgeLabel: {
|
|
204
|
-
fontSize: 12,
|
|
205
|
-
fontWeight: "500",
|
|
206
|
-
},
|
|
207
|
-
countBadge: {
|
|
208
|
-
minWidth: 18,
|
|
209
|
-
height: 18,
|
|
210
|
-
borderRadius: 9,
|
|
211
|
-
alignItems: "center",
|
|
212
|
-
justifyContent: "center",
|
|
213
|
-
paddingHorizontal: 5,
|
|
214
|
-
},
|
|
215
|
-
countText: {
|
|
216
|
-
fontSize: 10,
|
|
217
|
-
fontWeight: "600",
|
|
218
|
-
fontVariant: ["tabular-nums"],
|
|
219
|
-
},
|
|
220
|
-
filterInfo: {
|
|
221
|
-
marginTop: 6,
|
|
222
|
-
fontSize: 11,
|
|
223
|
-
color: night.color.textTertiary,
|
|
224
|
-
textAlign: "center",
|
|
225
|
-
},
|
|
226
|
-
});
|
|
@@ -1,467 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UnifiedEventItem
|
|
3
|
-
*
|
|
4
|
-
* Renders a single event in the unified event timeline.
|
|
5
|
-
* Uses shared UI components from other packages when available,
|
|
6
|
-
* falls back to generic CompactRow when packages aren't installed.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { memo, type ComponentType, type ReactNode } from "react";
|
|
10
|
-
import { View, Text, StyleSheet } from "react-native";
|
|
11
|
-
import { CompactRow, formatRelativeTime } from "@buoy-gg/shared-ui";
|
|
12
|
-
import type { UnifiedEvent, EventSource } from "../types";
|
|
13
|
-
import type {
|
|
14
|
-
StorageEvent,
|
|
15
|
-
ReduxAction,
|
|
16
|
-
NetworkEvent,
|
|
17
|
-
RouteChangeEvent,
|
|
18
|
-
} from "../utils/eventTransformers";
|
|
19
|
-
|
|
20
|
-
// ============================================================================
|
|
21
|
-
// Optional Component Loading
|
|
22
|
-
// ============================================================================
|
|
23
|
-
|
|
24
|
-
interface OptionalComponents {
|
|
25
|
-
StorageEventCard: ComponentType<{
|
|
26
|
-
data: unknown;
|
|
27
|
-
onPress: () => void;
|
|
28
|
-
isSelected?: boolean;
|
|
29
|
-
}> | null;
|
|
30
|
-
getValueType: ((value: unknown) => string) | null;
|
|
31
|
-
ReduxActionItem: ComponentType<{
|
|
32
|
-
action: unknown;
|
|
33
|
-
onPress: () => void;
|
|
34
|
-
}> | null;
|
|
35
|
-
NetworkEventItemCompact: ComponentType<{
|
|
36
|
-
event: unknown;
|
|
37
|
-
onPress: () => void;
|
|
38
|
-
}> | null;
|
|
39
|
-
RouteEventItemCompact: ComponentType<{
|
|
40
|
-
event: unknown;
|
|
41
|
-
visitNumber: number;
|
|
42
|
-
isExpanded?: boolean;
|
|
43
|
-
onPress: () => void;
|
|
44
|
-
onNavigate?: (pathname: string) => void;
|
|
45
|
-
}> | null;
|
|
46
|
-
ZustandStateChangeItem: ComponentType<{
|
|
47
|
-
change: unknown;
|
|
48
|
-
onPress: (change: unknown) => void;
|
|
49
|
-
}> | null;
|
|
50
|
-
JotaiAtomChangeItem: ComponentType<{
|
|
51
|
-
change: unknown;
|
|
52
|
-
onPress: (change: unknown) => void;
|
|
53
|
-
}> | null;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function tryLoadOptionalComponents(): OptionalComponents {
|
|
57
|
-
const components: OptionalComponents = {
|
|
58
|
-
StorageEventCard: null,
|
|
59
|
-
getValueType: null,
|
|
60
|
-
ReduxActionItem: null,
|
|
61
|
-
NetworkEventItemCompact: null,
|
|
62
|
-
RouteEventItemCompact: null,
|
|
63
|
-
ZustandStateChangeItem: null,
|
|
64
|
-
JotaiAtomChangeItem: null,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// Try to load storage components
|
|
68
|
-
try {
|
|
69
|
-
// @ts-ignore - Dynamic import that may not exist
|
|
70
|
-
const storage = require("@buoy-gg/storage");
|
|
71
|
-
components.StorageEventCard = storage.StorageEventCard;
|
|
72
|
-
components.getValueType = storage.getValueType;
|
|
73
|
-
} catch {
|
|
74
|
-
// Optional dependency not installed
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Try to load redux components
|
|
78
|
-
try {
|
|
79
|
-
// @ts-ignore - Dynamic import that may not exist
|
|
80
|
-
const redux = require("@buoy-gg/redux");
|
|
81
|
-
components.ReduxActionItem = redux.ReduxActionItem;
|
|
82
|
-
} catch {
|
|
83
|
-
// Optional dependency not installed
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Try to load network components
|
|
87
|
-
try {
|
|
88
|
-
// @ts-ignore - Dynamic import that may not exist
|
|
89
|
-
const network = require("@buoy-gg/network");
|
|
90
|
-
components.NetworkEventItemCompact = network.NetworkEventItemCompact;
|
|
91
|
-
} catch {
|
|
92
|
-
// Optional dependency not installed
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Try to load route events components
|
|
96
|
-
try {
|
|
97
|
-
// @ts-ignore - Dynamic import that may not exist
|
|
98
|
-
const routeEvents = require("@buoy-gg/route-events");
|
|
99
|
-
components.RouteEventItemCompact = routeEvents.RouteEventItemCompact;
|
|
100
|
-
} catch {
|
|
101
|
-
// Optional dependency not installed
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Try to load zustand components
|
|
105
|
-
try {
|
|
106
|
-
// @ts-ignore - Dynamic import that may not exist
|
|
107
|
-
const zustand = require("@buoy-gg/zustand");
|
|
108
|
-
components.ZustandStateChangeItem = zustand.ZustandStateChangeItem;
|
|
109
|
-
} catch {
|
|
110
|
-
// Optional dependency not installed
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Try to load jotai components
|
|
114
|
-
try {
|
|
115
|
-
// @ts-ignore - Dynamic import that may not exist
|
|
116
|
-
const jotai = require("@buoy-gg/jotai");
|
|
117
|
-
components.JotaiAtomChangeItem = jotai.JotaiAtomChangeItem;
|
|
118
|
-
} catch {
|
|
119
|
-
// Optional dependency not installed
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return components;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Cache loaded components
|
|
126
|
-
const optionalComponents = tryLoadOptionalComponents();
|
|
127
|
-
|
|
128
|
-
// ============================================================================
|
|
129
|
-
// Configuration
|
|
130
|
-
// ============================================================================
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Source configuration for display (used for fallback rendering)
|
|
134
|
-
*/
|
|
135
|
-
const SOURCE_CONFIG: Record<
|
|
136
|
-
EventSource,
|
|
137
|
-
{ label: string; color: string }
|
|
138
|
-
> = {
|
|
139
|
-
"storage-async": {
|
|
140
|
-
label: "Storage",
|
|
141
|
-
color: "#8B5CF6", // Purple
|
|
142
|
-
},
|
|
143
|
-
"storage-mmkv": {
|
|
144
|
-
label: "MMKV",
|
|
145
|
-
color: "#F59E0B", // Orange
|
|
146
|
-
},
|
|
147
|
-
redux: {
|
|
148
|
-
label: "Redux",
|
|
149
|
-
color: "#3B82F6", // Blue
|
|
150
|
-
},
|
|
151
|
-
network: {
|
|
152
|
-
label: "Network",
|
|
153
|
-
color: "#10B981", // Green
|
|
154
|
-
},
|
|
155
|
-
"react-query": {
|
|
156
|
-
label: "Query",
|
|
157
|
-
color: "#EC4899", // Pink (legacy, kept for backwards compatibility)
|
|
158
|
-
},
|
|
159
|
-
"react-query-query": {
|
|
160
|
-
label: "Query",
|
|
161
|
-
color: "#EC4899", // Pink
|
|
162
|
-
},
|
|
163
|
-
"react-query-mutation": {
|
|
164
|
-
label: "Mutation",
|
|
165
|
-
color: "#F97316", // Orange - distinct from queries
|
|
166
|
-
},
|
|
167
|
-
route: {
|
|
168
|
-
label: "Route",
|
|
169
|
-
color: "#06B6D4", // Cyan
|
|
170
|
-
},
|
|
171
|
-
zustand: {
|
|
172
|
-
label: "Zustand",
|
|
173
|
-
color: "#764ABC", // Purple
|
|
174
|
-
},
|
|
175
|
-
jotai: {
|
|
176
|
-
label: "Jotai",
|
|
177
|
-
color: "#14B8A6", // Teal
|
|
178
|
-
},
|
|
179
|
-
render: {
|
|
180
|
-
label: "Render",
|
|
181
|
-
color: "#F472B6", // Pink
|
|
182
|
-
},
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Get status color based on event status
|
|
187
|
-
*/
|
|
188
|
-
function getStatusColor(status: UnifiedEvent["status"]): string {
|
|
189
|
-
switch (status) {
|
|
190
|
-
case "success":
|
|
191
|
-
return "#10B981"; // Green
|
|
192
|
-
case "error":
|
|
193
|
-
return "#EF4444"; // Red
|
|
194
|
-
case "pending":
|
|
195
|
-
return "#F59E0B"; // Orange
|
|
196
|
-
case "neutral":
|
|
197
|
-
default:
|
|
198
|
-
return "#6B7280"; // Gray
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Check if an event is a storage event
|
|
204
|
-
*/
|
|
205
|
-
function isStorageEvent(source: EventSource): boolean {
|
|
206
|
-
return source === "storage-async" || source === "storage-mmkv";
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// ============================================================================
|
|
210
|
-
// Component
|
|
211
|
-
// ============================================================================
|
|
212
|
-
|
|
213
|
-
interface UnifiedEventItemProps {
|
|
214
|
-
event: UnifiedEvent;
|
|
215
|
-
onPress: () => void;
|
|
216
|
-
isSelected?: boolean;
|
|
217
|
-
/** Whether this event is expanded (for route events) */
|
|
218
|
-
isExpanded?: boolean;
|
|
219
|
-
/** Called when navigating to a route */
|
|
220
|
-
onNavigate?: (pathname: string) => void;
|
|
221
|
-
/** Number of events in the correlation group */
|
|
222
|
-
correlationCount?: number;
|
|
223
|
-
/** Label showing position in group (e.g., "1/2") */
|
|
224
|
-
correlationLabel?: string | null;
|
|
225
|
-
/** Color for the correlation indicator */
|
|
226
|
-
correlationColor?: string;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Correlation badge component - shows linked event indicator
|
|
231
|
-
*/
|
|
232
|
-
function CorrelationBadge({
|
|
233
|
-
label,
|
|
234
|
-
color,
|
|
235
|
-
}: {
|
|
236
|
-
label: string;
|
|
237
|
-
color: string;
|
|
238
|
-
}) {
|
|
239
|
-
return (
|
|
240
|
-
<View style={[styles.correlationBadge, { backgroundColor: `${color}20` }]}>
|
|
241
|
-
<Text style={[styles.correlationText, { color }]}>{label}</Text>
|
|
242
|
-
</View>
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Source badge configuration - short labels for top-right badge
|
|
248
|
-
* Colors match SOURCE_CONFIG used for filter badges
|
|
249
|
-
*/
|
|
250
|
-
const SOURCE_BADGE_LABELS: Record<EventSource, string> = {
|
|
251
|
-
"storage-async": "STORAGE",
|
|
252
|
-
"storage-mmkv": "MMKV",
|
|
253
|
-
redux: "REDUX",
|
|
254
|
-
network: "NET",
|
|
255
|
-
"react-query": "QUERY",
|
|
256
|
-
"react-query-query": "QUERY",
|
|
257
|
-
"react-query-mutation": "MUTATION",
|
|
258
|
-
route: "ROUTE",
|
|
259
|
-
zustand: "ZUSTAND",
|
|
260
|
-
jotai: "JOTAI",
|
|
261
|
-
render: "RENDER",
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Source badge wrapper - adds source type badge to top-right of any card
|
|
266
|
-
*/
|
|
267
|
-
function SourceBadgeWrapper({
|
|
268
|
-
source,
|
|
269
|
-
children,
|
|
270
|
-
}: {
|
|
271
|
-
source: EventSource;
|
|
272
|
-
children: ReactNode;
|
|
273
|
-
}) {
|
|
274
|
-
const color = SOURCE_CONFIG[source].color;
|
|
275
|
-
const label = SOURCE_BADGE_LABELS[source];
|
|
276
|
-
|
|
277
|
-
return (
|
|
278
|
-
<View style={styles.badgeWrapper}>
|
|
279
|
-
{children}
|
|
280
|
-
<View
|
|
281
|
-
style={[
|
|
282
|
-
styles.sourceBadge,
|
|
283
|
-
{ backgroundColor: `${color}20` },
|
|
284
|
-
]}
|
|
285
|
-
>
|
|
286
|
-
<Text style={[styles.sourceBadgeText, { color }]}>
|
|
287
|
-
{label}
|
|
288
|
-
</Text>
|
|
289
|
-
</View>
|
|
290
|
-
</View>
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
export const UnifiedEventItem = memo(function UnifiedEventItem({
|
|
295
|
-
event,
|
|
296
|
-
onPress,
|
|
297
|
-
isSelected = false,
|
|
298
|
-
isExpanded = false,
|
|
299
|
-
onNavigate,
|
|
300
|
-
correlationCount = 1,
|
|
301
|
-
correlationLabel,
|
|
302
|
-
correlationColor,
|
|
303
|
-
}: UnifiedEventItemProps) {
|
|
304
|
-
const sourceConfig = SOURCE_CONFIG[event.source];
|
|
305
|
-
const statusColor = getStatusColor(event.status);
|
|
306
|
-
|
|
307
|
-
// For storage events, try to use the shared StorageEventCard component
|
|
308
|
-
if (isStorageEvent(event.source) && optionalComponents.StorageEventCard && optionalComponents.getValueType) {
|
|
309
|
-
const { StorageEventCard, getValueType } = optionalComponents;
|
|
310
|
-
const originalEvent = event.originalEvent as StorageEvent & {
|
|
311
|
-
storageType?: "async" | "mmkv";
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
const cardData = {
|
|
315
|
-
key: originalEvent.data?.key || "unknown",
|
|
316
|
-
lastAction: originalEvent.action,
|
|
317
|
-
totalOperations: 1,
|
|
318
|
-
lastEventTimestamp: new Date(event.timestamp),
|
|
319
|
-
storageTypes: new Set([originalEvent.storageType || "async"]),
|
|
320
|
-
valueType: originalEvent.data?.value !== undefined
|
|
321
|
-
? getValueType(originalEvent.data.value)
|
|
322
|
-
: undefined,
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
return (
|
|
326
|
-
<SourceBadgeWrapper source={event.source}>
|
|
327
|
-
<StorageEventCard
|
|
328
|
-
data={cardData}
|
|
329
|
-
onPress={onPress}
|
|
330
|
-
isSelected={isSelected}
|
|
331
|
-
/>
|
|
332
|
-
</SourceBadgeWrapper>
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
// For Redux events, try to use the shared ReduxActionItem component
|
|
337
|
-
if (event.source === "redux" && optionalComponents.ReduxActionItem) {
|
|
338
|
-
const { ReduxActionItem } = optionalComponents;
|
|
339
|
-
const reduxAction = event.originalEvent as ReduxAction;
|
|
340
|
-
|
|
341
|
-
return (
|
|
342
|
-
<SourceBadgeWrapper source={event.source}>
|
|
343
|
-
<ReduxActionItem
|
|
344
|
-
action={reduxAction}
|
|
345
|
-
onPress={() => onPress()}
|
|
346
|
-
/>
|
|
347
|
-
</SourceBadgeWrapper>
|
|
348
|
-
);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// For network events, use the shared NetworkEventItemCompact component
|
|
352
|
-
// Note: No SourceBadgeWrapper needed - network card already has its own badges (FETCH, GQL, etc.)
|
|
353
|
-
if (event.source === "network" && optionalComponents.NetworkEventItemCompact) {
|
|
354
|
-
const { NetworkEventItemCompact } = optionalComponents;
|
|
355
|
-
const networkEvent = event.originalEvent as NetworkEvent;
|
|
356
|
-
|
|
357
|
-
return (
|
|
358
|
-
<NetworkEventItemCompact
|
|
359
|
-
event={networkEvent}
|
|
360
|
-
onPress={() => onPress()}
|
|
361
|
-
/>
|
|
362
|
-
);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// For route events, try to use the shared RouteEventItemCompact component
|
|
366
|
-
if (event.source === "route" && optionalComponents.RouteEventItemCompact) {
|
|
367
|
-
const { RouteEventItemCompact } = optionalComponents;
|
|
368
|
-
const routeEvent = event.originalEvent as RouteChangeEvent;
|
|
369
|
-
|
|
370
|
-
return (
|
|
371
|
-
<SourceBadgeWrapper source={event.source}>
|
|
372
|
-
<RouteEventItemCompact
|
|
373
|
-
event={routeEvent}
|
|
374
|
-
visitNumber={0}
|
|
375
|
-
isExpanded={isExpanded}
|
|
376
|
-
onPress={() => onPress()}
|
|
377
|
-
onNavigate={onNavigate}
|
|
378
|
-
/>
|
|
379
|
-
</SourceBadgeWrapper>
|
|
380
|
-
);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// For Zustand events, try to use the shared ZustandStateChangeItem component
|
|
384
|
-
if (event.source === "zustand" && optionalComponents.ZustandStateChangeItem) {
|
|
385
|
-
const { ZustandStateChangeItem } = optionalComponents;
|
|
386
|
-
|
|
387
|
-
return (
|
|
388
|
-
<SourceBadgeWrapper source={event.source}>
|
|
389
|
-
<ZustandStateChangeItem
|
|
390
|
-
change={event.originalEvent}
|
|
391
|
-
onPress={() => onPress()}
|
|
392
|
-
/>
|
|
393
|
-
</SourceBadgeWrapper>
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
// For Jotai events, try to use the shared JotaiAtomChangeItem component
|
|
398
|
-
if (event.source === "jotai" && optionalComponents.JotaiAtomChangeItem) {
|
|
399
|
-
const { JotaiAtomChangeItem } = optionalComponents;
|
|
400
|
-
|
|
401
|
-
return (
|
|
402
|
-
<SourceBadgeWrapper source={event.source}>
|
|
403
|
-
<JotaiAtomChangeItem
|
|
404
|
-
change={event.originalEvent}
|
|
405
|
-
onPress={() => onPress()}
|
|
406
|
-
/>
|
|
407
|
-
</SourceBadgeWrapper>
|
|
408
|
-
);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
// Fallback: Use CompactRow for all events when specific components aren't available
|
|
412
|
-
const customBadge =
|
|
413
|
-
correlationLabel && correlationColor ? (
|
|
414
|
-
<CorrelationBadge label={correlationLabel} color={correlationColor} />
|
|
415
|
-
) : null;
|
|
416
|
-
|
|
417
|
-
return (
|
|
418
|
-
<CompactRow
|
|
419
|
-
// Status section - shows source type
|
|
420
|
-
statusDotColor={sourceConfig.color}
|
|
421
|
-
statusLabel={sourceConfig.label}
|
|
422
|
-
// Content section - shows event details
|
|
423
|
-
primaryText={event.title}
|
|
424
|
-
secondaryText={event.subtitle}
|
|
425
|
-
// Badge section - shows correlation indicator for linked events
|
|
426
|
-
badgeText={correlationCount > 1 && !correlationLabel ? `${correlationCount}` : ""}
|
|
427
|
-
badgeColor={correlationColor || statusColor}
|
|
428
|
-
customBadge={customBadge}
|
|
429
|
-
// Timestamp at bottom right
|
|
430
|
-
bottomRightText={formatRelativeTime(new Date(event.timestamp))}
|
|
431
|
-
// Interaction
|
|
432
|
-
showChevron={true}
|
|
433
|
-
isSelected={isSelected}
|
|
434
|
-
onPress={onPress}
|
|
435
|
-
/>
|
|
436
|
-
);
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
const styles = StyleSheet.create({
|
|
440
|
-
correlationBadge: {
|
|
441
|
-
paddingHorizontal: 8,
|
|
442
|
-
paddingVertical: 2,
|
|
443
|
-
borderRadius: 10,
|
|
444
|
-
marginLeft: 6,
|
|
445
|
-
},
|
|
446
|
-
correlationText: {
|
|
447
|
-
fontSize: 11,
|
|
448
|
-
fontWeight: "600",
|
|
449
|
-
},
|
|
450
|
-
badgeWrapper: {
|
|
451
|
-
position: "relative",
|
|
452
|
-
},
|
|
453
|
-
sourceBadge: {
|
|
454
|
-
position: "absolute",
|
|
455
|
-
top: 4,
|
|
456
|
-
right: 12,
|
|
457
|
-
paddingHorizontal: 6,
|
|
458
|
-
paddingVertical: 2,
|
|
459
|
-
borderRadius: 4,
|
|
460
|
-
zIndex: 10,
|
|
461
|
-
},
|
|
462
|
-
sourceBadgeText: {
|
|
463
|
-
fontSize: 8,
|
|
464
|
-
fontWeight: "700",
|
|
465
|
-
letterSpacing: 0.5,
|
|
466
|
-
},
|
|
467
|
-
});
|