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

fixed uploads

This commit is contained in:
muerwre 2019-08-21 18:50:13 +07:00
parent cad4e683bc
commit 32b9a0dbbb
9 changed files with 52 additions and 37 deletions

View file

@ -6,6 +6,7 @@ import * as styles from './styles.scss';
import { ImageUpload } from '~/components/upload/ImageUpload';
import { IFile } from '~/redux/types';
import { IUploadStatus } from '~/redux/uploads/reducer';
import { getURL } from '~/utils/dom';
interface IProps {
items: IFile[];
@ -30,9 +31,10 @@ const SortableList = SortableContainer(
<div className={styles.grid}>
{items.map((file, index) => (
<SortableItem key={file.id} index={index} collection={0}>
<ImageUpload id={file.id} thumb={file.url} />
<ImageUpload id={file.id} thumb={getURL(file.url)} />
</SortableItem>
))}
{locked.map((item, index) => (
<SortableItem key={item.temp_id} index={index} collection={1} disabled>
<ImageUpload thumb={item.preview} progress={item.progress} is_uploading />

View file

@ -1,7 +1,8 @@
import React, { FC } from 'react';
import * as styles from './styles.scss';
import range from 'ramda/es/range';
import classNames = require("classnames");
import * as styles from './styles.scss';
import classNames = require('classnames');
interface IProps {
total: number;
@ -11,11 +12,9 @@ interface IProps {
const ImageSwitcher: FC<IProps> = ({ total, current }) => (
<div className={styles.wrap}>
<div className={styles.switcher}>
{
range(0, total).map((item) => (
<div className={classNames({ is_active: item === current })} />
))
}
{range(0, total).map(item => (
<div className={classNames({ is_active: item === current })} key={item} />
))}
</div>
</div>
);

View file

@ -16,12 +16,7 @@ const ImageUpload: FC<IProps> = ({
}) => (
<div className={styles.wrap}>
<div className={classNames(styles.thumb_wrap, { is_uploading })}>
{thumb && (
<div
className={styles.thumb}
style={{ backgroundImage: `url("${process.env.API_HOST}${thumb}")` }}
/>
)}
{thumb && <div className={styles.thumb} style={{ backgroundImage: `url("${thumb}")` }} />}
{is_uploading && (
<div className={styles.progress}>
<ArcProgress size={72} progress={progress} />