* Update websockets to allow joining document-based rooms * dynamic websocket joining * emit user.join/leave events when entering and exiting document rooms * presence storage * feat: frontend presence store * lint * UI updates * First pass editing state * refactoring * Timeout per user/doc lint * Document data loading refactor to keep Socket mounted * restore: Mark as viewed functionality Add display of 'you' to collaborators * fix: Socket/document remount when document slug changes due to title change * Revert unneccessary package update * Move editing ping interval to a shared constant * fix: Flash of sidebar when loading page directly on editing mode * separate document and revision loading * add comments for socket events * fix: Socket events getting bound multiple times on reconnect * fix: Clear client side presence state on disconnect * fix: Don't ignore server side error Improved documentation * More comments / why comments * rename Socket -> SocketPresence * fix: Handle redis is down remove unneccessary join * fix: PR feedback
40 lines
1004 B
JavaScript
40 lines
1004 B
JavaScript
// @flow
|
|
import * as React from 'react';
|
|
import styled from 'styled-components';
|
|
import { pulsate } from 'shared/styles/animations';
|
|
import Flex from 'shared/components/Flex';
|
|
import Fade from 'components/Fade';
|
|
|
|
import { randomInteger } from 'shared/random';
|
|
|
|
const randomValues = Array.from(
|
|
new Array(5),
|
|
() => `${randomInteger(85, 100)}%`
|
|
);
|
|
|
|
const LoadingPlaceholder = () => {
|
|
return (
|
|
<Wrapper>
|
|
<Flex column auto>
|
|
<Mask style={{ width: randomValues[0] }} header />
|
|
<Mask style={{ width: randomValues[1] }} />
|
|
<Mask style={{ width: randomValues[2] }} />
|
|
<Mask style={{ width: randomValues[3] }} />
|
|
</Flex>
|
|
</Wrapper>
|
|
);
|
|
};
|
|
|
|
const Wrapper = styled(Fade)`
|
|
margin: 40px 0;
|
|
`;
|
|
|
|
const Mask = styled(Flex)`
|
|
height: ${props => (props.header ? 28 : 18)}px;
|
|
margin-bottom: ${props => (props.header ? 32 : 14)}px;
|
|
background-color: ${props => props.theme.smoke};
|
|
animation: ${pulsate} 1.3s infinite;
|
|
`;
|
|
|
|
export default LoadingPlaceholder;
|