Skip to content

Commit 6312d11

Browse files
[DDW-939] Fix Stake Pools tooltip z-index (#2863)
Co-authored-by: Daniel Main <[email protected]>
1 parent 4c86612 commit 6312d11

File tree

9 files changed

+209
-137
lines changed

9 files changed

+209
-137
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
- Improved stake pool searchbar ([PR 2847](https://github.com/input-output-hk/daedalus/pull/2847))
88
- Implemented catalyst dynamic content ([PR 2856](https://github.com/input-output-hk/daedalus/pull/2856))
99

10+
### Fixes
11+
12+
- Fixed main container zIndex ([PR 2863](https://github.com/input-output-hk/daedalus/pull/2863))
13+
1014
## 4.9.0-FC1
1115

1216
### Features
@@ -23,7 +27,7 @@
2327
- Fixed behaviour of wallet settings option of the app menu ([PR 2838](https://github.com/input-output-hk/daedalus/pull/2838))
2428
- Fixed styling of ITN rewards feature ([PR 2861](https://github.com/input-output-hk/daedalus/pull/2861))
2529
- Fixed available disk space takes a long time to show ([PR 2849](https://github.com/input-output-hk/daedalus/pull/2849))
26-
30+
2731
### Chores
2832

2933
- Migrated codebase from javascript to typescript ([PR 2843](https://github.com/input-output-hk/daedalus/pull/2843))

source/renderer/app/components/layout/SidebarLayout.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
overflow: hidden;
1313
position: relative;
1414
width: 100%;
15-
// Show elements that overflow the main above the sidebar area
16-
z-index: 20;
1715
}
1816

1917
.sidebar {
@@ -24,8 +22,6 @@
2422
.topbar {
2523
box-shadow: 0 5px 20px 0 var(--theme-sidebar-layout-topbar-shadow-color);
2624
flex-shrink: 0;
27-
// Show elements that overflow the topbar above the content area
28-
z-index: 20;
2925
}
3026

3127
.contentWrapper {

source/renderer/app/components/staking/layouts/StakingWithNavigation.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
$stake-pools-search-z-index: 25;
2+
13
.component {
24
display: flex;
35
flex-direction: column;
@@ -14,7 +16,7 @@
1416
flex-shrink: 0;
1517
height: 50px;
1618
position: relative;
17-
z-index: 2;
19+
z-index: $stake-pools-search-z-index;
1820
}
1921

2022
.page {

source/renderer/app/components/staking/layouts/StakingWithNavigation.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
import React, { Component, createRef } from 'react';
2-
// @ts-ignore ts-migrate(2305) FIXME: Module '"react"' has no exported member 'Node'.
3-
import type { ElementRef, Node } from 'react';
42
import classnames from 'classnames';
53
import { observer } from 'mobx-react';
64
import StakingNavigation from '../navigation/StakingNavigation';
75
// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './StakingWithNavigation.scss' ... Remove this comment to see the full error message
86
import styles from './StakingWithNavigation.scss';
97

108
type Props = {
11-
children?: Node;
9+
children?: React.ReactNode;
1210
activeItem: string;
1311
showInfoTab: boolean;
1412
onNavItemClick: (...args: Array<any>) => any;
1513
isActiveNavItem: (...args: Array<any>) => any;
1614
};
1715
type ContextValue = {
18-
scrollElementRef: ElementRef<any> | null | undefined;
16+
scrollElementRef: React.RefObject<HTMLDivElement> | null | undefined;
1917
};
2018
export const StakingPageScrollContext = React.createContext<ContextValue>({
2119
scrollElementRef: null,
2220
});
2321

2422
@observer
2523
class StakingWithNavigation extends Component<Props> {
26-
stakingPageRef = createRef<any>();
24+
stakingPageRef = createRef<HTMLDivElement>();
2725

2826
render() {
2927
const {
@@ -49,13 +47,7 @@ class StakingWithNavigation extends Component<Props> {
4947
showInfoTab={showInfoTab}
5048
/>
5149
</div>
52-
<div
53-
className={styles.page}
54-
ref={(ref) => {
55-
// @ts-ignore ts-migrate(2540) FIXME: Cannot assign to 'current' because it is a read-on... Remove this comment to see the full error message
56-
this.stakingPageRef.current = ref;
57-
}}
58-
>
50+
<div className={styles.page} ref={this.stakingPageRef}>
5951
{children}
6052
</div>
6153
</div>

source/renderer/app/components/staking/stake-pools/StakePoolsRanking.tsx

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import type { DiscreetModeFeature } from '../../../features/discreet-mode';
3333
import WalletsDropdown from '../../widgets/forms/WalletsDropdown';
3434
import ButtonLink from '../../widgets/ButtonLink';
3535
import { Slider } from '../../widgets/Slider';
36+
import { StakingPageScrollContext } from '../layouts/StakingWithNavigation';
3637
import styles from './StakePoolsRanking.scss';
3738

3839
const messages = defineMessages({
@@ -390,42 +391,50 @@ class StakePoolsRanking extends Component<Props, State> {
390391
/>
391392
) : null}
392393
</div>
393-
<div className={styles.lower}>
394-
<div className={styles.row}>
395-
<div className={styles.col}>
396-
<div className={styles.outOfSliderRangeStart} />
397-
</div>
398-
<div className={styles.slider}>
399-
<Slider
400-
min={Math.round(
401-
MIN_DELEGATION_FUNDS_LOG * RANKING_SLIDER_RATIO
402-
)}
403-
minDisplayValue={MIN_DELEGATION_FUNDS}
404-
max={Math.round(maxDelegationFundsLog * RANKING_SLIDER_RATIO)}
405-
maxDisplayValue={maxDelegationFunds}
406-
value={sliderValue}
407-
displayValue={displayValue}
408-
showRawValue
409-
onChange={this.onSliderChange}
410-
onAfterChange={rankStakePools}
411-
disabled={isLoading || isRanking}
412-
showTooltip
413-
minTooltip={intl.formatMessage(messages.rankingMinTooltip)}
414-
maxTooltip={intl.formatMessage(messages.rankingMaxTooltip)}
415-
/>
416-
</div>
417-
<div className={styles.col}>
418-
<div className={styles.outOfRangeMaxAmount}>
419-
<PopOver
420-
content={intl.formatMessage(messages.rankingExtraTooltip)}
421-
>
422-
{shortNumber(CIRCULATING_SUPPLY)}
423-
</PopOver>
394+
<StakingPageScrollContext.Consumer>
395+
{({ scrollElementRef }) => (
396+
<div className={styles.lower}>
397+
<div className={styles.row}>
398+
<div className={styles.col}>
399+
<div className={styles.outOfSliderRangeStart} />
400+
</div>
401+
<div className={styles.slider}>
402+
<Slider
403+
min={Math.round(
404+
MIN_DELEGATION_FUNDS_LOG * RANKING_SLIDER_RATIO
405+
)}
406+
minDisplayValue={MIN_DELEGATION_FUNDS}
407+
max={Math.round(
408+
maxDelegationFundsLog * RANKING_SLIDER_RATIO
409+
)}
410+
maxDisplayValue={maxDelegationFunds}
411+
value={sliderValue}
412+
displayValue={displayValue}
413+
showRawValue
414+
onChange={this.onSliderChange}
415+
onAfterChange={rankStakePools}
416+
disabled={isLoading || isRanking}
417+
showTooltip
418+
minTooltip={intl.formatMessage(messages.rankingMinTooltip)}
419+
maxTooltip={intl.formatMessage(messages.rankingMaxTooltip)}
420+
tooltipAppendTo={() => scrollElementRef.current}
421+
/>
422+
</div>
423+
<div className={styles.col}>
424+
<div className={styles.outOfRangeMaxAmount}>
425+
<PopOver
426+
content={intl.formatMessage(messages.rankingExtraTooltip)}
427+
appendTo={() => scrollElementRef.current}
428+
>
429+
{shortNumber(CIRCULATING_SUPPLY)}
430+
</PopOver>
431+
</div>
432+
<div className={styles.outOfSliderRangeEnd} />
433+
</div>
424434
</div>
425-
<div className={styles.outOfSliderRangeEnd} />
426435
</div>
427-
</div>
428-
</div>
436+
)}
437+
</StakingPageScrollContext.Consumer>
429438
</div>
430439
);
431440
}

source/renderer/app/components/staking/stake-pools/StakePoolsSearch.tsx

Lines changed: 91 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { IS_GRID_REWARDS_VIEW_AVAILABLE } from '../../../config/stakingConfig';
1919
import type { Intl } from '../../../types/i18nTypes';
2020
import { messages } from './StakePoolsSearch.messages';
2121
import { StakePoolsSearchListViewButton } from './StakePoolsSearchListViewButton';
22+
import { StakingPageScrollContext } from '../layouts/StakingWithNavigation';
2223

2324
type Props = {
2425
label?: string;
@@ -92,67 +93,102 @@ function StakePoolsSearchComponent({
9293
IS_GRID_REWARDS_VIEW_AVAILABLE ? styles.withGridRewardsView : null,
9394
]);
9495
return (
95-
<div className={styles.component}>
96-
<div className={styles.container}>
97-
<SVGInline svg={searchIcon} className={styles.searchIcon} />
98-
<Input
99-
autoFocus
100-
label={label || null}
101-
className={searchInputClases}
102-
onChange={onSearch}
103-
ref={(input) => {
104-
searchInput.current = input;
105-
}}
106-
placeholder={
107-
placeholder || intl.formatMessage(messages.searchInputPlaceholder)
108-
}
109-
skin={InputSkin}
110-
value={search}
111-
maxLength={150}
112-
onFocus={autoSelectOnFocus}
113-
/>
114-
{hasSearchClearButton && (
115-
<div className={clearSearchClasses}>
116-
<PopOver content={intl.formatMessage(messages.clearTooltip)}>
117-
<button
118-
onClick={handleClearSearch}
119-
className={styles.clearSearchButton}
120-
>
121-
<SVGInline svg={closeIcon} className={styles.clearSearchIcon} />
122-
</button>
123-
</PopOver>
96+
<StakingPageScrollContext.Consumer>
97+
{({ scrollElementRef }) => (
98+
<div className={styles.component}>
99+
<div className={styles.container}>
100+
<SVGInline svg={searchIcon} className={styles.searchIcon} />
101+
<Input
102+
autoFocus
103+
label={label || null}
104+
className={searchInputClases}
105+
onChange={onSearch}
106+
ref={(input) => {
107+
searchInput.current = input;
108+
}}
109+
placeholder={
110+
placeholder ||
111+
intl.formatMessage(messages.searchInputPlaceholder)
112+
}
113+
skin={InputSkin}
114+
value={search}
115+
maxLength={150}
116+
onFocus={autoSelectOnFocus}
117+
/>
118+
{hasSearchClearButton && (
119+
<div className={clearSearchClasses}>
120+
<PopOver content={intl.formatMessage(messages.clearTooltip)}>
121+
<button
122+
onClick={handleClearSearch}
123+
className={styles.clearSearchButton}
124+
>
125+
<SVGInline
126+
svg={closeIcon}
127+
className={styles.clearSearchIcon}
128+
/>
129+
</button>
130+
</PopOver>
131+
</div>
132+
)}
124133
</div>
125-
)}
126-
</div>
127134

128-
{isBigSearchComponent && (
129-
<div className={styles.viewButtons}>
130-
<PopOver content={intl.formatMessage(messages.gridIconTooltip)}>
131-
<button className={gridButtonClasses} onClick={onGridView}>
132-
<SVGInline svg={gridIcon} />
133-
</button>
134-
</PopOver>
135-
{IS_GRID_REWARDS_VIEW_AVAILABLE && (
136-
<PopOver
137-
content={intl.formatMessage(messages.gridRewardsIconTooltip)}
138-
>
139-
<button
140-
className={gridRewardsButtonClasses}
141-
onClick={onGridRewardsView}
135+
{isBigSearchComponent && (
136+
<div className={styles.viewButtons}>
137+
<PopOver
138+
content={intl.formatMessage(messages.gridIconTooltip)}
139+
appendTo={() => scrollElementRef.current}
140+
popperOptions={{
141+
placement: 'top',
142+
modifiers: [
143+
{
144+
name: 'flip',
145+
options: {
146+
fallbackPlacements: ['bottom'],
147+
},
148+
},
149+
],
150+
}}
142151
>
143-
<SVGInline svg={gridRewardsIcon} />
144-
</button>
145-
</PopOver>
152+
<button className={gridButtonClasses} onClick={onGridView}>
153+
<SVGInline svg={gridIcon} />
154+
</button>
155+
</PopOver>
156+
{IS_GRID_REWARDS_VIEW_AVAILABLE && (
157+
<PopOver
158+
content={intl.formatMessage(messages.gridRewardsIconTooltip)}
159+
appendTo={() => scrollElementRef.current}
160+
popperOptions={{
161+
placement: 'top',
162+
modifiers: [
163+
{
164+
name: 'flip',
165+
options: {
166+
fallbackPlacements: ['bottom', 'left'],
167+
},
168+
},
169+
],
170+
}}
171+
>
172+
<button
173+
className={gridRewardsButtonClasses}
174+
onClick={onGridRewardsView}
175+
>
176+
<SVGInline svg={gridRewardsIcon} />
177+
</button>
178+
</PopOver>
179+
)}
180+
<StakePoolsSearchListViewButton
181+
isListViewTooltipVisible={isListViewTooltipVisible}
182+
isListView={isListView}
183+
onClick={onListView}
184+
onListViewVisited={onListViewVisited}
185+
tooltipTarget={scrollElementRef.current}
186+
/>
187+
</div>
146188
)}
147-
<StakePoolsSearchListViewButton
148-
isListViewTooltipVisible={isListViewTooltipVisible}
149-
isListView={isListView}
150-
onClick={onListView}
151-
onListViewVisited={onListViewVisited}
152-
/>
153189
</div>
154190
)}
155-
</div>
191+
</StakingPageScrollContext.Consumer>
156192
);
157193
}
158194

source/renderer/app/components/staking/stake-pools/StakePoolsSearchListViewButton.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type Props = {
1616
onClick?: () => void;
1717
onListViewVisited?: () => void;
1818
intl: Intl;
19+
tooltipTarget?: HTMLDivElement;
1920
};
2021

2122
function StakePoolsSearchListViewButtonComponent({
@@ -24,6 +25,7 @@ function StakePoolsSearchListViewButtonComponent({
2425
isListView,
2526
isListViewTooltipVisible,
2627
intl,
28+
tooltipTarget,
2729
}: Props) {
2830
const [visible, setVisible] = useState(false);
2931
const isPopOverVisible = visible || isListViewTooltipVisible;
@@ -37,6 +39,7 @@ function StakePoolsSearchListViewButtonComponent({
3739
<PopOver
3840
visible={isPopOverVisible}
3941
content={intl.formatMessage(messages.listIconTooltip)}
42+
appendTo={() => tooltipTarget}
4043
>
4144
<button
4245
className={listButtonClasses}

0 commit comments

Comments
 (0)