All files ProgressManager.js

100% Statements 70/70
100% Branches 7/7
100% Functions 7/7
100% Lines 70/70

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 771x 1x 1x 1x 1x 9x 9x 9x 9x   1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x   1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x   1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x   1x 1x 1x 1x 1x 1x 1x 1x   1x
/**
 * ProgressManager - Manages progress display and feedback
 */
class ProgressManager {
  constructor(progressContainer, progressText, progressCount) {
    this.progressContainer = progressContainer;
    this.progressText = progressText;
    this.progressCount = progressCount;
  }
 
  /**
   * Show progress indicator
   * @param {string} message - Progress message
   */
  showProgress(message = 'Scanning directory...') {
    if (this.progressContainer) {
      this.progressContainer.style.display = 'block';
      this.progressText.textContent = message;
      this.progressCount.textContent = '';
    }
  }
 
  /**
   * Hide progress indicator
   */
  hideProgress() {
    if (this.progressContainer) {
      this.progressContainer.style.display = 'none';
    }
  }
 
  /**
   * Update progress with current/total counts
   * @param {number} current - Current count
   * @param {number} total - Total count
   * @param {string} fileName - Current file name
   */
  updateProgress(current, total, fileName) {
    if (this.progressContainer) {
      const displayCurrent = current + 1;
      this.progressText.textContent = `Processing: ${fileName}`;
      this.progressCount.textContent = `${displayCurrent} of ${total} files`;
    }
  }
 
  /**
   * Update progress with custom text
   * @param {string} text - Progress text
   */
  updateProgressText(text) {
    if (this.progressText) {
      this.progressText.textContent = text;
    }
  }
 
  /**
   * Update progress count display
   * @param {number} current - Current count
   * @param {number} total - Total count
   */
  updateProgressCount(current, total) {
    if (this.progressCount) {
      const displayCurrent = current + 1;
      this.progressCount.textContent = `${displayCurrent} of ${total} files`;
    }
  }
 
  /**
   * Show directory feedback
   * @param {string} folderName - Folder name
   */
  showDirectoryFeedback(folderName) {
    console.log(`Directory "${folderName}" created and file moved`);
  }
}
 
module.exports = ProgressManager;