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

[DDW-685] Stake Pools - Adjustments #1420

Merged
merged 22 commits into from
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
56f586f
[DDW-685] Remove duplicated code
thedanheller Jun 10, 2019
e75289c
[DDW-685] CHANGELOG
thedanheller Jun 10, 2019
a2e5df7
[DDW-685] Sticky search
thedanheller Jun 10, 2019
ec7f373
[DDW-685] Search adjustments
thedanheller Jun 10, 2019
acc3ec9
[DDW-685] Tooltip open in correct list
thedanheller Jun 10, 2019
652dd03
[DDW-685] New RETIRING label
thedanheller Jun 10, 2019
e60623e
[DDW-685] Unifyy color methods
thedanheller Jun 10, 2019
cf1dbb1
[DDW-685] Colors adjustments
thedanheller Jun 10, 2019
d059290
[DDW-685] Reverse tooltip colors (large number is green)
thedanheller Jun 10, 2019
f301f9d
[DDW-685] Wider tooltip button
thedanheller Jun 10, 2019
9640846
[DDW-685] Padding tweaks
thedanheller Jun 11, 2019
eaaa10f
[DDW-685] Padding tweaks
thedanheller Jun 12, 2019
158fb81
Merge branch 'develop' into fix/ddw-685-stake-pools-adjustments
DominikGuzei Jun 12, 2019
0a7ad3e
[DDW-685] CSS adjustments
thedanheller Jun 13, 2019
c62e221
[DDW-685] Reverse Controlled Stake logic
thedanheller Jun 13, 2019
425f483
[DDW-685] Order CSS rules
nikolaglumac Jun 13, 2019
fa63f82
[DDW-685] Test removing extra Storybook stories
thedanheller Jun 13, 2019
0b1a94d
Merge branch 'fix/ddw-685-stake-pools-adjustments' of https://github.…
thedanheller Jun 13, 2019
8b85a1f
[DDW-685] Fix failing AppVeyor builds
nikolaglumac Jun 14, 2019
ceb196b
[DDW-685] Add back the Storybook stories
thedanheller Jun 14, 2019
ab368d8
Merge branch 'fix/ddw-685-stake-pools-adjustments' of https://github.…
thedanheller Jun 14, 2019
567e457
[DDW-685] language manager
thedanheller Jun 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Changelog

### Fixes

- Added fine adjustments to the Stake Pools screen. ([PR 1420](https://github.com/input-output-hk/daedalus/pull/1420))
- Fixed the Block consolidation status screen not fully shown in minimized mode when the Japanese language is selected ([PR 1416](https://github.com/input-output-hk/daedalus/pull/1416))
- Fixed "marked" dependency vulnerability warning ([PR 1414](https://github.com/input-output-hk/daedalus/pull/1414)
- Fixed addresses not visible on Receive screen when Password is set for the wallet in minimized mode ([PR 1407](https://github.com/input-output-hk/daedalus/pull/1407))
Expand Down
16 changes: 6 additions & 10 deletions installers/stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ nix:
packages: [gmp,git]

packages:
- location: .
- .
extra-deps:
- git: https://github.com/dhall-lang/dhall-json
commit: d6adaa265dcf8ab5899396b05d612b2d8092dca4

- location:
git: https://github.com/dhall-lang/dhall-json
commit: d6adaa265dcf8ab5899396b05d612b2d8092dca4
extra-dep: true

- location:
git: https://github.com/input-output-hk/haskell-nsis.git
commit: 020e61eced93eaa6ab86ac603617e93aa6bf5af0
extra-dep: true
- git: https://github.com/input-output-hk/haskell-nsis.git
commit: 020e61eced93eaa6ab86ac603617e93aa6bf5af0
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import SVGInline from 'react-svg-inline';
import classnames from 'classnames';
import clockIcon from '../../../assets/images/clock.inline.svg';
import styles from './StakePoolThumbnail.scss';
import { getHSLColor } from '../../../utils/colors';
import { getColorFromRange } from '../../../utils/colors';
import type { StakePool } from '../../../api/staking/types';
import StakePoolTooltip from './StakePoolTooltip';

Expand All @@ -17,7 +17,7 @@ type Props = {
flipHorizontal: boolean,
flipVertical: boolean,
onOpenExternalLink: Function,
handleClick: Function,
onClick: Function,
onClose: Function,
};

Expand All @@ -29,12 +29,12 @@ export const StakePoolThumbnail = observer((props: Props) => {
currentTheme,
flipHorizontal,
flipVertical,
handleClick,
onClick,
onClose,
onOpenExternalLink,
} = props;

const color = getHSLColor(index);
const color = getColorFromRange(index);

const { ranking, id, retirement } = stakePool;

Expand All @@ -45,12 +45,7 @@ export const StakePoolThumbnail = observer((props: Props) => {

return (
<div className={componentClassnames}>
<div
className={styles.content}
onClick={handleClick}
role="link"
aria-hidden
>
<div className={styles.content} onClick={onClick} role="link" aria-hidden>
<div className={styles.id}>{id}</div>
<div className={styles.ranking} style={{ color }}>
{ranking}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
background-color: var(--theme-staking-stake-pool-background-color);
border: solid 1px var(--theme-staking-stake-pool-border-color);
border-radius: 4px;
box-sizing: unset;
display: flex;
height: 71px;
justify-content: center;
Expand Down Expand Up @@ -50,7 +49,7 @@
.clockIcon {
display: block;
line-height: 0;
margin: 0;
margin: 1px 0 0;
padding: 0;
text-align: center;

Expand Down
162 changes: 85 additions & 77 deletions source/renderer/app/components/staking/stake-pools/StakePoolTooltip.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// @flow
import React, { Component, Fragment } from 'react';
import React, { Component } from 'react';
import { observer } from 'mobx-react';
import { defineMessages, intlShape } from 'react-intl';
import chroma from 'chroma-js';
import { defineMessages, intlShape, FormattedMessage } from 'react-intl';
import { Button } from 'react-polymorph/lib/components/Button';
import classnames from 'classnames';
import moment from 'moment';
import SVGInline from 'react-svg-inline';
import { ButtonSkin } from 'react-polymorph/lib/skins/simple/ButtonSkin';
import styles from './StakePoolTooltip.scss';
import { getHSLColor } from '../../../utils/colors';
import { getColorFromRange } from '../../../utils/colors';
import type { StakePool } from '../../../api/staking/types';
import closeCross from '../../../assets/images/close-cross.inline.svg';

Expand All @@ -36,7 +35,7 @@ const messages = defineMessages({
},
retirement: {
id: 'staking.stakePools.tooltip.retirement',
defaultMessage: '!!!Retirement:',
defaultMessage: '!!!Retirement in {retirementFromNow}',
description: '"Retirement" for the Stake Pools Tooltip page.',
},
delegateButton: {
Expand Down Expand Up @@ -94,16 +93,12 @@ export default class StakePoolTooltip extends Component<Props> {
this.tooltipClick = true;
};

get color() {
const { index } = this.props;
return getHSLColor(index);
}

render() {
const { intl } = this.context;
const {
stakePool,
isVisible,
index,
currentTheme,
flipHorizontal,
flipVertical,
Expand All @@ -130,7 +125,12 @@ export default class StakePoolTooltip extends Component<Props> {
flipVertical ? styles.flipVertical : null,
]);

const lighnessOffset = currentTheme === 'dark-blue' ? -20 : 0;
const darken = currentTheme === 'dark-blue' ? 1 : 0;
const alpha = 0.3;
const reverse = true;
const retirementFromNow = retirement
? moment(retirement).fromNow(true)
: '';

return (
<div
Expand All @@ -142,76 +142,84 @@ export default class StakePoolTooltip extends Component<Props> {
<div
className={styles.colorBand}
style={{
background: this.color,
background: getColorFromRange(index),
}}
/>
<h3 className={styles.name}>{name}</h3>
<button className={styles.closeButton} onClick={onClick}>
<SVGInline svg={closeCross} />
</button>
<div className={styles.id}>{id}</div>
<div className={styles.description}>{description}</div>
<button className={styles.url} onClick={() => onOpenExternalLink(url)}>
{url}
</button>
<dl className={styles.table}>
<dt>{intl.formatMessage(messages.ranking)}</dt>
<dd className={styles.ranking}>
<span
style={{
background: chroma(
getHSLColor(ranking, { lighnessOffset })
).alpha(0.3),
}}
>
{parseFloat(ranking).toFixed(2)}
</span>
</dd>
<dt>{intl.formatMessage(messages.controlledStake)}</dt>
<dd className={styles.controlledStake}>
<span
style={{
background: chroma(
getHSLColor(controlledStake, { lighnessOffset })
).alpha(0.3),
}}
>
{controlledStake}%
</span>
</dd>
<dt>{intl.formatMessage(messages.profitMargin)}</dt>
<dd className={styles.profitMargin}>
<span
style={{
background: chroma(
getHSLColor(profitMargin, { lighnessOffset })
).alpha(0.3),
}}
>
{profitMargin}%
</span>
</dd>
<dt>{intl.formatMessage(messages.performance)}</dt>
<dd className={styles.performance}>
<span
style={{
background: chroma(
getHSLColor(performance, { lighnessOffset })
).alpha(0.3),
}}
>
{performance}%
</span>
</dd>
<div className={styles.container}>
<h3 className={styles.name}>{name}</h3>
<button className={styles.closeButton} onClick={onClick}>
<SVGInline svg={closeCross} />
</button>
<div className={styles.id}>{id}</div>
{retirement && (
<Fragment>
<dt>{intl.formatMessage(messages.retirement)}</dt>
<dd className={styles.retirement}>
<span>{moment(retirement).fromNow(true)}</span>
</dd>
</Fragment>
<div className={styles.retirement}>
<FormattedMessage
{...messages.retirement}
values={{ retirementFromNow }}
/>
</div>
)}
</dl>
<div className={styles.description}>{description}</div>
<button
className={styles.url}
onClick={() => onOpenExternalLink(url)}
>
{url}
</button>
<dl className={styles.table}>
<dt>{intl.formatMessage(messages.ranking)}</dt>
<dd className={styles.ranking}>
<span
style={{
background: getColorFromRange(ranking, { darken, alpha }),
}}
>
{ranking}
</span>
</dd>
<dt>{intl.formatMessage(messages.controlledStake)}</dt>
<dd className={styles.controlledStake}>
<span
style={{
background: getColorFromRange(controlledStake, {
darken,
alpha,
}),
}}
>
{controlledStake}%
</span>
</dd>
<dt>{intl.formatMessage(messages.profitMargin)}</dt>
<dd className={styles.profitMargin}>
<span
style={{
background: getColorFromRange(profitMargin, {
darken,
alpha,
reverse,
}),
}}
>
{profitMargin}%
</span>
</dd>
<dt>{intl.formatMessage(messages.performance)}</dt>
<dd className={styles.performance}>
<span
style={{
background: getColorFromRange(performance, {
darken,
alpha,
reverse,
}),
}}
>
{performance}%
</span>
</dd>
</dl>
</div>
<Button
label={intl.formatMessage(messages.delegateButton)}
onClick={() => {}}
Expand Down