How to use the kitsu/utils/prettyBytes.prettyBytes function in kitsu

To help you get started, we’ve selected a few kitsu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hummingbird-me / kitsu-mobile / src / screens / Feed / components / PostCreator / component.js View on Github external
renderUploadProgress() {
    const { uploading, progress } = this.state;

    if (!uploading) return null;

    const { loaded, total } = progress;

    // Convert values to human readable values
    const prettyLoaded = prettyBytes(loaded);
    const prettyTotal = prettyBytes(total);

    // Text stuff
    const progressText = `(${prettyLoaded}/${prettyTotal})`;
    const percentage = total > 0 ? Math.round((loaded / total) * 100) : null;

    // Show progress display as: 10% (10kB/100kB)
    const percentageText = isNil(percentage) ? '' : `- ${percentage}% ${progressText}`;

    return (
      
    );
  }
github hummingbird-me / kitsu-mobile / src / screens / Feed / components / PostCreator / component.js View on Github external
renderUploadProgress() {
    const { uploading, progress } = this.state;

    if (!uploading) return null;

    const { loaded, total } = progress;

    // Convert values to human readable values
    const prettyLoaded = prettyBytes(loaded);
    const prettyTotal = prettyBytes(total);

    // Text stuff
    const progressText = `(${prettyLoaded}/${prettyTotal})`;
    const percentage = total > 0 ? Math.round((loaded / total) * 100) : null;

    // Show progress display as: 10% (10kB/100kB)
    const percentageText = isNil(percentage) ? '' : `- ${percentage}% ${progressText}`;

    return (
      
    );
github hummingbird-me / kitsu-mobile / src / screens / Feed / components / PostCreator / component.js View on Github external
if (isEmpty(uploads)) return null;

    const size = this.getUploadsSize();

    return (
      
    );
  }
github hummingbird-me / kitsu-mobile / src / screens / Feed / components / ImageSortModal / component.js View on Github external
animationType="slide"
        visible={visible}
        transparent={false}
        onRequestClose={this.handleCancelPress}
      >
        
        {!isNil(maxUploadSize) && currentImagesSize > 0 &&
          
        }
        
           
      
    );
  }
}
github hummingbird-me / kitsu-mobile / src / screens / Feed / components / ImageSortModal / component.js View on Github external
renderItem = ({ item, index }) => {
    const { disableRemoveButton } = this.props;
    const ratio = (item.height || 1) / (item.width || 2);
    const width = Dimensions.get('window').width;
    const height = Math.min(500, width * ratio);

    const uri = item.uri || (item.content && item.content.original);
    const buttonWidth = disableRemoveButton ? '50%' : '32%';

    return (
github hummingbird-me / kitsu-mobile / src / screens / Feed / components / PostCreator / component.js View on Github external
renderActionBarModal() {
    const { busy } = this.state;
    if (busy) return null;

    const actions = this.canSetActions();
    const data = [
      {
        image: photo,
        color: colors.red,
        title: `Attach Photos (Max ${prettyBytes(MAX_UPLOAD_SIZE_LIMIT)} or ${MAX_UPLOAD_COUNT} Images)`,
        onPress: () => this.handlePressUpload(),
        visible: actions.canSetUploads,
      },
      {
        image: giphy,
        color: '#8ABE53',
        title: 'Search & Share GIF',
        onPress: () => this.handleGiphyPickerModal(true),
        visible: true,
      },
      {
        image: tag,
        color: colors.blue,
        title: 'Tag Anime or Manga',
        onPress: () => this.handleMediaPickerModal(true),
        visible: actions.canSetMedia,