Skip to content

Commit 1851838

Browse files
Merge branch 'develop' into chore/ddw-1069-update-readme-to-include-linking-steps
2 parents 18ed55a + b467468 commit 1851838

File tree

14 files changed

+253
-88
lines changed

14 files changed

+253
-88
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Features
66

7+
- Implemented hover tooltips for menu ([PR 2938](https://github.com/input-output-hk/daedalus/pull/2938))
78
- Improved UI regarding the Hardware Wallet public key export error ([PR 2922](https://github.com/input-output-hk/daedalus/pull/2922))
89
- Added ASCII name to token header when metadata name is missing ([PR 2904](https://github.com/input-output-hk/daedalus/pull/2904))
910
- Improved IPC by reducing the amount of messages from periodic events ([PR 2892](https://github.com/input-output-hk/daedalus/pull/2892))
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { defineMessages } from 'react-intl';
2+
3+
export const messages = defineMessages({
4+
wallets: {
5+
id: 'sidebar.categoryTooltip.wallets',
6+
defaultMessage: '!!!Wallets',
7+
description: 'Text for the tooltip of wallets category',
8+
},
9+
staking: {
10+
id: 'sidebar.categoryTooltip.staking',
11+
defaultMessage: '!!!Staking',
12+
description: 'Text for the tooltip of staking category',
13+
},
14+
settings: {
15+
id: 'sidebar.categoryTooltip.settings',
16+
defaultMessage: '!!!Settings',
17+
description: 'Text for the tooltip of settings category',
18+
},
19+
voting: {
20+
id: 'sidebar.categoryTooltip.voting',
21+
defaultMessage: '!!!Voting',
22+
description: 'Text for the tooltip of voting category',
23+
},
24+
});
Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,53 @@
1-
import React, { Component } from 'react';
2-
// @ts-ignore ts-migrate(2305) FIXME: Module '"react"' has no exported member 'Node'.
3-
import type { Node } from 'react';
1+
import React from 'react';
42
import SVGInline from 'react-svg-inline';
53
import { observer } from 'mobx-react';
64
import classNames from 'classnames';
75
import { camelCase } from 'lodash';
6+
import { PopOver } from 'react-polymorph/lib/components/PopOver';
7+
import { injectIntl } from 'react-intl';
88
import type { SidebarCategoryInfo } from '../../config/sidebarConfig';
99
import styles from './SidebarCategory.scss';
10+
import { messages } from './SidebarCategory.messages';
11+
import type { Intl } from '../../types/i18nTypes';
12+
import { TOOLTIP_DELAY } from '../../config/timingConfig';
1013

1114
type Props = {
1215
category: SidebarCategoryInfo;
16+
intl: Intl;
1317
isActive: boolean;
1418
onClick: (...args: Array<any>) => any;
15-
content?: Node;
19+
content?: React.ReactNode;
1620
};
1721

18-
@observer
19-
class SidebarCategory extends Component<Props> {
20-
render() {
21-
const { category, isActive, onClick, content } = this.props;
22-
const { name, icon, route } = category;
23-
const className = camelCase(name);
24-
const componentStyles = classNames(
25-
styles.component,
26-
className,
27-
styles[className],
28-
{
29-
[styles.active]: isActive,
30-
}
31-
);
32-
const iconClassName = classNames(styles.icon, styles[`${className}Icon`]);
33-
return (
22+
function SidebarCategory({
23+
category,
24+
intl,
25+
isActive,
26+
onClick,
27+
content,
28+
}: Props) {
29+
const { name, icon, route, tooltipTextId } = category;
30+
const className = camelCase(name);
31+
const componentStyles = classNames(
32+
styles.component,
33+
className,
34+
styles[className],
35+
isActive && styles.active
36+
);
37+
const iconClassName = classNames(styles.icon, styles[`${className}Icon`]);
38+
return (
39+
<PopOver
40+
delay={TOOLTIP_DELAY}
41+
offset={[0, -20]}
42+
content={tooltipTextId && intl.formatMessage(messages[tooltipTextId])}
43+
placement="bottom"
44+
>
3445
<button className={componentStyles} onClick={() => onClick(route)}>
3546
<SVGInline svg={icon} className={iconClassName} />
3647
{content}
3748
</button>
38-
);
39-
}
49+
</PopOver>
50+
);
4051
}
4152

42-
export default SidebarCategory;
53+
export default injectIntl(observer(SidebarCategory));

source/renderer/app/components/widgets/NewsFeedIcon.scss

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,38 @@
33
right: 29px;
44
top: 20px;
55

6-
&.notificationDot {
7-
@extend .dot;
8-
9-
&:after {
10-
background: var(
11-
--theme-news-feed-icon-red-dot-background-color
12-
) !important;
13-
}
14-
}
15-
16-
&.updateDot {
17-
@extend .dot;
18-
}
19-
20-
.icon {
6+
.button {
217
border-radius: 50%;
228
cursor: pointer;
239
display: block;
2410
height: 44px;
2511
position: relative;
2612
width: 44px;
2713

14+
&:hover {
15+
background-color: var(
16+
--theme-news-feed-icon-toggle-hover-background-color
17+
);
18+
}
19+
20+
&.notificationDot {
21+
@extend .dot;
22+
23+
&:after {
24+
background: var(--theme-news-feed-icon-red-dot-background-color);
25+
}
26+
}
27+
28+
&.updateDot {
29+
@extend .dot;
30+
31+
&:after {
32+
background: var(--theme-news-feed-icon-green-dot-background-color);
33+
}
34+
}
35+
}
36+
37+
.icon {
2838
svg {
2939
height: 22px;
3040
left: 11px;
@@ -36,18 +46,11 @@
3646
stroke: var(--theme-news-feed-icon-color);
3747
}
3848
}
39-
40-
&:hover {
41-
background-color: var(
42-
--theme-news-feed-icon-toggle-hover-background-color
43-
);
44-
}
4549
}
4650
}
4751

4852
.dot {
4953
&:after {
50-
background: var(--theme-news-feed-icon-green-dot-background-color);
5154
border-radius: 12.5px;
5255
content: '';
5356
display: block;
@@ -59,3 +62,7 @@
5962
width: 8px;
6063
}
6164
}
65+
66+
.tooltip {
67+
white-space: nowrap;
68+
}
Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,60 @@
1-
import React, { Component } from 'react';
1+
import React from 'react';
22
import SVGInline from 'react-svg-inline';
33
import classNames from 'classnames';
4+
import { PopOver } from 'react-polymorph/lib/components/PopOver';
5+
import { defineMessages, injectIntl } from 'react-intl';
46
import newsFeedIcon from '../../assets/images/top-bar/news-feed-icon.inline.svg';
57
import styles from './NewsFeedIcon.scss';
8+
import type { Intl } from '../../types/i18nTypes';
9+
import { TOOLTIP_DELAY } from '../../config/timingConfig';
610

711
type Props = {
12+
intl: Intl;
813
onNewsFeedIconClick: (...args: Array<any>) => any;
914
newsFeedIconClass?: string;
1015
hasNotification: boolean;
1116
hasUpdate: boolean;
1217
};
13-
export default class NewsFeedIcon extends Component<Props> {
14-
render() {
15-
const {
16-
onNewsFeedIconClick,
17-
newsFeedIconClass,
18-
hasNotification,
19-
hasUpdate,
20-
} = this.props;
21-
const componentClasses = classNames([
22-
styles.component,
23-
hasNotification && !hasUpdate ? styles.notificationDot : null,
24-
hasUpdate ? styles.updateDot : null,
25-
newsFeedIconClass,
26-
]);
27-
return (
28-
<button className={componentClasses} onClick={onNewsFeedIconClick}>
29-
<SVGInline className={styles.icon} svg={newsFeedIcon} />
30-
</button>
31-
);
32-
}
18+
19+
const messages = defineMessages({
20+
iconTooltip: {
21+
id: 'news.newsfeed.iconTooltip',
22+
defaultMessage: '!!!Newsfeed',
23+
description: 'Newsfeed',
24+
},
25+
});
26+
27+
function NewsFeedIcon({
28+
intl,
29+
onNewsFeedIconClick,
30+
newsFeedIconClass,
31+
hasNotification,
32+
hasUpdate,
33+
}: Props) {
34+
const buttonClasses = classNames([
35+
styles.button,
36+
hasNotification && !hasUpdate && styles.notificationDot,
37+
hasUpdate && styles.updateDot,
38+
newsFeedIconClass,
39+
]);
40+
return (
41+
<div className={styles.component}>
42+
<PopOver
43+
appendTo="parent"
44+
delay={TOOLTIP_DELAY}
45+
offset={[0, 0]}
46+
content={
47+
<span className={styles.tooltip}>
48+
{intl.formatMessage(messages.iconTooltip)}
49+
</span>
50+
}
51+
>
52+
<button className={buttonClasses} onClick={onNewsFeedIconClick}>
53+
<SVGInline className={styles.icon} svg={newsFeedIcon} />
54+
</button>
55+
</PopOver>
56+
</div>
57+
);
3358
}
59+
60+
export default injectIntl(NewsFeedIcon);

source/renderer/app/components/widgets/NodeSyncStatusIcon.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { formattedNumber } from '../../utils/formatters';
77
import spinnerIcon from '../../assets/images/top-bar/node-sync-spinner.inline.svg';
88
import syncedIcon from '../../assets/images/top-bar/node-sync-synced.inline.svg';
99
import styles from './NodeSyncStatusIcon.scss';
10+
import { TOOLTIP_DELAY } from '../../config/timingConfig';
1011

1112
const messages = defineMessages({
1213
blocksSynced: {
@@ -32,13 +33,15 @@ export default class NodeSyncStatusIcon extends Component<Props> {
3233
const statusIcon = isSynced ? syncedIcon : spinnerIcon;
3334
const componentClasses = classNames([
3435
styles.component,
35-
isSynced ? null : styles.syncing,
36-
hasTadaIcon ? styles.hasTadaIcon : null,
36+
!isSynced && styles.syncing,
37+
hasTadaIcon && styles.hasTadaIcon,
3738
]);
3839
const percentage = syncPercentage.toFixed(syncPercentage === 100 ? 0 : 2);
3940
return (
4041
<div className={componentClasses}>
4142
<PopOver
43+
delay={TOOLTIP_DELAY}
44+
offset={[0, 10]}
4245
content={intl.formatMessage(messages.blocksSynced, {
4346
percentage: formattedNumber(percentage),
4447
})}

source/renderer/app/config/sidebarConfig.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ export type SidebarCategoryInfo = {
1818
name: string;
1919
icon: string;
2020
route: string;
21+
tooltipTextId?: string;
2122
};
2223
export const CATEGORIES_BY_NAME = {
2324
WALLETS: {
2425
name: 'WALLETS',
2526
icon: walletsIcon,
2627
route: ROUTES.WALLETS.ROOT,
28+
tooltipTextId: 'wallets',
2729
},
2830
PAPER_WALLET_CREATE_CERTIFICATE: {
2931
name: 'PAPER_WALLET_CREATE_CERTIFICATE',
@@ -34,16 +36,19 @@ export const CATEGORIES_BY_NAME = {
3436
name: 'STAKING_DELEGATION_COUNTDOWN',
3537
icon: delegationIcon,
3638
route: ROUTES.STAKING.COUNTDOWN,
39+
tooltipTextId: 'staking',
3740
},
3841
STAKING: {
3942
name: 'STAKING',
4043
icon: delegationProgressIcon,
4144
route: ROUTES.STAKING.ROOT,
45+
tooltipTextId: 'staking',
4246
},
4347
SETTINGS: {
4448
name: 'SETTINGS',
4549
icon: settingsIcon,
4650
route: ROUTES.SETTINGS.ROOT,
51+
tooltipTextId: 'settings',
4752
},
4853
NETWORK_INFO: {
4954
name: 'NETWORK_INFO',
@@ -54,6 +59,7 @@ export const CATEGORIES_BY_NAME = {
5459
name: 'VOTING',
5560
icon: votingIcon,
5661
route: ROUTES.VOTING.REGISTRATION,
62+
tooltipTextId: 'voting',
5763
},
5864
};
5965
export const CATEGORIES_WITH_DELEGATION_COUNTDOWN = [

source/renderer/app/config/timingConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ export const ASSET_TOKEN_DISPLAY_DELAY = 250; // .25 second | unit: milliseconds
4141
export const DECENTRALIZATION_LEVEL_POLLING_INTERVAL = 1 * 1000; // 1 second | unit: milliseconds
4242

4343
export const TOGGLE_TOKEN_FAVORITE_TIMEOUT = 300; // .3 second | unit: milliseconds
44+
45+
export const TOOLTIP_DELAY = [300, 0]; // [enter, leave] .3 second | unit: milliseconds

source/renderer/app/features/discreet-mode/ui/discreet-toggle-top-bar/DiscreetToggleTopBar.scss

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,9 @@
2828
}
2929

3030
.popOverRoot {
31-
pointer-events: all;
32-
width: 210px;
33-
34-
.content {
35-
font-family: var(--font-regular);
36-
font-size: 14px;
31+
width: 200px;
3732

33+
.popOverContent {
3834
b {
3935
font-family: var(--font-semibold);
4036
}

0 commit comments

Comments
 (0)