qyle's picture
Deploy from GitLab 6cc916d7
de3f199
Raw
History Blame Contribute Delete
2.02 kB
// app.js - Main application initialization
import { ChatComponent } from './components/chat-component.js';
import { FileUploadComponent } from './components/file-upload-component.js';
import { SettingsComponent } from './components/settings-component.js';
import { LanguageComponent } from './components/language-component.js';
import { ConsentComponent } from './components/consent-component.js';
import { ProfileComponent } from './components/profile-component.js';
import { CommentComponent } from './components/comment-component.js';
import { FeedbackComponent } from './components/feedback-component.js';
import { TranslationService } from './services/translation-service.js';
import { CarbonTracker } from './components/carbon-tracker-component.js';
import { ToolbarComponent } from './components/toolbar-component.js';
import { StateManager } from './services/state-manager.js';
// Initialize the application when DOM is ready
document.addEventListener('DOMContentLoaded', () => {
// In dev mode, skip the welcome modal and seed dummy profile data
if (document.getElementById('welcomePopup').style.display === 'none') {
StateManager.setConsent(true);
StateManager.updateProfile({
ageGroup: '25-34',
gender: 'M',
roles: ['researcher'],
participantId: 'dev-user'
});
}
// Initialize all components
ChatComponent.init();
FileUploadComponent.init();
SettingsComponent.init();
LanguageComponent.init();
ConsentComponent.init();
ProfileComponent.init();
CommentComponent.init();
FeedbackComponent.init();
CarbonTracker.init();
ToolbarComponent.init();
// Make FeedbackComponent globally accessible for chat component
window.FeedbackComponent = FeedbackComponent;
// Apply initial translations
TranslationService.applyTranslation();
// Open the details element by default on desktop only
if (window.innerWidth >= 460) {
const details = document.querySelector('details');
if (details) details.setAttribute('open', '');
}
});