File size: 1,666 Bytes
6fff7cf
 
 
 
 
 
 
 
 
 
 
e82f783
 
6fff7cf
 
 
 
 
 
 
 
 
 
 
 
e82f783
 
6fff7cf
 
 
 
 
 
 
 
 
 
 
 
4edc3e5
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
// 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';

// Initialize the application when DOM is ready
document.addEventListener('DOMContentLoaded', () => {
  // 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', '');
  }
});