Skip to content

Commit

Permalink
turn off configurations for phase 2 (#177)
Browse files Browse the repository at this point in the history
* turn off configurations for phase 2

* use boolean instead of phase

* merge conflict
  • Loading branch information
heatherlogan-scottlogic authored Aug 22, 2023
1 parent 0e2a3b2 commit f8392a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,13 @@ function App() {
return (
<span id="main-area">
<div className="side-bar">
{/* hide defence box on phases 0 and 1. only allow configuration in sandbox */}
{/* hide defence box on phases 0 and 1 */}
{(currentPhase === PHASE_NAMES.PHASE_2 ||
currentPhase === PHASE_NAMES.SANDBOX) && (
<DefenceBox
defences={defencesToShow}
showConfigurations={currentPhase > 2 ? true : false}
triggeredDefences={triggeredDefences}
defenceActivated={defenceActivated}
defenceDeactivated={defenceDeactivated}
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/DefenceBox/DefenceBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import { DefenceConfig, DefenceInfo } from "../../models/defence";
function DefenceBox({
defences,
triggeredDefences,
showConfigurations,
defenceActivated,
defenceDeactivated,
}: {
defences: DefenceInfo[];
triggeredDefences: string[];
showConfigurations: boolean;
defenceActivated: (defenceInfo: DefenceInfo) => void;
defenceDeactivated: (defenceInfo: DefenceInfo) => void;
}) {
Expand Down Expand Up @@ -127,6 +129,7 @@ function DefenceBox({
<DefenceMechanism
key={index}
defenceDetail={defenceDetail}
showConfigurations={showConfigurations}
setDefenceActive={setDefenceActive}
setDefenceInactive={setDefenceInactive}
setDefenceConfiguration={setDefenceConfiguration}
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/DefenceBox/DefenceMechanism.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import { TiTick, TiTimes } from "react-icons/ti";

function DefenceMechanism({
defenceDetail,
showConfigurations,
setDefenceActive,
setDefenceInactive,
setDefenceConfiguration,
}: {
defenceDetail: DefenceInfo;
showConfigurations: boolean;
setDefenceActive: (defenceId: string) => void;
setDefenceInactive: (defenceId: string) => void;
setDefenceConfiguration: (
Expand Down Expand Up @@ -92,7 +94,8 @@ function DefenceMechanism({
{isInfoBoxVisible ? (
<div className="strategy-mechanism-info-box">
<div>{defenceDetail.info}</div>
{defenceDetail.config ? (

{defenceDetail.config && showConfigurations ? (
<div className="defence-mechanism-config">
{defenceDetail.config.map((config) => {
return (
Expand All @@ -105,6 +108,7 @@ function DefenceMechanism({
})}
</div>
) : null}

{isConfigured ? (
<div className="defence-mechanism-config-validated">
{configValidated ? (
Expand Down

0 comments on commit f8392a3

Please sign in to comment.