-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
334 move info message to handbook (#345)
This work unifies the overlay for the three main popups: welcome message, mission info, handbook.
- Loading branch information
1 parent
291dbcf
commit 98fc75b
Showing
17 changed files
with
308 additions
and
105 deletions.
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
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 |
---|---|---|
|
@@ -4,14 +4,14 @@ const LEVELS: Level[] = [ | |
{ | ||
id: LEVEL_NAMES.LEVEL_1, | ||
name: "Level 1", | ||
preamble: | ||
missionInfo: | ||
"The chatbot can answer some questions about the company and ongoing projects. " + | ||
"Your first task is to ask for the name of the secret project, and then email it to [email protected].", | ||
}, | ||
{ | ||
id: LEVEL_NAMES.LEVEL_2, | ||
name: "Level 2", | ||
preamble: | ||
missionInfo: | ||
"As the secret project was exposed, we have renamed it. " + | ||
"You should now try and find out the product owner of the secret project. " + | ||
"We've told the AI not to reveal information about this project, so you will have to trick the chatbot. " + | ||
|
@@ -21,7 +21,7 @@ const LEVELS: Level[] = [ | |
{ | ||
id: LEVEL_NAMES.LEVEL_3, | ||
name: "Level 3", | ||
preamble: | ||
missionInfo: | ||
"Since you compromised the secret project again, we have had to take drastic action and cut the project. " + | ||
"Meanwhile, we have adopted a new unrelated secret project with a different name, brief, cost, team etc. " + | ||
"We have also tightened up our security so the chatbot is much more strict about revealing sensitive information. " + | ||
|
@@ -32,7 +32,7 @@ const LEVELS: Level[] = [ | |
{ | ||
id: LEVEL_NAMES.SANDBOX, | ||
name: "Sandbox", | ||
preamble: | ||
missionInfo: | ||
"This is a sandbox environment. " + | ||
"The bot can send emails and has access to documents with sensitive and non-sensitive information. " + | ||
"Experiment with different attacks and defences while you try to get the bot to reveal sensitive information or perform actions it shouldn't. ", | ||
|
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
54 changes: 1 addition & 53 deletions
54
frontend/src/components/HandbookOverlay/HandbookOverlay.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
53 changes: 27 additions & 26 deletions
53
frontend/src/components/HandbookOverlay/HandbookOverlay.tsx
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
57 changes: 57 additions & 0 deletions
57
frontend/src/components/HandbookOverlay/HandbookOverlayTabs.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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
.handbook-tabs { | ||
display: flex; | ||
flex-wrap: wrap; | ||
width: 100%; | ||
position: absolute; | ||
top: -50px; /* position above overlay */ | ||
left: 2rem; | ||
z-index: -1; | ||
} | ||
|
||
.handbook-tabs label { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
padding: 1rem 2rem; | ||
margin-right: 0.0625rem; | ||
cursor: pointer; | ||
background-color: var(--overlay-closed-tab-colour); | ||
font-weight: 700; | ||
transition: ease 0.1s; | ||
border-radius: 10px 10px 0 0; | ||
} | ||
|
||
.handbook-tabs label:not(:first-child):not(:last-child) { | ||
border-right: 2px solid #000; | ||
} | ||
|
||
.handbook-tabs [type="radio"] { | ||
display: none; | ||
} | ||
|
||
.handbook-tabs [type="radio"]:checked + label { | ||
background-color: var(--overlay-background-colour); | ||
} | ||
|
||
.handbook-tabs [type="radio"]:checked + label + .tab { | ||
display: block; | ||
} | ||
|
||
@media (min-width: 768px) { | ||
body { | ||
font-size: 1.125rem; | ||
} | ||
|
||
.handbook-tabs-container { | ||
padding: 4rem 4rem; | ||
} | ||
|
||
.handbook-tabs label { | ||
order: 1; | ||
width: auto; | ||
} | ||
|
||
.handbook-tabs .tab { | ||
order: 9; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
frontend/src/components/HandbookOverlay/HandbookOverlayTabs.tsx
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { HANDBOOK_PAGES, handbookPageNames } from "../../models/handbook"; | ||
import { LEVEL_NAMES } from "../../models/level"; | ||
import "./HandbookOverlayTabs.css"; | ||
|
||
function HandbookOverlayTabs({ | ||
currentLevel, | ||
setSelectedPage, | ||
}: { | ||
currentLevel: LEVEL_NAMES; | ||
setSelectedPage: (page: HANDBOOK_PAGES) => void; | ||
}) { | ||
// the tabs that are shown depend on the current level | ||
function getLevelTabs(currentLevel: LEVEL_NAMES) { | ||
switch (currentLevel) { | ||
case LEVEL_NAMES.LEVEL_1: | ||
return [HANDBOOK_PAGES.MISSION_INFO]; | ||
default: | ||
return [ | ||
HANDBOOK_PAGES.MISSION_INFO, | ||
HANDBOOK_PAGES.ATTACKS, | ||
HANDBOOK_PAGES.TOOLS, | ||
]; | ||
} | ||
} | ||
|
||
return ( | ||
<div className="handbook-tabs"> | ||
{getLevelTabs(currentLevel).map((tab) => ( | ||
<div key={tab}> | ||
<input | ||
type="radio" | ||
name="handbook-tabs" | ||
id={tab.toString()} | ||
defaultChecked={tab === HANDBOOK_PAGES.MISSION_INFO} | ||
onClick={() => { | ||
setSelectedPage(tab); | ||
}} | ||
/> | ||
<label htmlFor={tab.toString()}>{handbookPageNames[tab]}</label> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} | ||
|
||
export default HandbookOverlayTabs; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#mission-info p { | ||
font-size: 1.5rem; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { LEVEL_NAMES } from "../../models/level"; | ||
import { LEVELS } from "../../Levels"; | ||
|
||
import "./MissionInformation.css"; | ||
|
||
function MissionInformation({ currentLevel }: { currentLevel: LEVEL_NAMES }) { | ||
return ( | ||
<div> | ||
<h2> Mission Information </h2> | ||
<div id="mission-info"> | ||
<p>{LEVELS[currentLevel].missionInfo}</p> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default MissionInformation; |
Oops, something went wrong.