1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 21:06:42 +07:00

fixed node loading

This commit is contained in:
Fedor Katurov 2019-11-07 14:13:46 +07:00
parent cf16cbf0f9
commit d06593b4cb
3 changed files with 32 additions and 7 deletions

View file

@ -7,6 +7,7 @@ import { UPLOAD_TYPES } from '~/redux/uploads/constants';
import { NODE_SETTINGS } from '~/redux/node/constants';
import { getURL } from '~/utils/dom';
import { PRESETS } from '~/constants/urls';
import { LoaderCircle } from '~/components/input/LoaderCircle';
interface IProps {
is_loading: boolean;
@ -174,6 +175,16 @@ const NodeImageSlideBlock: FC<IProps> = ({ node, is_loading, updateLayout }) =>
[wrap]
);
if (is_loading) {
return (
<div className={styles.placeholder}>
<div>
<LoaderCircle size={96} />
</div>
</div>
);
}
return (
<div className={classNames(styles.wrap, { is_loading })} ref={wrap}>
<ImageSwitcher
@ -195,8 +206,6 @@ const NodeImageSlideBlock: FC<IProps> = ({ node, is_loading, updateLayout }) =>
onTouchStart={startDragging}
ref={slide}
>
{(is_loading || !loaded[0] || !images.length) && <div className={styles.placeholder} />}
{images.map((file, index) => (
<div
className={classNames(styles.image_wrap, {

View file

@ -44,6 +44,22 @@
}
.placeholder {
background: red;
height: 320px;
padding-bottom: 66%;
position: relative;
& > div {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
opacity: 0.025;
}
svg {
fill: white;
}
}

View file

@ -13,7 +13,7 @@ const mapStateToProps = state => ({
});
const mapDispatchToProps = {
nodeLoadNode: NODE_ACTIONS.nodeLoadNode,
nodeGotoNode: NODE_ACTIONS.nodeGotoNode,
flowSetCellView: FLOW_ACTIONS.flowSetCellView,
};
@ -22,7 +22,7 @@ type IProps = ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps & {
const FlowLayoutUnconnected: FC<IProps> = ({
flow: { nodes, heroes, recent, updated },
user,
nodeLoadNode,
nodeGotoNode,
flowSetCellView,
}) => (
<FlowGrid
@ -30,7 +30,7 @@ const FlowLayoutUnconnected: FC<IProps> = ({
heroes={heroes}
recent={recent}
updated={updated}
onSelect={nodeLoadNode}
onSelect={nodeGotoNode}
user={user}
onChangeCellView={flowSetCellView}
/>