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:
@@ -494,7 +494,8 @@ export const atualizarPerfil = mutation({
|
||||
)
|
||||
),
|
||||
notificacoesAtivadas: v.optional(v.boolean()),
|
||||
somNotificacao: v.optional(v.boolean())
|
||||
somNotificacao: v.optional(v.boolean()),
|
||||
temaPreferido: v.optional(v.string())
|
||||
},
|
||||
returns: v.null(),
|
||||
handler: async (ctx, args) => {
|
||||
@@ -522,6 +523,7 @@ export const atualizarPerfil = mutation({
|
||||
if (args.notificacoesAtivadas !== undefined)
|
||||
updates.notificacoesAtivadas = args.notificacoesAtivadas;
|
||||
if (args.somNotificacao !== undefined) updates.somNotificacao = args.somNotificacao;
|
||||
if (args.temaPreferido !== undefined) updates.temaPreferido = args.temaPreferido;
|
||||
|
||||
await ctx.db.patch(usuarioAtual._id, updates);
|
||||
|
||||
@@ -529,6 +531,29 @@ export const atualizarPerfil = mutation({
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Atualizar tema preferido do usuário
|
||||
*/
|
||||
export const atualizarTema = mutation({
|
||||
args: {
|
||||
temaPreferido: v.string()
|
||||
},
|
||||
returns: v.object({ sucesso: v.boolean() }),
|
||||
handler: async (ctx, args) => {
|
||||
const usuarioAtual = await getCurrentUserFunction(ctx);
|
||||
if (!usuarioAtual) {
|
||||
throw new Error('Usuário não encontrado');
|
||||
}
|
||||
|
||||
await ctx.db.patch(usuarioAtual._id, {
|
||||
temaPreferido: args.temaPreferido,
|
||||
atualizadoEm: Date.now()
|
||||
});
|
||||
|
||||
return { sucesso: true };
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Obter perfil do usuário atual
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user