mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-21 22:50:42 +08:00
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
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>
|
||
);
|
||
}
|