|
1 | 1 | // components/ImportExportStepper/ExportPanel.tsx |
2 | 2 |
|
3 | | -import { ComponentProps, Fragment } from "react"; |
| 3 | +import { ComponentProps, Fragment, useState } from "react"; |
4 | 4 |
|
5 | 5 | import { useStepper } from "./StepperContext"; |
6 | 6 | import styles from "./ExportPanel.module.css"; |
@@ -330,14 +330,51 @@ const ExportEmbedPreviewTableOrQuery = < |
330 | 330 | ? exportInput.table |
331 | 331 | : `${exportInput.destinationSchema}.${exportInput.destinationTable}`; |
332 | 332 |
|
| 333 | + const [selectedTab, setSelectedTab] = useState<"splitgraph" | "seafowl">( |
| 334 | + "splitgraph" |
| 335 | + ); |
| 336 | + |
333 | 337 | return ( |
334 | 338 | <> |
335 | 339 | <h4> |
336 | 340 | <code>{heading}</code> |
337 | 341 | </h4> |
| 342 | + <div style={{ display: "flex", flexDirection: "row" }}> |
| 343 | + <button |
| 344 | + onClick={() => setSelectedTab("splitgraph")} |
| 345 | + disabled={selectedTab === "splitgraph"} |
| 346 | + style={{ marginRight: "1rem" }} |
| 347 | + > |
| 348 | + Splitgraph Query |
| 349 | + </button> |
| 350 | + <button |
| 351 | + onClick={() => setSelectedTab("seafowl")} |
| 352 | + disabled={selectedTab === "seafowl" || !completed} |
| 353 | + > |
| 354 | + Seafowl Query |
| 355 | + </button> |
| 356 | + </div> |
338 | 357 | <pre>{JSON.stringify({ completed, loading }, null, 2)}</pre> |
339 | | - {(unstarted || loading) && <SplitgraphEmbeddedQuery {...embedProps} />} |
340 | | - {completed && <SeafowlEmbeddedQuery {...embedProps} />} |
| 358 | + { |
| 359 | + <div |
| 360 | + style={{ |
| 361 | + visibility: selectedTab === "splitgraph" ? "visible" : "hidden", |
| 362 | + display: selectedTab === "seafowl" ? "none" : "block", |
| 363 | + }} |
| 364 | + > |
| 365 | + <SplitgraphEmbeddedQuery {...embedProps} /> |
| 366 | + </div> |
| 367 | + } |
| 368 | + {completed && ( |
| 369 | + <div |
| 370 | + style={{ |
| 371 | + visibility: selectedTab === "seafowl" ? "visible" : "hidden", |
| 372 | + display: selectedTab === "splitgraph" ? "none" : "block", |
| 373 | + }} |
| 374 | + > |
| 375 | + <SeafowlEmbeddedQuery {...embedProps} /> |
| 376 | + </div> |
| 377 | + )} |
341 | 378 | </> |
342 | 379 | ); |
343 | 380 | }; |
0 commit comments