/** * Shared footer component for consistent footers across pages */ export interface SharedFooterConfig { containerId?: string; showSafetyNotice?: boolean; showDisclaimer?: boolean; } export class SharedFooter { private config: Required; constructor(config: SharedFooterConfig = {}) { this.config = { containerId: config.containerId || 'footer-container', showSafetyNotice: config.showSafetyNotice !== false, showDisclaimer: config.showDisclaimer !== false }; } public render(): void { const container = document.getElementById(this.config.containerId); if (!container) { console.error(`Container with id "${this.config.containerId}" not found`); return; } const footer = document.createElement('footer'); footer.innerHTML = ` ${this.config.showSafetyNotice ? `

Safety Notice: This is a community tool for awareness. Stay safe and know your rights.

` : ''} ${this.config.showDisclaimer ? `
This website is for informational purposes only. Verify information independently. Reports are automatically deleted after 48 hours. • Privacy Policy
` : ''} `; container.appendChild(footer); // Update translations if i18n is available if ((window as Window & typeof globalThis & { i18n?: { updatePageTranslations: () => void } }).i18n?.updatePageTranslations) { (window as Window & typeof globalThis & { i18n?: { updatePageTranslations: () => void } }).i18n.updatePageTranslations(); } } // Factory method for standard footer public static createStandardFooter(): SharedFooter { return new SharedFooter({ showSafetyNotice: true, showDisclaimer: true }); } // Factory method for minimal footer (e.g., admin pages) public static createMinimalFooter(): SharedFooter { return new SharedFooter({ showSafetyNotice: false, showDisclaimer: true }); } }