Files
MemShellParty/web/app/components/probeshell/shell-result.tsx
T
2026-06-28 21:22:31 +08:00

54 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { ProbeShellResult } from "@/types/probeshell";
import { useTranslation } from "react-i18next";
import { QuickUsage } from "@/components/probeshell/quick-usage";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import CodeViewer from "../code-viewer";
import { BasicInfo } from "./basic-info";
export default function ShellResult({
packResult,
packMethod,
generateResult,
}: Readonly<{
packResult: string | undefined;
packMethod: string;
generateResult?: ProbeShellResult;
}>) {
const { t } = useTranslation();
if (!generateResult) {
return <QuickUsage />;
}
const showCode = packMethod === "JSP";
const height = 600;
return (
<Tabs defaultValue="packResult">
<TabsList className="grid w-full grid-cols-1">
<TabsTrigger value="packResult">{t("common:generateResult")}</TabsTrigger>
</TabsList>
<TabsContent value="packResult" className="space-y-2">
<BasicInfo generateResult={generateResult} />
{packResult && (
<CodeViewer
code={packResult}
header={
<div className="flex items-center justify-between gap-2 text-xs">
<span>
{t("common:packerMethod")}{packMethod}
</span>
<span className="text-muted-foreground">({packResult?.length})</span>
</div>
}
wrapLongLines={!showCode}
showLineNumbers={showCode}
language={showCode ? "java" : "text"}
height={height}
/>
)}
</TabsContent>
</Tabs>
);
}