@buoy-gg/events 7.0.29 → 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.
@@ -1,216 +0,0 @@
1
- /**
2
- * UnifiedEventList
3
- *
4
- * Scrollable list of unified events with empty state handling.
5
- */
6
-
7
- import { FlatList, StyleSheet, View, Text, TouchableOpacity } from "react-native";
8
- import { memo, useCallback, useMemo } from "react";
9
- import { night, Lock, Zap, ProBadge } from "@buoy-gg/shared-ui";
10
- import { UnifiedEventItem } from "./UnifiedEventItem";
11
- import type { UnifiedEvent } from "../types";
12
- import {
13
- buildCorrelationCountMap,
14
- getCorrelationLabel,
15
- getCorrelationColor,
16
- } from "../utils/correlationUtils";
17
-
18
- interface UnifiedEventListProps {
19
- /** Events to display */
20
- events: UnifiedEvent[];
21
-
22
- /** Currently selected event ID */
23
- selectedEventId?: string;
24
-
25
- /** Currently expanded event ID (for route events) */
26
- expandedEventId?: string | null;
27
-
28
- /** Called when an event is pressed */
29
- onEventPress: (event: UnifiedEvent) => void;
30
-
31
- /** Called when navigating to a route */
32
- onNavigate?: (pathname: string) => void;
33
-
34
- /** Whether events are being captured */
35
- isCapturing: boolean;
36
-
37
- /** Number of hidden events (for free tier limit) */
38
- hiddenEventsCount?: number;
39
-
40
- /** Called when upgrade banner is pressed */
41
- onUpgradePress?: () => void;
42
-
43
- /** Active header search query — only used to explain an empty list */
44
- searchText?: string;
45
- }
46
-
47
- export const UnifiedEventList = memo(function UnifiedEventList({
48
- events,
49
- selectedEventId,
50
- expandedEventId,
51
- onEventPress,
52
- onNavigate,
53
- isCapturing,
54
- hiddenEventsCount = 0,
55
- onUpgradePress,
56
- searchText = "",
57
- }: UnifiedEventListProps) {
58
- // Precompute correlation counts for efficient rendering
59
- const correlationCountMap = useMemo(
60
- () => buildCorrelationCountMap(events),
61
- [events]
62
- );
63
-
64
- const renderItem = useCallback(
65
- ({ item }: { item: UnifiedEvent }) => {
66
- // Get correlation info for this event
67
- const correlationCount = item.correlationId
68
- ? correlationCountMap.get(item.correlationId) || 1
69
- : 1;
70
- const correlationLabel = getCorrelationLabel(item, events);
71
- const correlationColor = item.correlationId
72
- ? getCorrelationColor(item.correlationId)
73
- : undefined;
74
-
75
- return (
76
- <UnifiedEventItem
77
- event={item}
78
- isSelected={item.id === selectedEventId}
79
- isExpanded={item.id === expandedEventId}
80
- onPress={() => onEventPress(item)}
81
- onNavigate={onNavigate}
82
- correlationCount={correlationCount}
83
- correlationLabel={correlationLabel}
84
- correlationColor={correlationColor}
85
- />
86
- );
87
- },
88
- [selectedEventId, expandedEventId, onEventPress, onNavigate, correlationCountMap, events]
89
- );
90
-
91
- const keyExtractor = useCallback((item: UnifiedEvent) => item.id, []);
92
-
93
- // Footer showing hidden events count for free tier
94
- const renderFooter = useCallback(() => {
95
- if (hiddenEventsCount <= 0) return null;
96
-
97
- return (
98
- <TouchableOpacity
99
- style={styles.hiddenBanner}
100
- onPress={onUpgradePress}
101
- activeOpacity={0.8}
102
- >
103
- <View style={styles.hiddenBannerLeft}>
104
- <Zap size={16} color={night.color.accent} />
105
- <Text style={styles.hiddenBannerText}>
106
- {hiddenEventsCount} hidden event{hiddenEventsCount !== 1 ? "s" : ""}
107
- </Text>
108
- </View>
109
- <ProBadge />
110
- </TouchableOpacity>
111
- );
112
- }, [hiddenEventsCount, onUpgradePress]);
113
-
114
- if (events.length === 0) {
115
- // A search that matched nothing looks identical to "nothing captured yet" —
116
- // say which one it is, so the header field isn't mistaken for a dead tool.
117
- if (searchText.trim().length > 0) {
118
- return (
119
- <View style={styles.emptyContainer}>
120
- <Text style={styles.emptyTitle}>No Matches</Text>
121
- <Text style={styles.emptyMessage}>
122
- {`No events match "${searchText.trim()}".`}
123
- </Text>
124
- </View>
125
- );
126
- }
127
-
128
- return (
129
- <View style={styles.emptyContainer}>
130
- <Text style={styles.emptyTitle}>
131
- {isCapturing ? "No Events Yet" : "Not Capturing"}
132
- </Text>
133
- <Text style={styles.emptyMessage}>
134
- {isCapturing
135
- ? "Events will appear here as they occur.\nTry interacting with your app."
136
- : "Event capture is paused. Resume to see events."}
137
- </Text>
138
- </View>
139
- );
140
- }
141
-
142
- return (
143
- <FlatList
144
- data={events}
145
- renderItem={renderItem}
146
- keyExtractor={keyExtractor}
147
- style={styles.list}
148
- contentContainerStyle={styles.listContent}
149
- ItemSeparatorComponent={() => <View style={styles.separator} />}
150
- ListFooterComponent={renderFooter}
151
- showsVerticalScrollIndicator={true}
152
- initialNumToRender={15}
153
- maxToRenderPerBatch={10}
154
- windowSize={10}
155
- removeClippedSubviews
156
- />
157
- );
158
- });
159
-
160
- const styles = StyleSheet.create({
161
- list: {
162
- flex: 1,
163
- // Transparent so JsModal's ToolBackground shows through (the modal paints opaque base beneath it).
164
- backgroundColor: "transparent",
165
- },
166
- listContent: {
167
- paddingVertical: 16,
168
- },
169
- separator: {
170
- height: 8,
171
- },
172
- emptyContainer: {
173
- flex: 1,
174
- justifyContent: "center",
175
- alignItems: "center",
176
- // Transparent so JsModal's ToolBackground shows through (the modal paints opaque base beneath it).
177
- backgroundColor: "transparent",
178
- padding: 24,
179
- },
180
- emptyTitle: {
181
- fontSize: 18,
182
- fontWeight: "600",
183
- color: night.color.text,
184
- marginBottom: 8,
185
- },
186
- emptyMessage: {
187
- fontSize: 14,
188
- color: night.color.textTertiary,
189
- textAlign: "center",
190
- lineHeight: 20,
191
- },
192
- hiddenBanner: {
193
- flexDirection: "row",
194
- alignItems: "center",
195
- justifyContent: "space-between",
196
- marginHorizontal: 16,
197
- marginTop: 8,
198
- marginBottom: 16,
199
- paddingVertical: 12,
200
- paddingHorizontal: 16,
201
- backgroundColor: night.color.surface,
202
- borderRadius: 8,
203
- borderWidth: 1,
204
- borderColor: night.color.border,
205
- },
206
- hiddenBannerLeft: {
207
- flexDirection: "row",
208
- alignItems: "center",
209
- gap: 8,
210
- },
211
- hiddenBannerText: {
212
- fontSize: 13,
213
- fontWeight: "500",
214
- color: night.color.text,
215
- },
216
- });
@@ -1,133 +0,0 @@
1
- /**
2
- * UnifiedEventViewer
3
- *
4
- * Main component for the unified event timeline.
5
- * Shows events from all sources with filtering and detail view.
6
- */
7
-
8
- import { View, StyleSheet, TouchableOpacity, Text } from "react-native";
9
- import { useState, useCallback } from "react";
10
- import { night, Trash2 } from "@buoy-gg/shared-ui";
11
- import { useUnifiedEvents } from "../hooks/useUnifiedEvents";
12
- import { UnifiedEventFilters } from "./UnifiedEventFilters";
13
- import { UnifiedEventList } from "./UnifiedEventList";
14
- import { UnifiedEventDetail } from "./UnifiedEventDetail";
15
- import type { UnifiedEvent } from "../types";
16
-
17
- export function UnifiedEventViewer() {
18
- const {
19
- filteredEvents,
20
- availableSources,
21
- toggleSource,
22
- clearEvents,
23
- totalCount,
24
- filteredCount,
25
- isCapturing,
26
- } = useUnifiedEvents();
27
-
28
- const [selectedEvent, setSelectedEvent] = useState<UnifiedEvent | null>(null);
29
-
30
- const handleEventPress = useCallback((event: UnifiedEvent) => {
31
- setSelectedEvent(event);
32
- }, []);
33
-
34
- const handleBack = useCallback(() => {
35
- setSelectedEvent(null);
36
- }, []);
37
-
38
- // Show detail view if an event is selected
39
- if (selectedEvent) {
40
- return <UnifiedEventDetail event={selectedEvent} onBack={handleBack} />;
41
- }
42
-
43
- return (
44
- <View style={styles.container}>
45
- {/* Header with title and clear button */}
46
- <View style={styles.header}>
47
- <View>
48
- <Text style={styles.title}>Events</Text>
49
- <Text style={styles.subtitle}>
50
- {totalCount} event{totalCount !== 1 ? "s" : ""} captured
51
- </Text>
52
- </View>
53
-
54
- <TouchableOpacity
55
- style={styles.clearButton}
56
- onPress={clearEvents}
57
- activeOpacity={0.7}
58
- disabled={totalCount === 0}
59
- >
60
- <Trash2
61
- size={16}
62
- color={totalCount === 0 ? night.color.textTertiary : night.color.danger}
63
- />
64
- <Text
65
- style={[
66
- styles.clearText,
67
- { color: totalCount === 0 ? night.color.textTertiary : night.color.danger },
68
- ]}
69
- >
70
- Clear
71
- </Text>
72
- </TouchableOpacity>
73
- </View>
74
-
75
- {/* Filters */}
76
- <UnifiedEventFilters
77
- availableSources={availableSources}
78
- onToggleSource={toggleSource}
79
- totalCount={totalCount}
80
- filteredCount={filteredCount}
81
- />
82
-
83
- {/* Event List */}
84
- <UnifiedEventList
85
- events={filteredEvents}
86
- selectedEventId={undefined}
87
- onEventPress={handleEventPress}
88
- isCapturing={isCapturing}
89
- />
90
- </View>
91
- );
92
- }
93
-
94
- const styles = StyleSheet.create({
95
- container: {
96
- flex: 1,
97
- // Transparent so the night sheet's star field shows through.
98
- backgroundColor: "transparent",
99
- },
100
- header: {
101
- flexDirection: "row",
102
- justifyContent: "space-between",
103
- alignItems: "center",
104
- paddingHorizontal: 16,
105
- paddingVertical: 12,
106
- backgroundColor: night.color.surface,
107
- borderBottomWidth: 1,
108
- borderBottomColor: night.color.border,
109
- },
110
- title: {
111
- fontSize: 20,
112
- fontWeight: "700",
113
- color: night.color.text,
114
- },
115
- subtitle: {
116
- fontSize: 12,
117
- color: night.color.textTertiary,
118
- marginTop: 2,
119
- },
120
- clearButton: {
121
- flexDirection: "row",
122
- alignItems: "center",
123
- gap: 6,
124
- paddingHorizontal: 12,
125
- paddingVertical: 8,
126
- borderRadius: 6,
127
- backgroundColor: night.color.dangerSoft,
128
- },
129
- clearText: {
130
- fontSize: 14,
131
- fontWeight: "600",
132
- },
133
- });