mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
use real scenarios in select
This commit is contained in:
parent
2ae1eba6db
commit
29541ebb21
2 changed files with 8 additions and 9 deletions
|
|
@ -27,6 +27,7 @@ import {
|
|||
arrayMove,
|
||||
} from "@dnd-kit/sortable";
|
||||
import { CSS } from "@dnd-kit/utilities";
|
||||
import { ScenarioSummary } from "./types";
|
||||
|
||||
export interface RecommendationsOptionsProps {
|
||||
onApply: (value: {
|
||||
|
|
@ -34,13 +35,9 @@ export interface RecommendationsOptionsProps {
|
|||
prioritisedScenarios: number[] | null;
|
||||
}) => Promise<void> | void;
|
||||
disabled?: boolean;
|
||||
scenarios: ScenarioSummary[]
|
||||
}
|
||||
|
||||
const fakeScenarios = [
|
||||
{ id: 1, name: "EPC C" },
|
||||
{ id: 2, name: "EPC C - Minor Works" },
|
||||
];
|
||||
|
||||
function SortableScenarioItem({
|
||||
id,
|
||||
name,
|
||||
|
|
@ -84,6 +81,7 @@ function SortableScenarioItem({
|
|||
export function RecommendationsOptions({
|
||||
onApply,
|
||||
disabled = false,
|
||||
scenarios
|
||||
}: RecommendationsOptionsProps) {
|
||||
const [isApplying, setIsApplying] = useState(false);
|
||||
const [open, setOpen] = useState(false);
|
||||
|
|
@ -98,7 +96,7 @@ export function RecommendationsOptions({
|
|||
};
|
||||
|
||||
const handleSelectAll = () => {
|
||||
setSelectedScenarios(fakeScenarios.map((s) => s.id));
|
||||
setSelectedScenarios(scenarios.map((s) => s.id));
|
||||
};
|
||||
|
||||
const handleDeselectAll = () => {
|
||||
|
|
@ -136,7 +134,7 @@ export function RecommendationsOptions({
|
|||
};
|
||||
|
||||
const selectedScenarioObjects = selectedScenarios.map(
|
||||
(id) => fakeScenarios.find((s) => s.id === id)!
|
||||
(id) => scenarios.find((s) => s.id === id)!
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
@ -170,9 +168,9 @@ export function RecommendationsOptions({
|
|||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<h4 className="font-semibold">Select scenarios</h4>
|
||||
<h4 className="font-semibold">Select scenarios to consider</h4>
|
||||
|
||||
{fakeScenarios.map((scenario) => (
|
||||
{scenarios.map((scenario) => (
|
||||
<div key={scenario.id} className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
checked={selectedScenarios.includes(scenario.id)}
|
||||
|
|
|
|||
|
|
@ -271,6 +271,7 @@ export function ReportingClientArea({
|
|||
<RecommendationsOptions
|
||||
onApply={() => {console.log('Generat Recommendations')}}
|
||||
disabled={scenarioBusy}
|
||||
scenarios={scenarios}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue