Skip to content

Commit

Permalink
Merge pull request #823 from nos/develop
Browse files Browse the repository at this point in the history
[RELEASE] redo 0.5.0
  • Loading branch information
Maurice Dalderup committed Jan 13, 2019
2 parents 0f83544 + d31e8b0 commit a91cbf5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/main/index.js
Expand Up @@ -55,6 +55,7 @@ function createWindow() {
titleBarStyle: 'customButtonsOnHover',
show: false,
frame: false,
transparent: true,
icon: iconPath
});

Expand Down
Expand Up @@ -31,7 +31,10 @@ export default class BreakdownChart extends React.PureComponent {
const data = this.getData();

return (
<ResponsiveContainer width="100%" className={classNames(styles.breakdownChart, this.props.className)}>
<ResponsiveContainer
width="100%"
className={classNames(styles.breakdownChart, this.props.className)}
>
<PieChart>
<Pie
data={data}
Expand Down Expand Up @@ -66,13 +69,17 @@ export default class BreakdownChart extends React.PureComponent {
return data;
}

return [
...data.splice(0, 2),
{ symbol: 'OTHERS', value: reduceSum(data) }
];
}
const spliced = [...data.splice(0, 2)];
const main = reduceSum(spliced);
const others = { symbol: 'OTHERS', value: reduceSum(data) };
if (others.value / main < 0.02) {
return [...spliced];
} else {
return [...spliced, others];
}
};

formatValue = (value) => {
return formatCurrency(value, this.props.currency);
}
};
}
Expand Up @@ -7,14 +7,27 @@ import styles from './SectionLabel.scss';
const RADIAN = Math.PI / 180;

export default function SectionLabel(props) {
const { cx, cy, midAngle, outerRadius, percent, payload: { label } } = props;
const {
cx,
cy,
midAngle,
outerRadius,
percent,
payload: { label }
} = props;
const radius = outerRadius + 25;
const x = cx + radius * Math.cos(-midAngle * RADIAN);
const y = cy + radius * Math.sin(-midAngle * RADIAN);

return (
<g className={styles.sectionLabel}>
<text x={x} y={y - 10} className={styles.percent} textAnchor="start" dominantBaseline="central">
<text
x={x}
y={y - 10}
className={styles.percent}
textAnchor="start"
dominantBaseline="central"
>
{`${(percent * 100).toFixed(0)}%`}
</text>
<text x={x} y={y + 10} className={styles.label} textAnchor="start" dominantBaseline="central">
Expand Down
6 changes: 3 additions & 3 deletions static/splash.html
Expand Up @@ -22,9 +22,9 @@
<style>
html,
body {
background-color: #000;
width: 100%;
height: 100%;
background-color: transparent;
width: 98%;
height: 98%;
margin: 0;
overflow: hidden;
font-family: "Rubik", sans-serif;
Expand Down

0 comments on commit a91cbf5

Please sign in to comment.