Skip to content

Commit 0bfc0e0

Browse files
Merge pull request #572 from PolymathNetwork/fix/dividends-list-overflow
Fix/dividends list overflow
2 parents 56b46a5 + 0b1e3ea commit 0bfc0e0

6 files changed

Lines changed: 53 additions & 53 deletions

File tree

packages/new-polymath-issuer/src/components/CheckpointList/Container.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export class CheckpointListContainerBase extends Component<Props> {
125125

126126
return (
127127
<CheckpointListPresenter
128+
hasDividends={!!Object.keys(dividendsData).length}
128129
allDividendsCompleted={allDividendsCompleted}
129130
checkpoints={sortedCheckpoints}
130131
securityTokenSymbol={securityTokenSymbol}

packages/new-polymath-issuer/src/components/CheckpointList/Presenter.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface Props {
2020
securityTokenSymbol: string;
2121
downloadOwnershipList: (checkpoint: types.CheckpointEntity) => void;
2222
allDividendsCompleted: boolean;
23+
hasDividends: boolean;
2324
loading?: boolean;
2425
}
2526

@@ -28,6 +29,7 @@ export const CheckpointListPresenter = ({
2829
securityTokenSymbol,
2930
downloadOwnershipList,
3031
allDividendsCompleted,
32+
hasDividends,
3133
loading,
3234
}: Props) => {
3335
const checkpointsByYear = groupBy(checkpoints, checkpoint =>
@@ -95,6 +97,7 @@ export const CheckpointListPresenter = ({
9597
/>
9698
</sc.ProgressIndicator>
9799
<DividendList
100+
hasDividends={hasDividends}
98101
allDividendsCompleted={allDividendsCompleted}
99102
checkpointIndex={checkpoint.index}
100103
securityTokenSymbol={securityTokenSymbol}

packages/new-polymath-issuer/src/components/DividendList/Container.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface Props {
1111
securityTokenSymbol: string;
1212
checkpointIndex: number;
1313
allDividendsCompleted: boolean;
14+
hasDividends: boolean;
1415
}
1516

1617
export class DividendListContainerBase extends Component<Props> {
@@ -19,6 +20,7 @@ export class DividendListContainerBase extends Component<Props> {
1920
securityTokenSymbol,
2021
checkpointIndex,
2122
allDividendsCompleted,
23+
hasDividends,
2224
} = this.props;
2325
return (
2426
<DataFetcher
@@ -37,6 +39,7 @@ export class DividendListContainerBase extends Component<Props> {
3739
return (
3840
<DividendListPresenter
3941
securityTokenSymbol={securityTokenSymbol}
42+
hasDividends={hasDividends}
4043
dividends={sortedDividends}
4144
checkpointIndex={checkpointIndex}
4245
allDividendsCompleted={allDividendsCompleted}
Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Fragment, FC } from 'react';
22
import {
33
List,
4+
Flex,
45
ButtonLink,
56
Button,
67
icons,
@@ -12,6 +13,7 @@ import { DividendCard } from '~/components/DividendCard';
1213
import * as sc from './styles';
1314

1415
export interface Props {
16+
hasDividends: boolean;
1517
dividends: types.DividendEntity[];
1618
securityTokenSymbol: string;
1719
checkpointIndex: number;
@@ -23,55 +25,26 @@ export const DividendListPresenter: FC<Props> = ({
2325
dividends,
2426
checkpointIndex,
2527
allDividendsCompleted,
28+
hasDividends,
2629
}) => {
27-
const newDividendUrl = !allDividendsCompleted
28-
? '#'
29-
: `/securityTokens/${securityTokenSymbol}/checkpoints/${checkpointIndex}/dividends/new`;
30+
const NewDividendButton = hasDividends
31+
? sc.NewDividendButton
32+
: sc.PlaceholderButton;
33+
3034
return (
31-
<List>
32-
{dividends.length ? (
33-
<Fragment>
34-
{dividends.map(dividend => (
35-
<li key={dividend.uid}>
36-
<DividendCard
37-
dividend={dividend}
38-
checkpointIndex={checkpointIndex}
39-
securityTokenSymbol={securityTokenSymbol}
40-
/>
41-
</li>
42-
))}
43-
<span>
44-
<sc.NewDividendButton
45-
as={allDividendsCompleted ? ButtonLink : Button}
46-
disabled={!allDividendsCompleted}
47-
href={newDividendUrl}
48-
variant="ghost"
49-
iconPosition="top"
50-
>
51-
<IconOutlined
52-
Asset={icons.SvgPlus}
53-
width={25}
54-
height={25}
55-
scale={0.8}
56-
/>
57-
Add new <br /> dividend <br /> distribution
58-
</sc.NewDividendButton>
59-
{!allDividendsCompleted && (
60-
<TooltipPrimary placement="top-start">
61-
You can add a new dividend distribution if the previous
62-
distribution has been completed/expired.
63-
</TooltipPrimary>
64-
)}
65-
</span>
66-
</Fragment>
67-
) : (
35+
<Fragment>
36+
<Flex height={370} alignSelf="flex-start">
6837
<span>
69-
<sc.PlaceholderButton
38+
<NewDividendButton
7039
as={allDividendsCompleted ? ButtonLink : Button}
71-
href={newDividendUrl}
40+
disabled={!allDividendsCompleted}
41+
href={
42+
allDividendsCompleted
43+
? `/securityTokens/${securityTokenSymbol}/checkpoints/${checkpointIndex}/dividends/new`
44+
: undefined
45+
}
7246
variant="ghost"
7347
iconPosition="top"
74-
disabled={!allDividendsCompleted}
7548
>
7649
<IconOutlined
7750
Asset={icons.SvgPlus}
@@ -80,15 +53,30 @@ export const DividendListPresenter: FC<Props> = ({
8053
scale={0.8}
8154
/>
8255
Add new <br /> dividend <br /> distribution
83-
</sc.PlaceholderButton>
56+
</NewDividendButton>
8457
{!allDividendsCompleted && (
8558
<TooltipPrimary placement="top-start">
8659
You can add a new dividend distribution if the previous
8760
distribution has been completed/expired.
8861
</TooltipPrimary>
8962
)}
9063
</span>
91-
)}
92-
</List>
64+
</Flex>
65+
<List
66+
vertical
67+
width="100%"
68+
gridTemplateColumns="repeat(auto-fill, 300px)"
69+
>
70+
{dividends.map(dividend => (
71+
<li key={dividend.uid}>
72+
<DividendCard
73+
dividend={dividend}
74+
checkpointIndex={checkpointIndex}
75+
securityTokenSymbol={securityTokenSymbol}
76+
/>
77+
</li>
78+
))}
79+
</List>
80+
</Fragment>
9381
);
9482
};

packages/new-polymath-issuer/src/components/DividendList/styles.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ export const NewDividendButtonBase: NewDividendButtonType = styled(ButtonLink)`
1313
align-items: center;
1414
color: ${({ theme }) => theme.colors.primary};
1515
16+
&:not([disabled]):hover {
17+
opacity: 0.5;
18+
background-color: transparent;
19+
color: ${({ theme }) => theme.colors.primary};
20+
}
21+
1622
&[disabled]:hover {
1723
color: ${({ theme }) => theme.colors.primary};
1824
}
@@ -39,13 +45,10 @@ export const PlaceholderButtonBase: PlaceholderButtonType = styled(
3945
height: 370px;
4046
border: 1px dashed ${({ theme }) => theme.colors.primary};
4147
border-radius: 5px;
42-
43-
&:hover {
44-
color: ${({ theme }) => theme.colors.primary};
45-
}
48+
color: ${({ theme }) => theme.colors.primary};
4649
4750
&:not([disabled]):hover {
48-
background-color: transparent;
51+
opacity: 1;
4952
border: 2px solid ${({ theme }) => theme.colors.primary};
5053
}
5154
`;

packages/new-polymath-ui/src/components/List/List.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ interface Props extends FlexProps {
1212
export const List = styled(Grid)<Props>`
1313
${ulReset}
1414
grid-auto-flow: ${({ vertical }) => (vertical ? 'row' : 'column')};
15+
grid-auto-rows: ${({ vertical }) =>
16+
vertical && 'minmax(min-content, max-content)'};
17+
grid-auto-columns: ${({ vertical }) =>
18+
!vertical && 'minmax(min-content, max-content)'};
1519
`;
1620

1721
List.defaultProps = {
1822
...Grid.defaultProps,
1923
as: 'ul',
2024
alignItems: 'center',
21-
gridAutoRows: 'minmax(min-content, max-content)',
22-
gridAutoColumns: 'minmax(min-content, max-content)',
2325
};

0 commit comments

Comments
 (0)