reactbridge-sdk 0.2.5 → 0.2.6
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/index.js
CHANGED
|
@@ -2158,6 +2158,8 @@ function AnalyticsDashboard({ onDirectiveAction, className = "", showRefresh = t
|
|
|
2158
2158
|
const theme = customTheme || contextTheme;
|
|
2159
2159
|
const [selectedAnalytics, setSelectedAnalytics] = React.useState(null);
|
|
2160
2160
|
const [directiveFilter, setDirectiveFilter] = React.useState("all");
|
|
2161
|
+
// Directive type filter (by action)
|
|
2162
|
+
const [directiveType, setDirectiveType] = React.useState("all");
|
|
2161
2163
|
// Fetch analytics configurations
|
|
2162
2164
|
const { configs, isLoading: configsLoading, error: configsError, refetch: refetchConfigs, } = useAnalyticsConfigs();
|
|
2163
2165
|
// Fetch latest result for selected analytics
|
|
@@ -2196,10 +2198,18 @@ function AnalyticsDashboard({ onDirectiveAction, className = "", showRefresh = t
|
|
|
2196
2198
|
// Refetch result to get updated directive statuses
|
|
2197
2199
|
refetchResult();
|
|
2198
2200
|
});
|
|
2201
|
+
// Get all unique directive types (actions)
|
|
2202
|
+
const directiveTypes = React.useMemo(() => {
|
|
2203
|
+
if (!(result === null || result === void 0 ? void 0 : result.directives))
|
|
2204
|
+
return [];
|
|
2205
|
+
const types = Array.from(new Set(result.directives.map((d) => d.action)));
|
|
2206
|
+
return types;
|
|
2207
|
+
}, [result === null || result === void 0 ? void 0 : result.directives]);
|
|
2208
|
+
// Filter directives by status and type
|
|
2199
2209
|
const filteredDirectives = (result === null || result === void 0 ? void 0 : result.directives.filter((d) => {
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
return
|
|
2210
|
+
const statusMatch = directiveFilter === "all" || d.status === directiveFilter;
|
|
2211
|
+
const typeMatch = directiveType === "all" || d.action === directiveType;
|
|
2212
|
+
return statusMatch && typeMatch;
|
|
2203
2213
|
})) || [];
|
|
2204
2214
|
const selectedConfig = configs === null || configs === void 0 ? void 0 : configs.find((c) => c.analyticsType === selectedAnalytics);
|
|
2205
2215
|
const proposedCount = (result === null || result === void 0 ? void 0 : result.directives.filter((d) => d.status === "proposed").length) || 0;
|
|
@@ -2471,6 +2481,8 @@ function AnalyticsDashboard({ onDirectiveAction, className = "", showRefresh = t
|
|
|
2471
2481
|
display: "flex",
|
|
2472
2482
|
justifyContent: "space-between",
|
|
2473
2483
|
alignItems: "center",
|
|
2484
|
+
flexWrap: "wrap",
|
|
2485
|
+
gap: theme.spacing.sm,
|
|
2474
2486
|
} },
|
|
2475
2487
|
React.createElement("h3", { style: { margin: 0, fontSize: theme.fontSizes.lg } }, "Recommended actions"),
|
|
2476
2488
|
React.createElement("div", { style: { display: "flex", gap: theme.spacing.xs } },
|
|
@@ -2505,7 +2517,22 @@ function AnalyticsDashboard({ onDirectiveAction, className = "", showRefresh = t
|
|
|
2505
2517
|
: theme.colors.text }) },
|
|
2506
2518
|
"Declined (",
|
|
2507
2519
|
declinedCount,
|
|
2508
|
-
")"))
|
|
2520
|
+
")")),
|
|
2521
|
+
directiveTypes.length > 1 && (React.createElement("select", { value: directiveType, onChange: e => setDirectiveType(e.target.value), style: {
|
|
2522
|
+
padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
|
|
2523
|
+
borderRadius: theme.borderRadius,
|
|
2524
|
+
border: `1px solid ${theme.colors.border}`,
|
|
2525
|
+
background: theme.colors.surface,
|
|
2526
|
+
color: theme.colors.text,
|
|
2527
|
+
fontSize: theme.fontSizes.sm,
|
|
2528
|
+
fontWeight: 500,
|
|
2529
|
+
outline: "none",
|
|
2530
|
+
minWidth: 120,
|
|
2531
|
+
marginLeft: theme.spacing.sm,
|
|
2532
|
+
cursor: "pointer",
|
|
2533
|
+
} },
|
|
2534
|
+
React.createElement("option", { value: "all" }, "All types"),
|
|
2535
|
+
directiveTypes.map(type => (React.createElement("option", { key: type, value: type }, type)))))),
|
|
2509
2536
|
filteredDirectives.length === 0 && (React.createElement("div", { style: placeholderStyle }, "No directives match the selected filter.")),
|
|
2510
2537
|
React.createElement("div", { style: {
|
|
2511
2538
|
display: "flex",
|