Skip to content
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

fix: check for modal message in Header #1054

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading