Skip to content
Snippets Groups Projects
Commit c839efce authored by Quoc Huy Nguyen Dinh's avatar Quoc Huy Nguyen Dinh
Browse files

Fix auto-scroll to highlighted witness

parent 5029ee36
No related branches found
No related tags found
3 merge requests!137Closes #36,!133Fix: Governance expiry warning should have proper year at all times,!132Witnesses page fixes
......@@ -105,7 +105,9 @@ class Witnesses extends React.Component {
witnessToHighlight: highlight,
});
this.loadWitnessAccounts();
}
componentDidUpdate() {
this.scrollToHighlightedWitness();
}
......@@ -198,24 +200,21 @@ class Witnesses extends React.Component {
// eslint-disable-next-line class-methods-use-this
scrollToHighlightedWitness() {
if (typeof document !== 'undefined') {
setTimeout(() => {
const highlightedWitnessElement = document.querySelector(
'.Witnesses__highlight'
);
if (highlightedWitnessElement) {
highlightedWitnessElement.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center',
});
}
}, 1000);
const highlightedWitnessElement = document.querySelector(
'.Witnesses__highlight'
);
if (highlightedWitnessElement) {
highlightedWitnessElement.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center',
});
}
}
}
updateWitnessToHighlight(witness) {
this.setState({ witnessToHighlight: witness });
this.scrollToHighlightedWitness();
window.history.pushState('', '', `/~witnesses?highlight=${witness}`);
}
......@@ -555,6 +554,7 @@ class Witnesses extends React.Component {
</Link>
{' '}
{blockGap(head_block, lastBlock)}
{' '}
on v
{runningVersion}
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment