2022-06-17 20:29:03 +00:00
|
|
|
import React, { useState } from "react";
|
2022-06-18 23:10:27 +00:00
|
|
|
import { ShowComparisons } from "./showComparisons.js";
|
|
|
|
import { ComparisonsChanger } from "./comparisonsChanger.js";
|
|
|
|
import { DataSetChanger } from "./datasetChanger.js";
|
|
|
|
import { setRevalidateHeaders } from "next/dist/server/send-payload/revalidate-headers.js";
|
2022-06-17 20:29:03 +00:00
|
|
|
|
|
|
|
const effectButtonStyle =
|
|
|
|
"bg-transparent m-2 hover:bg-blue-500 text-blue-700 font-semibold hover:text-white py-2 px-4 border border-blue-500 hover:border-transparent rounded mt-5";
|
|
|
|
|
|
|
|
export function AdvancedOptions({
|
|
|
|
links,
|
|
|
|
setLinks,
|
|
|
|
listOfElements,
|
|
|
|
moveToNextStep,
|
|
|
|
onChangeOfDataset,
|
|
|
|
}) {
|
|
|
|
const [showAdvancedOptions, changeShowAdvanceOptions] = useState(false);
|
|
|
|
|
|
|
|
const [showComparisons, setShowComparisons] = useState(false);
|
|
|
|
const toggleShowComparisons = () => setShowComparisons(!showComparisons);
|
|
|
|
|
|
|
|
const [showLoadComparisons, setShowLoadComparisons] = useState(false);
|
|
|
|
const toggleShowLoadComparisons = () =>
|
|
|
|
setShowLoadComparisons(!showLoadComparisons);
|
|
|
|
|
|
|
|
const [showChangeDataset, setShowChangeDataset] = useState(false);
|
|
|
|
const toggleShowChangeDataset = () =>
|
|
|
|
setShowChangeDataset(!showChangeDataset);
|
|
|
|
|
|
|
|
const buttonNames = [
|
2022-06-18 23:10:27 +00:00
|
|
|
// "Show Comparisons",
|
2022-06-17 20:29:03 +00:00
|
|
|
"Load comparisons",
|
|
|
|
"Use your own data",
|
|
|
|
];
|
|
|
|
const buttonToggles = [
|
2022-06-18 23:10:27 +00:00
|
|
|
// toggleShowComparisons,
|
2022-06-17 20:29:03 +00:00
|
|
|
toggleShowLoadComparisons,
|
|
|
|
toggleShowChangeDataset,
|
|
|
|
];
|
|
|
|
|
|
|
|
return (
|
2022-06-19 23:25:55 +00:00
|
|
|
<div className="">
|
2022-06-17 20:29:03 +00:00
|
|
|
<br />
|
|
|
|
{/* Show advanced options*/}
|
|
|
|
<button
|
2022-06-19 23:25:55 +00:00
|
|
|
key={"advancedOptionsButton-top"}
|
|
|
|
className="text-gray-500 text-sm "
|
2022-06-17 22:55:58 +00:00
|
|
|
onClick={() => changeShowAdvanceOptions(!showAdvancedOptions)}
|
2022-06-17 20:29:03 +00:00
|
|
|
>
|
|
|
|
Advanced options ▼
|
|
|
|
</button>
|
|
|
|
<br />
|
|
|
|
{/* Toggle buttons */}
|
2022-06-17 22:55:58 +00:00
|
|
|
<div className={showAdvancedOptions ? "" : "hidden"}>
|
2022-06-17 20:29:03 +00:00
|
|
|
{buttonNames.map((buttonName, i) => {
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
className={effectButtonStyle}
|
|
|
|
onClick={() => buttonToggles[i]()}
|
2022-06-19 23:25:55 +00:00
|
|
|
key={`advancedOptionsButton-${i}`}
|
2022-06-17 20:29:03 +00:00
|
|
|
>
|
|
|
|
{buttonName}
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
{/* Element: Show comparisons */}
|
|
|
|
<ShowComparisons links={links} show={showComparisons} />
|
|
|
|
{/* Element: Change comparisons */}
|
|
|
|
<ComparisonsChanger
|
|
|
|
setLinks={setLinks}
|
|
|
|
listOfElements={listOfElements}
|
|
|
|
show={showLoadComparisons}
|
|
|
|
moveToNextStep={moveToNextStep}
|
2022-06-18 23:10:27 +00:00
|
|
|
links={links}
|
2022-06-17 20:29:03 +00:00
|
|
|
/>
|
|
|
|
<DataSetChanger
|
|
|
|
onChangeOfDataset={onChangeOfDataset}
|
|
|
|
show={showChangeDataset}
|
2022-06-18 23:10:27 +00:00
|
|
|
listOfElements={listOfElements}
|
2022-06-17 20:29:03 +00:00
|
|
|
/>
|
2022-06-17 22:48:11 +00:00
|
|
|
</div>
|
2022-06-17 20:29:03 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|