Skip to content

Commit

Permalink
578 decoupled image imports from multipage overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
dhinrichs-scottlogic committed Feb 27, 2024
1 parent 767de8b commit a58a244
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
6 changes: 4 additions & 2 deletions frontend/src/components/Overlay/LevelsComplete.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import BotAvatarDefault from '@src/assets/images/BotAvatarDefault.svg';
import Manager from '@src/assets/images/manager.png';
import LevelsCompleteButtons from '@src/components/ThemedButtons/LevelsCompleteButtons';

import MultipageOverlay from './MultipageOverlay';
Expand All @@ -21,7 +23,7 @@ function LevelsComplete({
</p>
</>
),
imageName: 'ScottBrew Manager',
imageName: Manager,
},
{
content: (
Expand All @@ -38,7 +40,7 @@ function LevelsComplete({
/>
</>
),
imageName: 'SpyLogic',
imageName: BotAvatarDefault,
},
];

Expand Down
12 changes: 11 additions & 1 deletion frontend/src/components/Overlay/MissionInformation.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { LEVELS } from '@src/Levels';
import Handler from '@src/assets/images/handler.png';
import Lawyer from '@src/assets/images/lawyer.png';
import Manager from '@src/assets/images/manager.png';
import OverlayButton from '@src/components/ThemedButtons/OverlayButton';
import { LEVEL_NAMES } from '@src/models/level';

Expand All @@ -25,7 +28,14 @@ function MissionInformation({
)}
</>
),
imageName: speaker,
imageName:
speaker === 'ScottBrew Manager'
? Manager
: speaker === 'ScottBrew Lawyer'
? Lawyer
: speaker === 'Handler'
? Handler
: '',
};
}
);
Expand Down
20 changes: 2 additions & 18 deletions frontend/src/components/Overlay/MultipageOverlay.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { ReactNode, useState } from 'react';

import BotAvatarDefault from '@src/assets/images/BotAvatarDefault.svg';
import Handler from '@src/assets/images/handler.png';
import Lawyer from '@src/assets/images/lawyer.png';
import Manager from '@src/assets/images/manager.png';

import Overlay from './Overlay';
import OverlayNav from './OverlayNav';

Expand Down Expand Up @@ -37,26 +32,15 @@ function MultipageOverlay({
}
}

let speakerImage;

if (pages[currentPage].imageName === 'Handler') {
speakerImage = Handler;
} else if (pages[currentPage].imageName === 'ScottBrew Manager') {
speakerImage = Manager;
} else if (pages[currentPage].imageName === 'ScottBrew Lawyer') {
speakerImage = Lawyer;
} else {
speakerImage = BotAvatarDefault;
}

return (
<Overlay closeOverlay={closeOverlay} heading={heading}>
<div className="multi-page-container">
<div className="multi-page-content">
<div className="multi-page-text-image-container">
<img
className="multi-page-speaker-image"
src={speakerImage}
// src={speakerImage}
src={pages[currentPage].imageName}
alt=""
/>
<span className="multi-page-speaker-text">
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/Overlay/OverlayWelcome.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import BotAvatarDefault from '@src/assets/images/BotAvatarDefault.svg';
import StartLevelButtons from '@src/components/ThemedButtons/StartLevelButtons';
import { LEVEL_NAMES } from '@src/models/level';

Expand Down Expand Up @@ -25,7 +26,7 @@ function OverlayWelcome({
</p>
</>
),
imageName: 'SpyLogic',
imageName: BotAvatarDefault,
},
{
content: (
Expand All @@ -48,7 +49,7 @@ function OverlayWelcome({
/>
</>
),
imageName: 'SpyLogic',
imageName: BotAvatarDefault,
},
];

Expand Down

0 comments on commit a58a244

Please sign in to comment.