@buoy-gg/storage 2.1.5 → 2.1.8

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,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import { View, Text, StyleSheet, TouchableOpacity } from "react-native";
4
- import { macOSColors, CompactRow, TypeBadge, HardDrive, Square, CheckSquare } from "@buoy-gg/shared-ui";
4
+ import { macOSColors, CompactRow, TypeBadge, HardDrive, Square, CheckSquare, ExpandedInfoRow, PillBadge } from "@buoy-gg/shared-ui";
5
5
  import { getStorageTypeLabel } from "../utils/storageQueryUtils";
6
6
  import { getValueTypeLabel } from "../utils/valueType";
7
7
  import { DataViewer } from "@buoy-gg/shared-ui/dataViewer";
@@ -76,7 +76,9 @@ export function StorageKeyRow({
76
76
  onPress,
77
77
  isSelectMode = false,
78
78
  isSelected = false,
79
- onSelectionChange
79
+ onSelectionChange,
80
+ eventCount,
81
+ onViewHistory
80
82
  }) {
81
83
  const config = getStatusConfig(storageKey.status);
82
84
  const hasValue = storageKey.value !== undefined && storageKey.value !== null;
@@ -103,42 +105,40 @@ export function StorageKeyRow({
103
105
  // Create expanded content for value and storage details
104
106
  const expandedContent = /*#__PURE__*/_jsxs(View, {
105
107
  style: styles.expandedContainer,
106
- children: [/*#__PURE__*/_jsxs(View, {
107
- style: styles.expandedRow,
108
- children: [/*#__PURE__*/_jsx(Text, {
109
- style: styles.expandedLabel,
110
- children: "Storage:"
111
- }), /*#__PURE__*/_jsx(View, {
112
- style: [styles.storageBadge, {
113
- backgroundColor: getStorageTypeColor(storageKey.storageType) + "12",
114
- borderColor: getStorageTypeColor(storageKey.storageType) + "25"
115
- }],
116
- children: /*#__PURE__*/_jsx(Text, {
117
- style: [styles.storageBadgeText, {
118
- color: getStorageTypeColor(storageKey.storageType)
119
- }],
120
- children: storageTypeLabel
121
- })
122
- })]
123
- }), storageKey.storageType === 'mmkv' && storageKey.instanceId && /*#__PURE__*/_jsxs(View, {
124
- style: styles.expandedRow,
125
- children: [/*#__PURE__*/_jsx(Text, {
126
- style: styles.expandedLabel,
127
- children: "Instance:"
128
- }), /*#__PURE__*/_jsxs(View, {
129
- style: [styles.instanceBadge, {
130
- backgroundColor: getInstanceColor(storageKey.instanceId) + '20',
131
- borderColor: getInstanceColor(storageKey.instanceId) + '40'
132
- }],
133
- children: [/*#__PURE__*/_jsx(HardDrive, {
108
+ children: [/*#__PURE__*/_jsx(ExpandedInfoRow, {
109
+ label: "Storage",
110
+ children: /*#__PURE__*/_jsx(PillBadge, {
111
+ color: getStorageTypeColor(storageKey.storageType),
112
+ children: storageTypeLabel
113
+ })
114
+ }), storageKey.storageType === 'mmkv' && storageKey.instanceId && /*#__PURE__*/_jsx(ExpandedInfoRow, {
115
+ label: "Instance",
116
+ children: /*#__PURE__*/_jsx(PillBadge, {
117
+ color: getInstanceColor(storageKey.instanceId),
118
+ icon: /*#__PURE__*/_jsx(HardDrive, {
134
119
  size: 9,
135
120
  color: getInstanceColor(storageKey.instanceId)
136
- }), /*#__PURE__*/_jsx(Text, {
137
- style: [styles.instanceText, {
138
- color: getInstanceColor(storageKey.instanceId)
139
- }],
140
- children: storageKey.instanceId
141
- })]
121
+ }),
122
+ children: storageKey.instanceId
123
+ })
124
+ }), eventCount != null && eventCount > 0 && /*#__PURE__*/_jsxs(ExpandedInfoRow, {
125
+ label: "Updates",
126
+ children: [/*#__PURE__*/_jsx(PillBadge, {
127
+ color: macOSColors.semantic.warning,
128
+ children: String(eventCount)
129
+ }), eventCount > 1 && onViewHistory && /*#__PURE__*/_jsx(TouchableOpacity, {
130
+ onPress: onViewHistory,
131
+ style: styles.viewHistoryButton,
132
+ hitSlop: {
133
+ top: 6,
134
+ bottom: 6,
135
+ left: 6,
136
+ right: 6
137
+ },
138
+ children: /*#__PURE__*/_jsx(Text, {
139
+ style: styles.viewHistoryText,
140
+ children: "view history \u2192"
141
+ })
142
142
  })]
143
143
  }), isJsonData && typeof parsedValue === "object" ? /*#__PURE__*/_jsx(View, {
144
144
  style: styles.dataViewerContainer,
@@ -195,20 +195,6 @@ export function StorageKeyRow({
195
195
  })]
196
196
  });
197
197
 
198
- // Create storage type badge
199
- const storageBadge = /*#__PURE__*/_jsx(View, {
200
- style: [styles.storageBadge, {
201
- backgroundColor: getStorageTypeColor(storageKey.storageType) + "12",
202
- borderColor: getStorageTypeColor(storageKey.storageType) + "25"
203
- }],
204
- children: /*#__PURE__*/_jsx(Text, {
205
- style: [styles.storageBadgeText, {
206
- color: getStorageTypeColor(storageKey.storageType)
207
- }],
208
- children: storageTypeLabel
209
- })
210
- });
211
-
212
198
  // Handle checkbox press in select mode
213
199
  const handleCheckboxPress = () => {
214
200
  onSelectionChange?.(storageKey, !isSelected);
@@ -234,9 +220,9 @@ export function StorageKeyRow({
234
220
  }) : null;
235
221
  return /*#__PURE__*/_jsxs(View, {
236
222
  style: [styles.rowContainer, isSelected && styles.rowContainerSelected],
237
- children: [selectionCheckbox, /*#__PURE__*/_jsx(View, {
223
+ children: [selectionCheckbox, /*#__PURE__*/_jsxs(View, {
238
224
  style: styles.compactRowWrapper,
239
- children: /*#__PURE__*/_jsx(CompactRow, {
225
+ children: [/*#__PURE__*/_jsx(CompactRow, {
240
226
  statusDotColor: config.color,
241
227
  statusLabel: config.label,
242
228
  statusSublabel: config.sublabel,
@@ -245,10 +231,25 @@ export function StorageKeyRow({
245
231
  expandedContent: expandedContent,
246
232
  isExpanded: isExpanded,
247
233
  expandedGlowColor: config.color,
248
- customBadge: storageBadge,
234
+ customBadge: /*#__PURE__*/_jsx(PillBadge, {
235
+ color: getStorageTypeColor(storageKey.storageType),
236
+ children: storageTypeLabel
237
+ }),
249
238
  showChevron: !isSelectMode,
250
239
  onPress: isSelectMode ? handleCheckboxPress : onPress ? () => onPress(storageKey) : undefined
251
- })
240
+ }), eventCount != null && eventCount > 0 && /*#__PURE__*/_jsx(View, {
241
+ style: [styles.absCountBadge, {
242
+ backgroundColor: macOSColors.semantic.warning + "22",
243
+ borderColor: macOSColors.semantic.warning + "55"
244
+ }],
245
+ pointerEvents: "none",
246
+ children: /*#__PURE__*/_jsx(Text, {
247
+ style: [styles.absCountText, {
248
+ color: macOSColors.semantic.warning
249
+ }],
250
+ children: String(eventCount)
251
+ })
252
+ })]
252
253
  })]
253
254
  });
254
255
  }
@@ -306,33 +307,6 @@ const styles = StyleSheet.create({
306
307
  borderColor: macOSColors.border.default,
307
308
  padding: 6
308
309
  },
309
- storageBadge: {
310
- paddingHorizontal: 8,
311
- paddingVertical: 3,
312
- borderRadius: 999,
313
- borderWidth: 1
314
- },
315
- storageBadgeText: {
316
- fontSize: 10,
317
- fontWeight: "700",
318
- fontFamily: "monospace",
319
- letterSpacing: 0.5
320
- },
321
- instanceBadge: {
322
- paddingHorizontal: 8,
323
- paddingVertical: 3,
324
- borderRadius: 999,
325
- borderWidth: 1,
326
- flexDirection: 'row',
327
- alignItems: 'center',
328
- gap: 4
329
- },
330
- instanceText: {
331
- fontSize: 10,
332
- fontWeight: "700",
333
- fontFamily: "monospace",
334
- letterSpacing: 0.3
335
- },
336
310
  rowContainer: {
337
311
  flexDirection: "row",
338
312
  alignItems: "flex-start"
@@ -349,5 +323,29 @@ const styles = StyleSheet.create({
349
323
  },
350
324
  compactRowWrapper: {
351
325
  flex: 1
326
+ },
327
+ absCountBadge: {
328
+ position: "absolute",
329
+ top: 4,
330
+ right: 10,
331
+ paddingHorizontal: 5,
332
+ paddingVertical: 1,
333
+ borderRadius: 4,
334
+ borderWidth: 1,
335
+ zIndex: 1
336
+ },
337
+ absCountText: {
338
+ fontSize: 9,
339
+ fontWeight: "700",
340
+ fontFamily: "monospace"
341
+ },
342
+ viewHistoryButton: {
343
+ marginLeft: 4
344
+ },
345
+ viewHistoryText: {
346
+ fontSize: 10,
347
+ fontWeight: "600",
348
+ fontFamily: "monospace",
349
+ color: macOSColors.semantic.info
352
350
  }
353
351
  });
@@ -21,7 +21,9 @@ export function StorageKeySection({
21
21
  headerColor,
22
22
  isSelectMode = false,
23
23
  selectedKeys = new Set(),
24
- onSelectionChange
24
+ onSelectionChange,
25
+ eventCountByKey,
26
+ onViewHistory
25
27
  }) {
26
28
  const [expandedKey, setExpandedKey] = useState(null);
27
29
  const handleKeyPress = useCallback(storageKey => {
@@ -72,7 +74,9 @@ export function StorageKeySection({
72
74
  onPress: handleKeyPress,
73
75
  isSelectMode: isSelectMode,
74
76
  isSelected: selectedKeys.has(uniqueKey),
75
- onSelectionChange: onSelectionChange
77
+ onSelectionChange: onSelectionChange,
78
+ eventCount: eventCountByKey?.[storageKey.key],
79
+ onViewHistory: onViewHistory ? () => onViewHistory(storageKey.key) : undefined
76
80
  }, uniqueKey);
77
81
  })
78
82
  })]