Skip to content

Commit

Permalink
fix: check for modal message in Header (#1054)
Browse files Browse the repository at this point in the history
  • Loading branch information
VmMad authored Feb 2, 2024
1 parent 4926863 commit 93bf920
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions client/src/app/components/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import "./Header.scss";

const NETWORK_DROPDOWN_LABEL = "Network Switcher";

const MODAL_MESSAGE: Record<ProtocolVersion, { title: string; description: string }> = {
const MODAL_MESSAGE: { [key in ProtocolVersion]?: { title: string; description: string } } = {
[LEGACY]: mainLegacyMessage,
[CHRYSALIS]: mainChrysalisMessage,
[STARDUST]: mainStardustMessage,
Expand All @@ -49,6 +49,7 @@ export default function Header({ rootPath, currentNetwork, networks, history, ac
const isNetworkSwitcherExpanded = expandedDropdownLabel === NETWORK_DROPDOWN_LABEL;
const isShimmerUi = isShimmerUiTheme(currentNetwork?.uiTheme);
const isMarketed = isMarketedNetwork(currentNetwork?.network);
const modalMessage = currentNetwork?.protocolVersion ? MODAL_MESSAGE[currentNetwork.protocolVersion] : undefined;

useEffect(() => {
saveThemeAndDispatchEvent(darkMode);
Expand Down Expand Up @@ -148,9 +149,7 @@ export default function Header({ rootPath, currentNetwork, networks, history, ac
protocolVersion={protocolVersion}
/>

{currentNetwork?.protocolVersion && (
<Modal icon="info" data={MODAL_MESSAGE[currentNetwork.protocolVersion]} showModal={setShow} />
)}
{modalMessage && <Modal icon="info" data={modalMessage} showModal={setShow} />}

{/* ----- Only visible in desktop ----- */}
{isMarketed && (
Expand Down

0 comments on commit 93bf920

Please sign in to comment.