Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - add loading spinner on upload image #1622

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/components/Board/TileEditor/TileEditor.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import KeyboardArrowLeftIcon from '@material-ui/icons/KeyboardArrowLeft';
import Select from '@material-ui/core/Select';
import MenuItem from '@material-ui/core/MenuItem';
import InputLabel from '@material-ui/core/InputLabel';
import CircularProgress from '@material-ui/core/CircularProgress';

import messages from './TileEditor.messages';
import SymbolSearch from '../SymbolSearch';
Expand Down Expand Up @@ -107,7 +108,8 @@ export class TileEditor extends Component {
tile: this.defaultTile,
linkedBoard: '',
imageUploadedData: [],
isEditImageBtnActive: false
isEditImageBtnActive: false,
loading: false
RodriSanchez1 marked this conversation as resolved.
Show resolved Hide resolved
};

this.defaultimageUploadedData = {
Expand Down Expand Up @@ -289,6 +291,9 @@ export class TileEditor extends Component {
};

setimageUploadedData = (isUploaded, fileName, blobHQ = null, blob = null) => {
this.setState({
loading: true
});
const { activeStep } = this.state;
let imageUploadedData = this.state.imageUploadedData.map((item, indx) => {
if (indx === activeStep) {
Expand All @@ -304,6 +309,9 @@ export class TileEditor extends Component {
}
});
this.setState({ imageUploadedData: imageUploadedData });
this.setState({
loading: false
});
};

handleSymbolSearchChange = ({ image, labelKey, label, keyPath }) => {
Expand Down Expand Up @@ -523,11 +531,15 @@ export class TileEditor extends Component {
Boolean(tileInView.loadBoard) ? 'folder' : 'button'
}
>
<Symbol
{
this.state.loading
? <CircularProgress/>
: <Symbol
image={tileInView.image}
label={currentLabel}
keyPath={tileInView.keyPath}
/>
}
</Tile>
</div>
{this.state.isEditImageBtnActive && (
Expand Down