MovieMapper/utils/renderer/ProgressManager.js
Jarian Cottingham be887c3855 Refactor renderer.js into modular class-based structure
- Split large renderer.js file into 8 separate class files:
  - AppState.js: Manages application state
  - FileListManager.js: Handles file list display and manipulation
  - TagManager.js: Manages file tagging functionality
  - EpisodeManager.js: Handles episode number editing and highlighting
  - SearchManager.js: Manages TVDB search and show selection
  - FileManager.js: Handles file operations
  - ModalManager.js: Manages video preview modal
  - ProgressManager.js: Manages progress display
  - UIManager.js: Main coordinator for UI functionality
- Follows SOLID principles and single responsibility
- Improves code maintainability and testability
- All syntax verified with node --check
2026-02-25 02:32:08 -06:00

77 lines
2.0 KiB
JavaScript

/**
* 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;