feat: implement theme customization and user preferences
- Added support for user-selected themes, allowing users to customize the appearance of the application. - Introduced a new `temaPreferido` field in the user schema to store the preferred theme. - Updated various components to apply the selected theme dynamically based on user preferences. - Enhanced the UI to include a theme selection interface, enabling users to preview and save their theme choices. - Implemented a polyfill for BlobBuilder to ensure compatibility across browsers, improving the functionality of the application.
This commit is contained in:
@@ -147,6 +147,9 @@
|
||||
if (result.error) {
|
||||
console.error('Sign out error:', result.error);
|
||||
}
|
||||
// Resetar tema para padrão ao fazer logout
|
||||
const { aplicarTemaPadrao } = await import('$lib/utils/temas');
|
||||
aplicarTemaPadrao();
|
||||
goto(resolve('/'));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -139,6 +139,60 @@
|
||||
console.error(message, details);
|
||||
}
|
||||
|
||||
// Garantir que BlobBuilder está disponível antes de importar lib-jitsi-meet
|
||||
function garantirBlobBuilderPolyfill(): void {
|
||||
if (!browser) return;
|
||||
|
||||
const windowWithBlobBuilder = window as WindowWithBlobBuilder;
|
||||
|
||||
// Verificar se já existe
|
||||
if (
|
||||
typeof windowWithBlobBuilder.BlobBuilder !== 'undefined' ||
|
||||
typeof windowWithBlobBuilder.webkitBlobBuilder !== 'undefined' ||
|
||||
typeof windowWithBlobBuilder.MozBlobBuilder !== 'undefined'
|
||||
) {
|
||||
return; // Já está disponível
|
||||
}
|
||||
|
||||
// Criar polyfill inline se não estiver disponível
|
||||
console.log('🔧 Criando polyfill BlobBuilder inline...');
|
||||
|
||||
function BlobBuilderPolyfill() {
|
||||
if (!(this instanceof BlobBuilderPolyfill)) {
|
||||
return new BlobBuilderPolyfill();
|
||||
}
|
||||
this.parts = [];
|
||||
}
|
||||
|
||||
BlobBuilderPolyfill.prototype.append = function(data: Blob | string) {
|
||||
if (data instanceof Blob) {
|
||||
this.parts.push(data);
|
||||
} else if (typeof data === 'string') {
|
||||
this.parts.push(data);
|
||||
} else {
|
||||
this.parts.push(new Blob([data]));
|
||||
}
|
||||
};
|
||||
|
||||
BlobBuilderPolyfill.prototype.getBlob = function(contentType?: string) {
|
||||
return new Blob(this.parts, contentType ? { type: contentType } : undefined);
|
||||
};
|
||||
|
||||
// Aplicar em todos os locais possíveis
|
||||
(window as unknown as Record<string, unknown>).BlobBuilder = BlobBuilderPolyfill;
|
||||
(window as unknown as Record<string, unknown>).WebKitBlobBuilder = BlobBuilderPolyfill;
|
||||
(window as unknown as Record<string, unknown>).MozBlobBuilder = BlobBuilderPolyfill;
|
||||
(window as unknown as Record<string, unknown>).MSBlobBuilder = BlobBuilderPolyfill;
|
||||
|
||||
if (typeof globalThis !== 'undefined') {
|
||||
(globalThis as unknown as Record<string, unknown>).BlobBuilder = BlobBuilderPolyfill;
|
||||
(globalThis as unknown as Record<string, unknown>).WebKitBlobBuilder = BlobBuilderPolyfill;
|
||||
(globalThis as unknown as Record<string, unknown>).MozBlobBuilder = BlobBuilderPolyfill;
|
||||
}
|
||||
|
||||
console.log('✅ Polyfill BlobBuilder aplicado inline');
|
||||
}
|
||||
|
||||
// Carregar Jitsi dinamicamente
|
||||
async function carregarJitsi(): Promise<void> {
|
||||
if (!browser || JitsiMeetJS) return;
|
||||
@@ -146,16 +200,8 @@
|
||||
try {
|
||||
console.log('🔄 Tentando carregar lib-jitsi-meet...');
|
||||
|
||||
// Polyfill BlobBuilder já deve estar disponível via app.html
|
||||
// Verificar se está disponível antes de carregar a biblioteca
|
||||
const windowWithBlobBuilder = window as WindowWithBlobBuilder;
|
||||
if (
|
||||
typeof windowWithBlobBuilder.BlobBuilder === 'undefined' &&
|
||||
typeof windowWithBlobBuilder.webkitBlobBuilder === 'undefined' &&
|
||||
typeof windowWithBlobBuilder.MozBlobBuilder === 'undefined'
|
||||
) {
|
||||
console.warn('⚠️ Polyfill BlobBuilder não encontrado, pode causar erros');
|
||||
}
|
||||
// Garantir que BlobBuilder está disponível ANTES de importar
|
||||
garantirBlobBuilderPolyfill();
|
||||
|
||||
// Tentar carregar o módulo lib-jitsi-meet dinamicamente
|
||||
// Usar import dinâmico para evitar problemas de SSR e permitir carregamento apenas no browser
|
||||
@@ -1165,16 +1211,8 @@
|
||||
onMount(async () => {
|
||||
if (!browser) return;
|
||||
|
||||
// Polyfill BlobBuilder já deve estar disponível via app.html
|
||||
// Verificar se está disponível
|
||||
const windowWithBlobBuilder = window as WindowWithBlobBuilder;
|
||||
if (
|
||||
typeof windowWithBlobBuilder.BlobBuilder === 'undefined' &&
|
||||
typeof windowWithBlobBuilder.webkitBlobBuilder === 'undefined' &&
|
||||
typeof windowWithBlobBuilder.MozBlobBuilder === 'undefined'
|
||||
) {
|
||||
console.warn('⚠️ Polyfill BlobBuilder não encontrado no onMount');
|
||||
}
|
||||
// Garantir que BlobBuilder está disponível antes de qualquer coisa
|
||||
garantirBlobBuilderPolyfill();
|
||||
|
||||
// Inicializar store primeiro
|
||||
inicializarStore();
|
||||
|
||||
Reference in New Issue
Block a user