rentgen/report-window/email-template.tsx

34 lines
929 B
TypeScript
Raw Normal View History

2021-11-08 20:14:28 +01:00
import React, { useState } from "react";
import { RequestCluster } from "../request-cluster";
2021-11-22 17:54:15 +01:00
import { StolenDataEntry } from "../stolen-data-entry";
2021-11-24 00:24:44 +01:00
import EmailTemplate1 from "./email-template-1";
import EmailTemplate2 from "./email-template-2";
2021-11-08 20:14:28 +01:00
export default function EmailTemplate({
2021-11-22 17:54:15 +01:00
entries,
2021-11-08 20:14:28 +01:00
clusters,
2021-11-24 00:24:44 +01:00
version,
2021-11-08 20:14:28 +01:00
}: {
2021-11-22 17:54:15 +01:00
entries: StolenDataEntry[];
2021-11-08 20:14:28 +01:00
clusters: Record<string, RequestCluster>;
version: number;
2021-11-24 00:24:44 +01:00
}) {
const [templateVersion, setTemplateVersion] = useState("2");
2021-11-08 20:14:28 +01:00
return (
<div>
<select
2021-11-24 00:24:44 +01:00
value={templateVersion}
onChange={(e) => setTemplateVersion(e.target.value)}
2021-11-08 20:14:28 +01:00
>
2021-11-24 00:24:44 +01:00
<option value="1">wersja 1</option>
<option value="2">wersja 2</option>
2021-11-08 20:14:28 +01:00
</select>
2021-11-24 00:24:44 +01:00
{templateVersion === "1" ? (
<EmailTemplate1 {...{ entries, clusters, version }} />
) : (
<EmailTemplate2 {...{ entries, clusters, version }} />
)}
2021-11-08 20:14:28 +01:00
</div>
);
}