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:
parent
cf16cbf0f9
commit
d06593b4cb
3 changed files with 32 additions and 7 deletions
|
@ -7,6 +7,7 @@ import { UPLOAD_TYPES } from '~/redux/uploads/constants';
|
||||||
import { NODE_SETTINGS } from '~/redux/node/constants';
|
import { NODE_SETTINGS } from '~/redux/node/constants';
|
||||||
import { getURL } from '~/utils/dom';
|
import { getURL } from '~/utils/dom';
|
||||||
import { PRESETS } from '~/constants/urls';
|
import { PRESETS } from '~/constants/urls';
|
||||||
|
import { LoaderCircle } from '~/components/input/LoaderCircle';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
is_loading: boolean;
|
is_loading: boolean;
|
||||||
|
@ -174,6 +175,16 @@ const NodeImageSlideBlock: FC<IProps> = ({ node, is_loading, updateLayout }) =>
|
||||||
[wrap]
|
[wrap]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (is_loading) {
|
||||||
|
return (
|
||||||
|
<div className={styles.placeholder}>
|
||||||
|
<div>
|
||||||
|
<LoaderCircle size={96} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(styles.wrap, { is_loading })} ref={wrap}>
|
<div className={classNames(styles.wrap, { is_loading })} ref={wrap}>
|
||||||
<ImageSwitcher
|
<ImageSwitcher
|
||||||
|
@ -195,8 +206,6 @@ const NodeImageSlideBlock: FC<IProps> = ({ node, is_loading, updateLayout }) =>
|
||||||
onTouchStart={startDragging}
|
onTouchStart={startDragging}
|
||||||
ref={slide}
|
ref={slide}
|
||||||
>
|
>
|
||||||
{(is_loading || !loaded[0] || !images.length) && <div className={styles.placeholder} />}
|
|
||||||
|
|
||||||
{images.map((file, index) => (
|
{images.map((file, index) => (
|
||||||
<div
|
<div
|
||||||
className={classNames(styles.image_wrap, {
|
className={classNames(styles.image_wrap, {
|
||||||
|
|
|
@ -44,6 +44,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.placeholder {
|
.placeholder {
|
||||||
background: red;
|
padding-bottom: 66%;
|
||||||
height: 320px;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ const mapStateToProps = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
nodeLoadNode: NODE_ACTIONS.nodeLoadNode,
|
nodeGotoNode: NODE_ACTIONS.nodeGotoNode,
|
||||||
flowSetCellView: FLOW_ACTIONS.flowSetCellView,
|
flowSetCellView: FLOW_ACTIONS.flowSetCellView,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ type IProps = ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps & {
|
||||||
const FlowLayoutUnconnected: FC<IProps> = ({
|
const FlowLayoutUnconnected: FC<IProps> = ({
|
||||||
flow: { nodes, heroes, recent, updated },
|
flow: { nodes, heroes, recent, updated },
|
||||||
user,
|
user,
|
||||||
nodeLoadNode,
|
nodeGotoNode,
|
||||||
flowSetCellView,
|
flowSetCellView,
|
||||||
}) => (
|
}) => (
|
||||||
<FlowGrid
|
<FlowGrid
|
||||||
|
@ -30,7 +30,7 @@ const FlowLayoutUnconnected: FC<IProps> = ({
|
||||||
heroes={heroes}
|
heroes={heroes}
|
||||||
recent={recent}
|
recent={recent}
|
||||||
updated={updated}
|
updated={updated}
|
||||||
onSelect={nodeLoadNode}
|
onSelect={nodeGotoNode}
|
||||||
user={user}
|
user={user}
|
||||||
onChangeCellView={flowSetCellView}
|
onChangeCellView={flowSetCellView}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue