-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
269 group defences #318
Merged
Merged
269 group defences #318
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
837d332
Grouped defences
gsproston-scottlogic 09e4b7f
Better html grouping
gsproston-scottlogic 4912f3e
Removed strategy box
gsproston-scottlogic 91cde08
Visually clearer grouping
gsproston-scottlogic 7ec146f
Rounded corners on control section
gsproston-scottlogic 3af6d67
Using some rather than find
gsproston-scottlogic 9c86336
Using details html elements
gsproston-scottlogic fd6e601
Better html DRY principles
gsproston-scottlogic 4da8c55
Fix merge conflicts
gsproston-scottlogic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
#control-panel { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
overflow-y: auto; | ||
padding: 30px; | ||
} | ||
|
||
#control-strategy { | ||
padding: 0 30px; | ||
overflow-y: auto; | ||
.control-collapsible-section { | ||
background-color: var(--control-body-background-colour); | ||
margin-bottom: 12px; | ||
border-radius: 8px; | ||
overflow: hidden; | ||
} | ||
|
||
.control-collapsible-section-header { | ||
background-color: var(--control-header-background-colour); | ||
padding: 12px 14px; | ||
cursor: default; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rc/components/StrategyBox/StrategyBox.css → .../src/components/DefenceBox/DefenceBox.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#strategy-box { | ||
#defence-box { | ||
position: relative; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ import { | |
} from "../../models/defence"; | ||
import { validateDefence } from "../../service/defenceService"; | ||
import "./DefenceMechanism.css"; | ||
import "../StrategyBox/StrategyMechanism.css"; | ||
import DefenceConfiguration from "./DefenceConfiguration"; | ||
import { TiTick, TiTimes } from "react-icons/ti"; | ||
|
||
|
@@ -71,60 +70,49 @@ function DefenceMechanism({ | |
} | ||
|
||
return ( | ||
<span> | ||
<div | ||
className="strategy-mechanism defence-mechanism" | ||
onClick={toggleDefenceInfo} | ||
> | ||
<div className="strategy-mechanism-header"> | ||
<span>{defenceDetail.name}</span> | ||
<label className="switch"> | ||
<input | ||
type="checkbox" | ||
placeholder="defence-toggle" | ||
onChange={toggleDefence} | ||
// set checked if defence is active | ||
checked={defenceDetail.isActive} | ||
/> | ||
<span className="slider round"></span> | ||
</label> | ||
</div> | ||
{isInfoBoxVisible ? ( | ||
<div className="strategy-mechanism-info-box"> | ||
<div>{defenceDetail.info}</div> | ||
<article className="defence-mechanism" onClick={toggleDefenceInfo}> | ||
<header> | ||
<h4>{defenceDetail.name}</h4> | ||
<label className="switch"> | ||
<input | ||
type="checkbox" | ||
placeholder="defence-toggle" | ||
onChange={toggleDefence} | ||
// set checked if defence is active | ||
checked={defenceDetail.isActive} | ||
/> | ||
<span className="slider round"></span> | ||
</label> | ||
</header> | ||
{isInfoBoxVisible && ( | ||
<div className="info-box"> | ||
<p>{defenceDetail.info}</p> | ||
|
||
{showConfigurations ? ( | ||
<div className="defence-mechanism-config"> | ||
{defenceDetail.config.map((config) => { | ||
return ( | ||
<DefenceConfiguration | ||
key={config.id} | ||
isActive={defenceDetail.isActive} | ||
config={config} | ||
setConfigurationValue={setConfigurationValue} | ||
/> | ||
); | ||
})} | ||
</div> | ||
) : null} | ||
{showConfigurations && | ||
defenceDetail.config.map((config) => { | ||
return ( | ||
<DefenceConfiguration | ||
key={config.id} | ||
isActive={defenceDetail.isActive} | ||
config={config} | ||
setConfigurationValue={setConfigurationValue} | ||
/> | ||
); | ||
})} | ||
|
||
{isConfigured ? ( | ||
<div className="defence-mechanism-config-validated"> | ||
{configValidated ? ( | ||
<p className="validation-text"> | ||
<TiTick /> defence successfully configured | ||
</p> | ||
) : ( | ||
<p className="validation-text"> | ||
<TiTimes /> invalid input - configuration failed | ||
</p> | ||
)} | ||
</div> | ||
) : null} | ||
</div> | ||
) : null} | ||
</div> | ||
</span> | ||
{isConfigured && | ||
(configValidated ? ( | ||
<p className="validation-text"> | ||
<TiTick /> defence successfully configured | ||
</p> | ||
) : ( | ||
<p className="validation-text"> | ||
<TiTimes /> invalid input - configuration failed | ||
</p> | ||
))} | ||
</div> | ||
)} | ||
</article> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh this is looking much better, nice use of |
||
); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't help thinking a checkbox would be so much simpler than a homegrown slider. This is a whole heap of css...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit isn't really added in this PR, I was just moving the comment to a more suitable place. Could maybe put it in it's own component to hide it away? But I'd prefer for that work to be in a new ticket as it's not really to do with this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes understood! Was just a comment in passing. Think we could add an issue for it though, it's really unwise to overcomplicate things. If we are going to overhaul the UI, we might consider a component library instead of home-cooking all our own.