From d6320061c20a093448a2acd7bcc6bed029c69a3c Mon Sep 17 00:00:00 2001 From: imxyy_soope_ Date: Sun, 14 Dec 2025 12:16:05 +0800 Subject: [PATCH] feat(frontend): unify action badge --- frontend/src/components/ActionBadge.tsx | 15 +++++++++++++++ frontend/src/components/RequestDetails.tsx | 19 ++++++++----------- frontend/src/components/RulesList.tsx | 13 ++----------- 3 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 frontend/src/components/ActionBadge.tsx diff --git a/frontend/src/components/ActionBadge.tsx b/frontend/src/components/ActionBadge.tsx new file mode 100644 index 0000000..4326b61 --- /dev/null +++ b/frontend/src/components/ActionBadge.tsx @@ -0,0 +1,15 @@ +import { InterceptionAction } from "../types" + +export const ActionBadge = (props: { action: InterceptionAction, class?: string }) => { + return + {props.action} + +} diff --git a/frontend/src/components/RequestDetails.tsx b/frontend/src/components/RequestDetails.tsx index d106554..f317cce 100644 --- a/frontend/src/components/RequestDetails.tsx +++ b/frontend/src/components/RequestDetails.tsx @@ -1,8 +1,9 @@ import { type Component, createSignal, For, Show } from "solid-js"; -import type { RequestLog } from "../types"; +import type { InterceptionAction, RequestLog } from "../types"; import { Button } from "./ui/Button"; import { CardContent, CardFooter, CardHeader } from "./ui/Card"; import { Modal, ModalContent } from "./ui/Modal"; +import { ActionBadge } from "./ActionBadge"; interface TreeViewProps { data: any; @@ -56,7 +57,7 @@ const TreeView: Component = (props) => { interface DataSectionProps { title: string; data: any; - badge?: string; + badge?: InterceptionAction; } const DataSection: Component = (props) => { @@ -68,9 +69,7 @@ const DataSection: Component = (props) => {

{props.title} - - {props.badge} - +

@@ -78,22 +77,20 @@ const DataSection: Component = (props) => {