1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

added imagecaching

This commit is contained in:
Fedor Katurov 2019-11-07 12:20:17 +07:00
parent 88f50e3348
commit 1320f0851f
16 changed files with 43 additions and 35 deletions

View file

@ -9,6 +9,7 @@ import * as UPLOAD_ACTIONS from '~/redux/uploads/actions';
import { selectUploads } from '~/redux/uploads/selectors';
import { getURL } from '~/utils/dom';
import { Icon } from '~/components/input/Icon';
import { PRESETS } from '~/constants/urls';
const mapStateToProps = state => {
const { statuses, files } = selectUploads(state);
@ -78,7 +79,7 @@ const EditorUploadCoverButtonUnconnected: FC<IProps> = ({
setData({ ...data, cover: null });
}, [setData, data]);
const background = data.cover ? getURL(data.cover) : null;
const background = data.cover ? getURL(data.cover, PRESETS['300']) : null;
const status = cover_temp && path([cover_temp], statuses);
const preview = status && path(['preview'], status);

View file

@ -6,6 +6,7 @@ import { SortableImageGridItem } from '~/components/editors/SortableImageGridIte
import { IFile } from '~/redux/types';
import { IUploadStatus } from '~/redux/uploads/reducer';
import { getURL } from '~/utils/dom';
import { PRESETS } from '~/constants/urls';
const SortableImageGrid = SortableContainer(
({
@ -27,7 +28,7 @@ const SortableImageGrid = SortableContainer(
.filter(file => file && file.id)
.map((file, index) => (
<SortableImageGridItem key={file.id} index={index} collection={0}>
<ImageUpload id={file.id} thumb={getURL(file)} onDrop={onDrop} />
<ImageUpload id={file.id} thumb={getURL(file, PRESETS.cover)} onDrop={onDrop} />
</SortableImageGridItem>
))}