react-native-inapp-inspector 1.0.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/LICENSE +21 -0
- package/README.md +97 -0
- package/dist/commonjs/components/AnalyticsDetail.d.ts +6 -0
- package/dist/commonjs/components/AnalyticsDetail.js +558 -0
- package/dist/commonjs/components/AnalyticsEventCard.d.ts +18 -0
- package/dist/commonjs/components/AnalyticsEventCard.js +327 -0
- package/dist/commonjs/components/AnalyticsGraph.d.ts +8 -0
- package/dist/commonjs/components/AnalyticsGraph.js +416 -0
- package/dist/commonjs/components/CodeSnippet.d.ts +8 -0
- package/dist/commonjs/components/CodeSnippet.js +427 -0
- package/dist/commonjs/components/ConsoleLogCard.d.ts +10 -0
- package/dist/commonjs/components/ConsoleLogCard.js +401 -0
- package/dist/commonjs/components/CopyButton.d.ts +4 -0
- package/dist/commonjs/components/CopyButton.js +69 -0
- package/dist/commonjs/components/DiffViewer.d.ts +7 -0
- package/dist/commonjs/components/DiffViewer.js +86 -0
- package/dist/commonjs/components/DomainHeader.d.ts +18 -0
- package/dist/commonjs/components/DomainHeader.js +136 -0
- package/dist/commonjs/components/EmptyState.d.ts +5 -0
- package/dist/commonjs/components/EmptyState.js +40 -0
- package/dist/commonjs/components/HeadersSection.d.ts +4 -0
- package/dist/commonjs/components/HeadersSection.js +155 -0
- package/dist/commonjs/components/HighlightText.d.ts +3 -0
- package/dist/commonjs/components/HighlightText.js +57 -0
- package/dist/commonjs/components/JsonViewer.d.ts +7 -0
- package/dist/commonjs/components/JsonViewer.js +19 -0
- package/dist/commonjs/components/LogCard.d.ts +4 -0
- package/dist/commonjs/components/LogCard.js +179 -0
- package/dist/commonjs/components/MetaAccordion.d.ts +4 -0
- package/dist/commonjs/components/MetaAccordion.js +113 -0
- package/dist/commonjs/components/MiniBarChart.d.ts +7 -0
- package/dist/commonjs/components/MiniBarChart.js +56 -0
- package/dist/commonjs/components/MiniLineChart.d.ts +6 -0
- package/dist/commonjs/components/MiniLineChart.js +58 -0
- package/dist/commonjs/components/NetworkIcons.d.ts +31 -0
- package/dist/commonjs/components/NetworkIcons.js +245 -0
- package/dist/commonjs/components/SectionHeader.d.ts +4 -0
- package/dist/commonjs/components/SectionHeader.js +87 -0
- package/dist/commonjs/components/SourcePageCard.d.ts +4 -0
- package/dist/commonjs/components/SourcePageCard.js +132 -0
- package/dist/commonjs/components/TouchableScale.d.ts +9 -0
- package/dist/commonjs/components/TouchableScale.js +44 -0
- package/dist/commonjs/components/TreeNode.d.ts +4 -0
- package/dist/commonjs/components/TreeNode.js +140 -0
- package/dist/commonjs/constants/index.d.ts +7 -0
- package/dist/commonjs/constants/index.js +35 -0
- package/dist/commonjs/customHooks/analyticsLogger.d.ts +21 -0
- package/dist/commonjs/customHooks/analyticsLogger.js +160 -0
- package/dist/commonjs/customHooks/consoleLogger.d.ts +5 -0
- package/dist/commonjs/customHooks/consoleLogger.js +141 -0
- package/dist/commonjs/customHooks/logFilters.d.ts +5 -0
- package/dist/commonjs/customHooks/logFilters.js +34 -0
- package/dist/commonjs/customHooks/networkLogger.d.ts +20 -0
- package/dist/commonjs/customHooks/networkLogger.js +272 -0
- package/dist/commonjs/customHooks/useAccordion.d.ts +17 -0
- package/dist/commonjs/customHooks/useAccordion.js +48 -0
- package/dist/commonjs/customHooks/webViewLogger.d.ts +22 -0
- package/dist/commonjs/customHooks/webViewLogger.js +412 -0
- package/dist/commonjs/helpers/index.d.ts +20 -0
- package/dist/commonjs/helpers/index.js +229 -0
- package/dist/commonjs/index.d.ts +7 -0
- package/dist/commonjs/index.js +2668 -0
- package/dist/commonjs/styles/AppColors.d.ts +27 -0
- package/dist/commonjs/styles/AppColors.js +30 -0
- package/dist/commonjs/styles/AppFonts.d.ts +7 -0
- package/dist/commonjs/styles/AppFonts.js +10 -0
- package/dist/commonjs/styles/index.d.ts +1488 -0
- package/dist/commonjs/styles/index.js +1357 -0
- package/dist/commonjs/types/index.d.ts +127 -0
- package/dist/commonjs/types/index.js +2 -0
- package/dist/esm/components/AnalyticsDetail.d.ts +6 -0
- package/dist/esm/components/AnalyticsDetail.js +520 -0
- package/dist/esm/components/AnalyticsEventCard.d.ts +18 -0
- package/dist/esm/components/AnalyticsEventCard.js +288 -0
- package/dist/esm/components/AnalyticsGraph.d.ts +8 -0
- package/dist/esm/components/AnalyticsGraph.js +378 -0
- package/dist/esm/components/CodeSnippet.d.ts +8 -0
- package/dist/esm/components/CodeSnippet.js +392 -0
- package/dist/esm/components/ConsoleLogCard.d.ts +10 -0
- package/dist/esm/components/ConsoleLogCard.js +362 -0
- package/dist/esm/components/CopyButton.d.ts +4 -0
- package/dist/esm/components/CopyButton.js +31 -0
- package/dist/esm/components/DiffViewer.d.ts +7 -0
- package/dist/esm/components/DiffViewer.js +48 -0
- package/dist/esm/components/DomainHeader.d.ts +18 -0
- package/dist/esm/components/DomainHeader.js +98 -0
- package/dist/esm/components/EmptyState.d.ts +5 -0
- package/dist/esm/components/EmptyState.js +35 -0
- package/dist/esm/components/HeadersSection.d.ts +4 -0
- package/dist/esm/components/HeadersSection.js +117 -0
- package/dist/esm/components/HighlightText.d.ts +3 -0
- package/dist/esm/components/HighlightText.js +52 -0
- package/dist/esm/components/JsonViewer.d.ts +7 -0
- package/dist/esm/components/JsonViewer.js +14 -0
- package/dist/esm/components/LogCard.d.ts +4 -0
- package/dist/esm/components/LogCard.js +141 -0
- package/dist/esm/components/MetaAccordion.d.ts +4 -0
- package/dist/esm/components/MetaAccordion.js +108 -0
- package/dist/esm/components/MiniBarChart.d.ts +7 -0
- package/dist/esm/components/MiniBarChart.js +18 -0
- package/dist/esm/components/MiniLineChart.d.ts +6 -0
- package/dist/esm/components/MiniLineChart.js +20 -0
- package/dist/esm/components/NetworkIcons.d.ts +31 -0
- package/dist/esm/components/NetworkIcons.js +176 -0
- package/dist/esm/components/SectionHeader.d.ts +4 -0
- package/dist/esm/components/SectionHeader.js +49 -0
- package/dist/esm/components/SourcePageCard.d.ts +4 -0
- package/dist/esm/components/SourcePageCard.js +94 -0
- package/dist/esm/components/TouchableScale.d.ts +9 -0
- package/dist/esm/components/TouchableScale.js +9 -0
- package/dist/esm/components/TreeNode.d.ts +4 -0
- package/dist/esm/components/TreeNode.js +102 -0
- package/dist/esm/constants/index.d.ts +7 -0
- package/dist/esm/constants/index.js +32 -0
- package/dist/esm/customHooks/analyticsLogger.d.ts +21 -0
- package/dist/esm/customHooks/analyticsLogger.js +152 -0
- package/dist/esm/customHooks/consoleLogger.d.ts +5 -0
- package/dist/esm/customHooks/consoleLogger.js +134 -0
- package/dist/esm/customHooks/logFilters.d.ts +5 -0
- package/dist/esm/customHooks/logFilters.js +31 -0
- package/dist/esm/customHooks/networkLogger.d.ts +20 -0
- package/dist/esm/customHooks/networkLogger.js +264 -0
- package/dist/esm/customHooks/useAccordion.d.ts +17 -0
- package/dist/esm/customHooks/useAccordion.js +46 -0
- package/dist/esm/customHooks/webViewLogger.d.ts +22 -0
- package/dist/esm/customHooks/webViewLogger.js +365 -0
- package/dist/esm/helpers/index.d.ts +20 -0
- package/dist/esm/helpers/index.js +207 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +2611 -0
- package/dist/esm/styles/AppColors.d.ts +27 -0
- package/dist/esm/styles/AppColors.js +27 -0
- package/dist/esm/styles/AppFonts.d.ts +7 -0
- package/dist/esm/styles/AppFonts.js +7 -0
- package/dist/esm/styles/index.d.ts +1488 -0
- package/dist/esm/styles/index.js +1355 -0
- package/dist/esm/types/index.d.ts +127 -0
- package/dist/esm/types/index.js +1 -0
- package/fonts/Inter/Inter.ttc +0 -0
- package/fonts/Inter/InterVariable-Italic.ttf +0 -0
- package/fonts/Inter/InterVariable.ttf +0 -0
- package/fonts/Inter/LICENSE.txt +92 -0
- package/fonts/Inter/extras/otf/Inter-Black.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-BlackItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Bold.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-BoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ExtraBold.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ExtraBoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ExtraLight.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ExtraLightItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Italic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Light.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-LightItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Medium.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-MediumItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Regular.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-SemiBold.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-SemiBoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Thin.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ThinItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Black.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-BlackItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Bold.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-BoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ExtraBold.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ExtraBoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ExtraLight.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ExtraLightItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Italic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Light.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-LightItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Medium.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-MediumItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Regular.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-SemiBold.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-SemiBoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Thin.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ThinItalic.otf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Black.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-BlackItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Bold.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-BoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ExtraBold.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ExtraBoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ExtraLight.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ExtraLightItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Italic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Light.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-LightItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Medium.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-MediumItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Regular.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-SemiBold.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-SemiBoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Thin.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ThinItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Black.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-BlackItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Bold.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-BoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ExtraBold.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ExtraBoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ExtraLight.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ExtraLightItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Italic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Light.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-LightItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Medium.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-MediumItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Regular.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-SemiBold.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-SemiBoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Thin.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ThinItalic.ttf +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Black.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-BlackItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Bold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-BoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ExtraBold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ExtraLight.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Italic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Light.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-LightItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Medium.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-MediumItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Regular.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-SemiBold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Thin.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ThinItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Black.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-BlackItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Bold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-BoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraBold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraLight.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Italic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Light.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-LightItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Medium.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-MediumItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Regular.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-SemiBold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Thin.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ThinItalic.woff2 +0 -0
- package/fonts/Inter/help.txt +165 -0
- package/fonts/Inter/web/Inter-Black.woff2 +0 -0
- package/fonts/Inter/web/Inter-BlackItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Bold.woff2 +0 -0
- package/fonts/Inter/web/Inter-BoldItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-ExtraBold.woff2 +0 -0
- package/fonts/Inter/web/Inter-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-ExtraLight.woff2 +0 -0
- package/fonts/Inter/web/Inter-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Italic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Light.woff2 +0 -0
- package/fonts/Inter/web/Inter-LightItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Medium.woff2 +0 -0
- package/fonts/Inter/web/Inter-MediumItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Regular.woff2 +0 -0
- package/fonts/Inter/web/Inter-SemiBold.woff2 +0 -0
- package/fonts/Inter/web/Inter-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Thin.woff2 +0 -0
- package/fonts/Inter/web/Inter-ThinItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Black.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-BlackItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Bold.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-BoldItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ExtraBold.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ExtraLight.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Italic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Light.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-LightItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Medium.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-MediumItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Regular.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-SemiBold.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Thin.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ThinItalic.woff2 +0 -0
- package/fonts/Inter/web/InterVariable-Italic.woff2 +0 -0
- package/fonts/Inter/web/InterVariable.woff2 +0 -0
- package/fonts/Inter/web/inter.css +148 -0
- package/package.json +52 -0
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { StyleSheet, Text, View, Pressable, Platform } from 'react-native';
|
|
3
|
+
import { AppColors } from '../styles/AppColors';
|
|
4
|
+
import { AppFonts } from '../styles/AppFonts';
|
|
5
|
+
import HighlightText from './HighlightText';
|
|
6
|
+
import CopyButton from './CopyButton';
|
|
7
|
+
import { ChevronIcon } from './NetworkIcons';
|
|
8
|
+
import JsonViewer from './JsonViewer';
|
|
9
|
+
const formatTime = (ts) => {
|
|
10
|
+
const d = new Date(ts);
|
|
11
|
+
const hh = String(d.getHours()).padStart(2, '0');
|
|
12
|
+
const mm = String(d.getMinutes()).padStart(2, '0');
|
|
13
|
+
const ss = String(d.getSeconds()).padStart(2, '0');
|
|
14
|
+
const ms = String(d.getMilliseconds()).padStart(3, '0');
|
|
15
|
+
return `${hh}:${mm}:${ss}.${ms}`;
|
|
16
|
+
};
|
|
17
|
+
const getJsonContent = (message) => {
|
|
18
|
+
if (!message)
|
|
19
|
+
return null;
|
|
20
|
+
const indices = [];
|
|
21
|
+
for (let i = 0; i < message.length; i++) {
|
|
22
|
+
if (message[i] === '{' || message[i] === '[') {
|
|
23
|
+
indices.push(i);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
for (const index of indices) {
|
|
27
|
+
const candidate = message.substring(index).trim();
|
|
28
|
+
try {
|
|
29
|
+
const parsed = JSON.parse(candidate);
|
|
30
|
+
if (parsed !== null && typeof parsed === 'object') {
|
|
31
|
+
const header = message.substring(0, index).trim();
|
|
32
|
+
return { header, data: parsed };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
// Ignore
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
};
|
|
41
|
+
const getJsonPreviewText = (data) => {
|
|
42
|
+
try {
|
|
43
|
+
const formatted = JSON.stringify(data, null, 2);
|
|
44
|
+
const lines = formatted.split('\n');
|
|
45
|
+
if (lines.length > 3) {
|
|
46
|
+
return {
|
|
47
|
+
text: lines.slice(0, 3).join('\n') + '\n...',
|
|
48
|
+
hasMore: true,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
text: formatted,
|
|
53
|
+
hasMore: false,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
return {
|
|
58
|
+
text: String(data),
|
|
59
|
+
hasMore: false,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
export const ConsoleLogCard = React.memo(function ConsoleLogCard({ item, searchStr = '', isWebView = false, }) {
|
|
64
|
+
const [expanded, setExpanded] = useState(false);
|
|
65
|
+
const jsonContent = getJsonContent(item.message);
|
|
66
|
+
const isAnalyticsError = item.message
|
|
67
|
+
.toLowerCase()
|
|
68
|
+
.includes('[analytics error]');
|
|
69
|
+
const isUserLog = !isWebView && item.sourceMethod === 'log';
|
|
70
|
+
const caller = 'caller' in item ? item.caller : undefined;
|
|
71
|
+
const getLogColors = () => {
|
|
72
|
+
if (isWebView) {
|
|
73
|
+
const label = item.type.toUpperCase();
|
|
74
|
+
switch (item.type) {
|
|
75
|
+
case 'error':
|
|
76
|
+
return {
|
|
77
|
+
border: AppColors.errorColor,
|
|
78
|
+
badgeBg: `${AppColors.errorColor}15`,
|
|
79
|
+
badgeText: AppColors.errorColor,
|
|
80
|
+
label,
|
|
81
|
+
cardBg: '#FFF5F6',
|
|
82
|
+
};
|
|
83
|
+
case 'warn':
|
|
84
|
+
return {
|
|
85
|
+
border: AppColors.lightOrange,
|
|
86
|
+
badgeBg: `${AppColors.lightOrange}15`,
|
|
87
|
+
badgeText: AppColors.darkOrange || AppColors.lightOrange,
|
|
88
|
+
label,
|
|
89
|
+
cardBg: '#FFFDF6',
|
|
90
|
+
};
|
|
91
|
+
default:
|
|
92
|
+
return {
|
|
93
|
+
border: '#475569',
|
|
94
|
+
badgeBg: '#F1F5F9',
|
|
95
|
+
badgeText: '#475569',
|
|
96
|
+
label,
|
|
97
|
+
cardBg: '#F8FAFC',
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (isAnalyticsError) {
|
|
102
|
+
return {
|
|
103
|
+
border: AppColors.skyBlue,
|
|
104
|
+
badgeBg: `${AppColors.skyBlue}15`,
|
|
105
|
+
badgeText: AppColors.skyBlue,
|
|
106
|
+
label: 'ERROR',
|
|
107
|
+
cardBg: '#E6F2FF', // light sky blue background for analytics errors
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
switch (item.type) {
|
|
111
|
+
case 'error':
|
|
112
|
+
return {
|
|
113
|
+
border: AppColors.errorColor,
|
|
114
|
+
badgeBg: `${AppColors.errorColor}15`,
|
|
115
|
+
badgeText: AppColors.errorColor,
|
|
116
|
+
label: 'ERROR',
|
|
117
|
+
cardBg: '#FFF5F6', // light red background
|
|
118
|
+
};
|
|
119
|
+
case 'warn':
|
|
120
|
+
return {
|
|
121
|
+
border: AppColors.lightOrange,
|
|
122
|
+
badgeBg: `${AppColors.lightOrange}15`,
|
|
123
|
+
badgeText: AppColors.darkOrange || AppColors.lightOrange,
|
|
124
|
+
label: 'WARN',
|
|
125
|
+
cardBg: '#FFFDF6', // light yellow/orange background
|
|
126
|
+
};
|
|
127
|
+
default:
|
|
128
|
+
if (isUserLog) {
|
|
129
|
+
return {
|
|
130
|
+
border: '#475569',
|
|
131
|
+
badgeBg: '#E2E8F0',
|
|
132
|
+
badgeText: '#334155',
|
|
133
|
+
label: 'INFO',
|
|
134
|
+
cardBg: '#F1F5F9', // slate-blue / steel-blue background for user log
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
border: AppColors.purple,
|
|
139
|
+
badgeBg: `${AppColors.purple}15`,
|
|
140
|
+
badgeText: AppColors.purple,
|
|
141
|
+
label: 'INFO',
|
|
142
|
+
cardBg: '#F9F5FF', // light purple background for general info
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const colors = getLogColors();
|
|
147
|
+
// Show limited lines unless expanded
|
|
148
|
+
const numLines = expanded ? undefined : 5;
|
|
149
|
+
const hasLongMessage = jsonContent
|
|
150
|
+
? getJsonPreviewText(jsonContent.data).hasMore ||
|
|
151
|
+
jsonContent.header.length > 120 ||
|
|
152
|
+
jsonContent.header.includes('\n')
|
|
153
|
+
: item.message.length > 120 || item.message.includes('\n');
|
|
154
|
+
return (<View style={styles.container}>
|
|
155
|
+
<View style={[
|
|
156
|
+
styles.card,
|
|
157
|
+
{
|
|
158
|
+
borderLeftWidth: 4,
|
|
159
|
+
borderLeftColor: colors.border,
|
|
160
|
+
backgroundColor: colors.cardBg,
|
|
161
|
+
},
|
|
162
|
+
]}>
|
|
163
|
+
<Pressable onPress={() => setExpanded(prev => !prev)} style={styles.cardHeader}>
|
|
164
|
+
<View style={styles.headerLeft}>
|
|
165
|
+
<CopyButton value={item.message} label="Log message"/>
|
|
166
|
+
<View style={[styles.badge, { backgroundColor: colors.badgeBg }]}>
|
|
167
|
+
<Text style={[styles.badgeText, { color: colors.badgeText }]}>
|
|
168
|
+
{colors.label}
|
|
169
|
+
</Text>
|
|
170
|
+
</View>
|
|
171
|
+
{isAnalyticsError && (<View style={[
|
|
172
|
+
styles.badge,
|
|
173
|
+
{ backgroundColor: `${AppColors.skyBlue}15` },
|
|
174
|
+
]}>
|
|
175
|
+
<Text style={[styles.badgeText, { color: AppColors.skyBlue }]}>
|
|
176
|
+
Analytics
|
|
177
|
+
</Text>
|
|
178
|
+
</View>)}
|
|
179
|
+
{isUserLog && (<View style={[
|
|
180
|
+
styles.badge,
|
|
181
|
+
{
|
|
182
|
+
backgroundColor: '#F3F4F6',
|
|
183
|
+
borderColor: '#D1D5DB',
|
|
184
|
+
borderWidth: 1,
|
|
185
|
+
},
|
|
186
|
+
]}>
|
|
187
|
+
<Text style={[styles.badgeText, { color: '#4B5563' }]}>
|
|
188
|
+
user-log
|
|
189
|
+
</Text>
|
|
190
|
+
</View>)}
|
|
191
|
+
{isWebView && (<View style={[
|
|
192
|
+
styles.badge,
|
|
193
|
+
{
|
|
194
|
+
backgroundColor: '#F1F5F9',
|
|
195
|
+
borderColor: '#E2E8F0',
|
|
196
|
+
borderWidth: 1,
|
|
197
|
+
},
|
|
198
|
+
]}>
|
|
199
|
+
<Text style={[styles.badgeText, { color: '#475569' }]}>
|
|
200
|
+
webview
|
|
201
|
+
</Text>
|
|
202
|
+
</View>)}
|
|
203
|
+
<Text style={styles.serialNumber}>#{item.id + 1}</Text>
|
|
204
|
+
<Text style={styles.timestamp}>{formatTime(item.timestamp)}</Text>
|
|
205
|
+
</View>
|
|
206
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
|
|
207
|
+
{caller && caller !== 'Unknown' && (<Text style={styles.callerText} numberOfLines={1} ellipsizeMode="middle">
|
|
208
|
+
{caller.split('/').pop() || caller}
|
|
209
|
+
</Text>)}
|
|
210
|
+
<View style={{ transform: [{ rotate: expanded ? '180deg' : '0deg' }] }}>
|
|
211
|
+
<ChevronIcon size={14} color={AppColors.grayTextWeak}/>
|
|
212
|
+
</View>
|
|
213
|
+
</View>
|
|
214
|
+
</Pressable>
|
|
215
|
+
|
|
216
|
+
<View style={styles.cardBody}>
|
|
217
|
+
{jsonContent ? (<>
|
|
218
|
+
{jsonContent.header ? (<Pressable onPress={() => setExpanded(prev => !prev)}>
|
|
219
|
+
<HighlightText text={jsonContent.header} search={searchStr} style={styles.messageText} highlightStyle={styles.highlight} numberOfLines={numLines} detectLinks={true}/>
|
|
220
|
+
</Pressable>) : null}
|
|
221
|
+
{expanded ? (<View style={styles.jsonContainer}>
|
|
222
|
+
<JsonViewer data={jsonContent.data} search={searchStr} forceOpen={expanded}/>
|
|
223
|
+
</View>) : (<Pressable onPress={() => setExpanded(prev => !prev)} style={styles.jsonPreviewContainer}>
|
|
224
|
+
<HighlightText text={getJsonPreviewText(jsonContent.data).text} search={searchStr} style={styles.jsonPreviewText} highlightStyle={styles.highlight} detectLinks={true}/>
|
|
225
|
+
</Pressable>)}
|
|
226
|
+
</>) : (<Pressable onPress={() => setExpanded(prev => !prev)}>
|
|
227
|
+
<HighlightText text={item.message} search={searchStr} style={styles.messageText} highlightStyle={styles.highlight} numberOfLines={numLines} detectLinks={true}/>
|
|
228
|
+
</Pressable>)}
|
|
229
|
+
{hasLongMessage && (<Pressable onPress={() => setExpanded(prev => !prev)} style={styles.seeMoreBtn} hitSlop={8}>
|
|
230
|
+
<Text style={styles.seeMoreText}>
|
|
231
|
+
{expanded ? 'See Less' : 'See More'}
|
|
232
|
+
</Text>
|
|
233
|
+
</Pressable>)}
|
|
234
|
+
</View>
|
|
235
|
+
|
|
236
|
+
{caller && caller !== 'Unknown' && expanded && (<View style={styles.cardFooter}>
|
|
237
|
+
<Text style={styles.fullCallerText}>Caller: {caller}</Text>
|
|
238
|
+
</View>)}
|
|
239
|
+
</View>
|
|
240
|
+
</View>);
|
|
241
|
+
});
|
|
242
|
+
const styles = StyleSheet.create({
|
|
243
|
+
container: {
|
|
244
|
+
paddingHorizontal: 16,
|
|
245
|
+
paddingVertical: 4,
|
|
246
|
+
},
|
|
247
|
+
card: {
|
|
248
|
+
alignSelf: 'stretch',
|
|
249
|
+
backgroundColor: '#FFFFFF',
|
|
250
|
+
borderRadius: 8,
|
|
251
|
+
borderWidth: 1,
|
|
252
|
+
borderColor: '#EFEFEF',
|
|
253
|
+
padding: 12,
|
|
254
|
+
shadowColor: '#000',
|
|
255
|
+
shadowOpacity: 0.03,
|
|
256
|
+
shadowRadius: 3,
|
|
257
|
+
shadowOffset: { width: 0, height: 1 },
|
|
258
|
+
elevation: 1,
|
|
259
|
+
overflow: 'hidden',
|
|
260
|
+
},
|
|
261
|
+
cardHeader: {
|
|
262
|
+
alignSelf: 'stretch',
|
|
263
|
+
flexDirection: 'row',
|
|
264
|
+
justifyContent: 'space-between',
|
|
265
|
+
alignItems: 'center',
|
|
266
|
+
marginBottom: 8,
|
|
267
|
+
},
|
|
268
|
+
headerLeft: {
|
|
269
|
+
flexDirection: 'row',
|
|
270
|
+
alignItems: 'center',
|
|
271
|
+
gap: 8,
|
|
272
|
+
},
|
|
273
|
+
badge: {
|
|
274
|
+
paddingHorizontal: 6,
|
|
275
|
+
paddingVertical: 3,
|
|
276
|
+
borderRadius: 4,
|
|
277
|
+
},
|
|
278
|
+
badgeText: {
|
|
279
|
+
fontFamily: AppFonts.interBold,
|
|
280
|
+
fontSize: 9,
|
|
281
|
+
letterSpacing: 0.5,
|
|
282
|
+
},
|
|
283
|
+
timestamp: {
|
|
284
|
+
fontFamily: AppFonts.interMedium,
|
|
285
|
+
fontSize: 11,
|
|
286
|
+
color: AppColors.grayTextWeak,
|
|
287
|
+
},
|
|
288
|
+
serialNumber: {
|
|
289
|
+
fontFamily: AppFonts.interBold,
|
|
290
|
+
color: AppColors.grayTextWeak,
|
|
291
|
+
fontSize: 11,
|
|
292
|
+
},
|
|
293
|
+
callerText: {
|
|
294
|
+
fontFamily: AppFonts.interRegular,
|
|
295
|
+
fontSize: 10,
|
|
296
|
+
color: AppColors.grayTextWeak,
|
|
297
|
+
maxWidth: '50%',
|
|
298
|
+
},
|
|
299
|
+
cardBody: {
|
|
300
|
+
marginTop: 8,
|
|
301
|
+
backgroundColor: '#FFFFFF',
|
|
302
|
+
paddingHorizontal: 10,
|
|
303
|
+
paddingVertical: 8,
|
|
304
|
+
borderRadius: 6,
|
|
305
|
+
borderWidth: 1,
|
|
306
|
+
borderColor: '#EBECEF',
|
|
307
|
+
},
|
|
308
|
+
messageText: {
|
|
309
|
+
fontFamily: Platform.OS === 'ios' ? 'System' : 'sans-serif',
|
|
310
|
+
fontSize: 12,
|
|
311
|
+
color: AppColors.primaryBlack,
|
|
312
|
+
lineHeight: 16,
|
|
313
|
+
},
|
|
314
|
+
highlight: {
|
|
315
|
+
backgroundColor: '#FFE44D',
|
|
316
|
+
color: AppColors.primaryBlack,
|
|
317
|
+
borderRadius: 2,
|
|
318
|
+
},
|
|
319
|
+
jsonContainer: {
|
|
320
|
+
marginTop: 4,
|
|
321
|
+
backgroundColor: '#FFFFFF',
|
|
322
|
+
borderRadius: 4,
|
|
323
|
+
borderWidth: 1,
|
|
324
|
+
borderColor: '#E2E8F0',
|
|
325
|
+
padding: 6,
|
|
326
|
+
},
|
|
327
|
+
jsonPreviewContainer: {
|
|
328
|
+
marginTop: 4,
|
|
329
|
+
backgroundColor: '#FFFFFF',
|
|
330
|
+
borderRadius: 4,
|
|
331
|
+
borderWidth: 1,
|
|
332
|
+
borderColor: '#E2E8F0',
|
|
333
|
+
padding: 6,
|
|
334
|
+
},
|
|
335
|
+
jsonPreviewText: {
|
|
336
|
+
fontFamily: Platform.OS === 'ios' ? 'Menlo' : 'monospace',
|
|
337
|
+
fontSize: 11,
|
|
338
|
+
color: AppColors.primaryBlack,
|
|
339
|
+
lineHeight: 15,
|
|
340
|
+
},
|
|
341
|
+
cardFooter: {
|
|
342
|
+
marginTop: 8,
|
|
343
|
+
paddingTop: 8,
|
|
344
|
+
borderTopWidth: 1,
|
|
345
|
+
borderTopColor: AppColors.dividerColor,
|
|
346
|
+
},
|
|
347
|
+
fullCallerText: {
|
|
348
|
+
fontFamily: AppFonts.interRegular,
|
|
349
|
+
fontSize: 10,
|
|
350
|
+
color: AppColors.grayText,
|
|
351
|
+
},
|
|
352
|
+
seeMoreBtn: {
|
|
353
|
+
marginTop: 6,
|
|
354
|
+
alignSelf: 'flex-start',
|
|
355
|
+
},
|
|
356
|
+
seeMoreText: {
|
|
357
|
+
fontFamily: AppFonts.interBold,
|
|
358
|
+
fontSize: 11,
|
|
359
|
+
color: AppColors.purple,
|
|
360
|
+
textDecorationLine: 'underline',
|
|
361
|
+
},
|
|
362
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
// Components
|
|
3
|
+
import TouchableScale from './TouchableScale';
|
|
4
|
+
// Helpers
|
|
5
|
+
import { copyToClipboard } from '../helpers';
|
|
6
|
+
// Assets
|
|
7
|
+
import { TerminalIcon, FetchIcon, CopyIcon, CheckIcon } from './NetworkIcons';
|
|
8
|
+
// Stylesheet
|
|
9
|
+
import { AppColors } from '../styles/AppColors';
|
|
10
|
+
import styles from '../styles';
|
|
11
|
+
const CopyButton = ({ value, label, iconType = 'copy' }) => {
|
|
12
|
+
const [copied, setCopied] = useState(false);
|
|
13
|
+
const handlePress = () => {
|
|
14
|
+
copyToClipboard(value, label);
|
|
15
|
+
setCopied(true);
|
|
16
|
+
setTimeout(() => setCopied(false), 1200);
|
|
17
|
+
};
|
|
18
|
+
const containerStyle = [
|
|
19
|
+
styles.iconSquareBtn,
|
|
20
|
+
copied && styles.iconSquareBtnSuccess,
|
|
21
|
+
];
|
|
22
|
+
const IconComponent = iconType === 'terminal'
|
|
23
|
+
? TerminalIcon
|
|
24
|
+
: iconType === 'fetch'
|
|
25
|
+
? FetchIcon
|
|
26
|
+
: CopyIcon;
|
|
27
|
+
return (<TouchableScale onPress={handlePress} hitSlop={12} style={containerStyle}>
|
|
28
|
+
{copied ? (<CheckIcon color={AppColors.greenColor} size={14}/>) : (<IconComponent color={AppColors.grayTextWeak} size={14}/>)}
|
|
29
|
+
</TouchableScale>);
|
|
30
|
+
};
|
|
31
|
+
export default CopyButton;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { View, Text, ScrollView } from 'react-native';
|
|
3
|
+
// Helpers
|
|
4
|
+
import { getDiff } from '../helpers';
|
|
5
|
+
// Stylesheet
|
|
6
|
+
import { AppColors } from '../styles/AppColors';
|
|
7
|
+
import styles from '../styles';
|
|
8
|
+
const DiffViewer = React.memo(({ oldData, newData, forceOpen, }) => {
|
|
9
|
+
const diffs = useMemo(() => getDiff(oldData, newData), [oldData, newData]);
|
|
10
|
+
if (forceOpen === false) {
|
|
11
|
+
return (<View style={styles.codeBlock}>
|
|
12
|
+
<Text style={[styles.codeText, { color: AppColors.grayTextWeak }]}>
|
|
13
|
+
{'{ Diff hidden }'}
|
|
14
|
+
</Text>
|
|
15
|
+
</View>);
|
|
16
|
+
}
|
|
17
|
+
if (diffs.length === 0) {
|
|
18
|
+
return (<View style={styles.codeBlock}>
|
|
19
|
+
<Text style={styles.codeText}>No differences from previous API.</Text>
|
|
20
|
+
</View>);
|
|
21
|
+
}
|
|
22
|
+
return (<ScrollView horizontal showsHorizontalScrollIndicator={true} style={styles.codeBlockScroll}>
|
|
23
|
+
<View style={styles.diffBlock}>
|
|
24
|
+
{diffs.map((d, i) => {
|
|
25
|
+
const key = d.path === 'root' ? '' : `"${d.path}": `;
|
|
26
|
+
if (d.type === 'added') {
|
|
27
|
+
return (<Text key={i} selectable={true} style={styles.diffAdded}>
|
|
28
|
+
+ <Text style={styles.codeKey}>{key}</Text>
|
|
29
|
+
{JSON.stringify(d.newVal)}
|
|
30
|
+
</Text>);
|
|
31
|
+
}
|
|
32
|
+
if (d.type === 'removed') {
|
|
33
|
+
return (<Text key={i} selectable={true} style={styles.diffRemoved}>
|
|
34
|
+
- <Text style={styles.codeKey}>{key}</Text>
|
|
35
|
+
{JSON.stringify(d.oldVal)}
|
|
36
|
+
</Text>);
|
|
37
|
+
}
|
|
38
|
+
return (<Text key={i} selectable={true} style={styles.diffChanged}>
|
|
39
|
+
~ <Text style={styles.codeKey}>{key}</Text>
|
|
40
|
+
{JSON.stringify(d.oldVal)}{' '}
|
|
41
|
+
<Text style={{ color: AppColors.grayTextWeak }}>➔</Text>{' '}
|
|
42
|
+
{JSON.stringify(d.newVal)}
|
|
43
|
+
</Text>);
|
|
44
|
+
})}
|
|
45
|
+
</View>
|
|
46
|
+
</ScrollView>);
|
|
47
|
+
});
|
|
48
|
+
export default DiffViewer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LocalFilter } from '../types';
|
|
3
|
+
declare const DomainHeader: ({ pageName, color, stats, activeFilters, onToggleFilter, isCollapsed, onToggleCollapse, isFirst, timestamp, }: {
|
|
4
|
+
pageName: string;
|
|
5
|
+
color: string;
|
|
6
|
+
stats: {
|
|
7
|
+
success: number;
|
|
8
|
+
failed: number;
|
|
9
|
+
loading: number;
|
|
10
|
+
};
|
|
11
|
+
activeFilters: Set<LocalFilter>;
|
|
12
|
+
onToggleFilter: (pageName: string, filter: LocalFilter) => void;
|
|
13
|
+
isCollapsed: boolean;
|
|
14
|
+
onToggleCollapse: (pageName: string) => void;
|
|
15
|
+
isFirst: boolean;
|
|
16
|
+
timestamp: number;
|
|
17
|
+
}) => React.JSX.Element;
|
|
18
|
+
export default DomainHeader;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { Animated, Pressable, View, Text } from 'react-native';
|
|
3
|
+
// Stylesheet
|
|
4
|
+
import { AppColors } from '../styles/AppColors';
|
|
5
|
+
// Helpers
|
|
6
|
+
import { formatDateTime } from '../helpers';
|
|
7
|
+
// Assets
|
|
8
|
+
import { ChevronIcon, ScreenIcon, CheckIcon, FailIcon, ClockIcon, } from './NetworkIcons';
|
|
9
|
+
// Stylesheet
|
|
10
|
+
import styles from '../styles';
|
|
11
|
+
const DomainHeader = ({ pageName, color, stats, activeFilters, onToggleFilter, isCollapsed, onToggleCollapse, isFirst, timestamp, }) => {
|
|
12
|
+
const chevronAnim = useRef(new Animated.Value(isCollapsed ? 0 : 1)).current;
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
Animated.timing(chevronAnim, {
|
|
15
|
+
toValue: isCollapsed ? 0 : 1,
|
|
16
|
+
duration: 220,
|
|
17
|
+
useNativeDriver: true,
|
|
18
|
+
}).start();
|
|
19
|
+
}, [isCollapsed]);
|
|
20
|
+
const chevronRotate = chevronAnim.interpolate({
|
|
21
|
+
inputRange: [0, 1],
|
|
22
|
+
outputRange: ['-90deg', '0deg'],
|
|
23
|
+
});
|
|
24
|
+
const visibleStats = ['success', 'failed', 'loading'];
|
|
25
|
+
return (<Pressable style={[styles.domainHeaderRow, !isFirst && styles.domainHeaderSeparator]} onPress={() => onToggleCollapse(pageName)}>
|
|
26
|
+
<View style={styles.domainHeaderLeft}>
|
|
27
|
+
<Animated.View style={{ transform: [{ rotate: chevronRotate }] }}>
|
|
28
|
+
<ChevronIcon color={AppColors.grayTextWeak} size={14}/>
|
|
29
|
+
</Animated.View>
|
|
30
|
+
<ScreenIcon color={color} size={16}/>
|
|
31
|
+
<View style={{ flex: 1, marginLeft: 6, justifyContent: 'center' }}>
|
|
32
|
+
<Text style={[styles.domainHeaderText, { color, marginLeft: 0 }]} numberOfLines={1}>
|
|
33
|
+
{pageName}
|
|
34
|
+
</Text>
|
|
35
|
+
<View style={styles.domainSubRow}>
|
|
36
|
+
<Text style={styles.domainTimestamp}>
|
|
37
|
+
{formatDateTime(timestamp)}
|
|
38
|
+
</Text>
|
|
39
|
+
</View>
|
|
40
|
+
</View>
|
|
41
|
+
</View>
|
|
42
|
+
|
|
43
|
+
<View style={styles.domainStatsGroup}>
|
|
44
|
+
{visibleStats.map((type, index) => {
|
|
45
|
+
const isLast = index === visibleStats.length - 1;
|
|
46
|
+
const isActive = activeFilters.has(type);
|
|
47
|
+
let IconComponent;
|
|
48
|
+
let activeColor = '';
|
|
49
|
+
let count = 0;
|
|
50
|
+
let bgStyle = {};
|
|
51
|
+
if (type === 'success') {
|
|
52
|
+
IconComponent = CheckIcon;
|
|
53
|
+
activeColor = AppColors.greenColor;
|
|
54
|
+
count = stats.success;
|
|
55
|
+
bgStyle = {
|
|
56
|
+
backgroundColor: isActive
|
|
57
|
+
? `${AppColors.greenColor}15`
|
|
58
|
+
: 'transparent',
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
else if (type === 'failed') {
|
|
62
|
+
IconComponent = FailIcon;
|
|
63
|
+
activeColor = AppColors.errorColor;
|
|
64
|
+
count = stats.failed;
|
|
65
|
+
bgStyle = {
|
|
66
|
+
backgroundColor: isActive
|
|
67
|
+
? `${AppColors.errorColor}15`
|
|
68
|
+
: 'transparent',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
IconComponent = ClockIcon;
|
|
73
|
+
activeColor = AppColors.darkOrange;
|
|
74
|
+
count = stats.loading;
|
|
75
|
+
bgStyle = {
|
|
76
|
+
backgroundColor: isActive
|
|
77
|
+
? `${AppColors.darkOrange}15`
|
|
78
|
+
: 'transparent',
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return (<Pressable key={type} onPress={() => onToggleFilter(pageName, type)} style={[
|
|
82
|
+
styles.groupBtnItem,
|
|
83
|
+
bgStyle,
|
|
84
|
+
!isLast && styles.groupBtnBorderRight,
|
|
85
|
+
]}>
|
|
86
|
+
<IconComponent color={isActive ? activeColor : AppColors.grayTextWeak} size={type === 'failed' ? 8 : 10}/>
|
|
87
|
+
<Text style={[
|
|
88
|
+
styles.domainStatText,
|
|
89
|
+
{ color: isActive ? activeColor : AppColors.grayTextWeak },
|
|
90
|
+
]}>
|
|
91
|
+
{count}
|
|
92
|
+
</Text>
|
|
93
|
+
</Pressable>);
|
|
94
|
+
})}
|
|
95
|
+
</View>
|
|
96
|
+
</Pressable>);
|
|
97
|
+
};
|
|
98
|
+
export default DomainHeader;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DevSettings, Alert, View, Text } from 'react-native';
|
|
3
|
+
// Components
|
|
4
|
+
import TouchableScale from './TouchableScale';
|
|
5
|
+
// Assets
|
|
6
|
+
import { EmptyRadarIcon } from './NetworkIcons';
|
|
7
|
+
// Stylesheet
|
|
8
|
+
import { AppColors } from '../styles/AppColors';
|
|
9
|
+
import styles from '../styles';
|
|
10
|
+
const EmptyState = ({ isSearch }) => {
|
|
11
|
+
const handleReload = () => {
|
|
12
|
+
if (__DEV__ && DevSettings && DevSettings.reload) {
|
|
13
|
+
DevSettings.reload();
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
Alert.alert('Reload', 'App reload is typically only available in development mode.');
|
|
17
|
+
};
|
|
18
|
+
return (<View style={styles.emptyContainer}>
|
|
19
|
+
<View style={styles.emptyIconWrap}>
|
|
20
|
+
<EmptyRadarIcon color={AppColors.purple} size={32}/>
|
|
21
|
+
</View>
|
|
22
|
+
<Text style={styles.emptyTitle}>
|
|
23
|
+
{isSearch ? 'No matching APIs' : 'No network activity'}
|
|
24
|
+
</Text>
|
|
25
|
+
<Text style={styles.emptySub}>
|
|
26
|
+
{isSearch
|
|
27
|
+
? 'Try adjusting your filters or search.'
|
|
28
|
+
: 'Listening for incoming API calls...'}
|
|
29
|
+
</Text>
|
|
30
|
+
{!isSearch && (<TouchableScale style={styles.reloadBtn} onPress={handleReload}>
|
|
31
|
+
<Text style={styles.reloadBtnText}>Reload App</Text>
|
|
32
|
+
</TouchableScale>)}
|
|
33
|
+
</View>);
|
|
34
|
+
};
|
|
35
|
+
export default EmptyState;
|