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

Fix for table rows not being animated correctly #43

Merged
merged 1 commit into from
Apr 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions frontend/src/features/staking/TicketsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TimeAgo from 'react-timeago';
import { Table } from 'react-bootstrap';
// @ts-ignore
import Fade from 'react-reveal/Fade';
import { TransitionGroup } from 'react-transition-group';
import { TransitionGroup, CSSTransition } from 'react-transition-group';

import { Ticket } from '../../middleware/models';
import { TransactionHash } from '../../components/Shared/shared';
Expand All @@ -16,28 +16,20 @@ import { transitionGroupProps } from '../../constants';
export default class TicketsTable extends React.Component<TicketsTableProps> {

render() {

return (
<Table hover>
<thead>
<tr>
<th></th>
<th>timestamp</th>
<th>hash</th>
</tr>
</thead>
{this.props.items.length > 0 && (
<TransitionGroup {...transitionGroupProps} component="tbody">
{this.props.items.map((ticket) => {
const tx = ticket.getTx()
return (
<Fade slide cascade key={tx.getHash()}>
<CSSTransition key={tx.getHash()} timeout={500} classNames="shrink">
<tr className="clickable" onClick={() => this.props.onItemClick(ticket)}>
<td><TicketStatusIcon status={ticket.getStatus()} /></td>
<td><TimeAgo date={tx.getTimestamp().toDate()} /></td>
<td><TransactionHash tx={tx} /></td>
</tr>
</Fade>
</CSSTransition>
)
})}
</TransitionGroup>
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/features/transactions/TransactionTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,21 @@ class TransactionTable extends React.Component<OwnProps> {
<div>
{this.props.items.length > 0 && (
<Table hover>
<thead>
<tr>
<th></th>
<th>Amount</th>
<th>Timestamp</th>
<th>Tx type</th>
<th>Hash</th>
</tr>
</thead>
<TransitionGroup {...transitionGroupProps} component="tbody">
{this.props.items.map((tx: Transaction) =>
<Fade slide cascade key={tx.getHash()}>
<tr className="clickable" onClick={() => this.props.onItemClick(tx)}>
<td><TransactionMempoolStatusIcon isMined={tx.isMined()} /></td>
<td><Amount amount={tx.getAmount()} /></td>
<td><Amount amount={tx.getAmount()} rounding={6} /></td>
{showAccount && (
<td>{_.map(this.props.lookupAccounts(tx.getAccounts()), (account) => {
if (account == undefined) return null
Expand Down
97 changes: 65 additions & 32 deletions frontend/src/styles/custom.scss
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
$body-bg: #e5e5e5;

body {
background-color: #e5e5e5 !important;
background-color: #e5e5e5 !important;
}

.footer {
position: -webkit-sticky;
position: sticky;
bottom: 0px;
background-color: #f0f0f0;
font-size: 90%;
position: -webkit-sticky;
position: sticky;
bottom: 0px;
background-color: #f0f0f0;
font-size: 90%;
}

.status-icon {
opacity: 0.4;
opacity: 0.4;
}

.clickable {
cursor: pointer;
user-select: none;
&.card {
&:hover {
background-color:#efefef;
transform: translate(2px,2px);
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 2px 2px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12);
}
}
cursor: pointer;
user-select: none;
&.card {
&:hover {
background-color: #efefef;
transform: translate(2px, 2px);
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 2px 2px -2px rgba(0, 0, 0, 0.2),
0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
}
}

.card-header {
Expand All @@ -40,61 +41,93 @@ label {
}

.pastebutton-overlaid {
position: relative;
margin-top: -2em;
position: relative;
margin-top: -2em;
}

.certificate-input textarea {
font-size: 75%;
font-family: "Courier New", Courier, monospace;
font-size: 75%;
font-family: "Courier New", Courier, monospace;
}

.copy-to-clipboard {
cursor: pointer;
cursor: pointer;
}

.spendable-total .progress-bar {
background-color: #00c49f;
background-color: #00c49f;
}
.spendable-spendable .progress-bar {
background-color: #0088fe;
background-color: #0088fe;
}
.spendable-immature .progress-bar {
background-color: #ffbb28;
background-color: #ffbb28;
}
.spendable-locked .progress-bar {
background-color: #ff8042;
background-color: #ff8042;
}

main.devmonitor {
&, .navbar {
&,
.navbar {
width: 70%;
}
}

// animations
.switch-wrapper {
position: relative;
position: relative;
}

.switch-wrapper > div {
position: absolute;
width: 100%;
position: absolute;
width: 100%;
}


fieldset[disabled] {
opacity: 0.6;
}


.list-group.tight {
.list-group-item {
padding:0.5rem;
padding: 0.5rem;
}
}

form.in-progress {
opacity: 0.5;
}

.fade-enter {
opacity: 0.01;
}
.fade-enter-active {
opacity: 1;
transition: opacity 500ms ease-in;
}
.fade-exit {
opacity: 1;
}
.fade-exit-active {
opacity: 0.01;
transition: opacity 500ms ease-in;
}

.shrink-enter {
transform: scaleY(0);
transform-origin: 50% 0%;
}
.shrink-enter-active {
transform: scale(1);
transition: transform 500ms ease-in;
transform-origin: 50% 0%;
}
.shrink-exit {
transform: scaleY(1);
transform-origin: 50% 0%;
}
.shrink-exit-active {
transform: scaleY(0);
transform-origin: 50% 0%;
transition: transform 500ms ease-in;
}