mirror of
https://github.com/hyperspacedev/hyperspace
synced 2025-01-30 17:14:57 +01:00
Scroll to other posts only when they aren't the top post
This commit is contained in:
parent
caf4a3846e
commit
5daec27ad7
@ -1,12 +1,11 @@
|
||||
import React, { Component } from 'react';
|
||||
import { withStyles, CircularProgress, Typography, Paper, Button, Chip, Avatar, Slide} from '@material-ui/core';
|
||||
import { withStyles, CircularProgress, Typography, Paper} from '@material-ui/core';
|
||||
import {styles} from './PageLayout.styles';
|
||||
import Post from '../components/Post';
|
||||
import { Status } from '../types/Status';
|
||||
import { Context } from '../types/Context';
|
||||
import Mastodon from 'megalodon';
|
||||
import {withSnackbar} from 'notistack';
|
||||
import ArrowUpwardIcon from '@material-ui/icons/ArrowUpward';
|
||||
|
||||
interface IConversationPageState {
|
||||
posts?: [Status];
|
||||
@ -82,7 +81,7 @@ class Conversation extends Component<any, IConversationPageState> {
|
||||
|
||||
componentDidUpdate() {
|
||||
const where: HTMLElement | null = document.getElementById(`post_${this.state.conversationId}`);
|
||||
if (where) {
|
||||
if (where && this.state.posts && this.state.posts[0].id !== this.state.conversationId) {
|
||||
window.scrollTo(0, where.getBoundingClientRect().top);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user