From ef55d9bb24430610b60c1b77821307cd72c08c55 Mon Sep 17 00:00:00 2001 From: zwlucas Date: Sat, 25 Jul 2026 18:23:29 -0300 Subject: feat: upload of the project Signed-off-by: zwlucas --- web/src/pages/SettingsPage.tsx | 63 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 web/src/pages/SettingsPage.tsx (limited to 'web/src/pages/SettingsPage.tsx') diff --git a/web/src/pages/SettingsPage.tsx b/web/src/pages/SettingsPage.tsx new file mode 100644 index 0000000..2e56213 --- /dev/null +++ b/web/src/pages/SettingsPage.tsx @@ -0,0 +1,63 @@ +import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; +import { api } from '@/lib/api'; +import { useToast } from '@/context/ToastContext'; +import styles from './SettingsPage.module.css'; + +export default function SettingsPage() { + const queryClient = useQueryClient(); + const { addToast } = useToast(); + + const { data: settings, isLoading } = useQuery({ + queryKey: ['settings'], + queryFn: () => api.settings.get(), + }); + + const mutation = useMutation({ + mutationFn: (newVal: boolean) => api.settings.update({ allowRequesterChat: newVal }), + onSuccess: () => { + void queryClient.invalidateQueries({ queryKey: ['settings'] }); + addToast('Configuração atualizada com sucesso', 'success'); + }, + onError: (err: any) => { + addToast(`Erro ao atualizar: ${err.message}`, 'error'); + } + }); + + if (isLoading) { + return ( +
+
Carregando configurações... +
+ ); + } + + return ( +
+
+

Configurações do Sistema

+

Gerencie as preferências globais da plataforma de chamados.

+
+ +
+
+
+

Chat de Solicitantes

+

+ Se ativado, usuários padrão (requesters) poderão enviar e receber mensagens dentro dos chamados. Se desativado, apenas agentes e administradores poderão interagir no chat. +

+
+ + +
+
+
+ ); +} -- cgit v1.2.3