From 26fc451871ac048be8054b5d4f2939b6255bd64c Mon Sep 17 00:00:00 2001 From: frakarr Date: Sat, 6 Dec 2025 23:01:02 +0100 Subject: [PATCH] feat: Add email configuration and alert system Introduces SMTP configuration settings and alert definitions to enable automated email notifications. This includes new types for `SmtpConfig` and `AlertDefinition`, and integrates these into the settings page and mock database. Adds styling for select elements and scrollbar hiding in the main HTML. Updates mock database logic to potentially support local development without a backend. --- .dockerignore | 7 +- Dockerfile | 29 -- components/Layout.tsx | 12 +- docker-compose.yml | 19 +- index.html | 18 ++ nginx.conf | 23 +- pages/Settings.tsx | 611 +++++++++++++++++++++++++++++++++++++----- server/Dockerfile | 18 -- server/db.js | 141 ++++++++-- server/package.json | 3 + server/server.js | 233 +++++++++++++++- services/mockDb.ts | 254 ++++++++++++++++-- types.ts | 22 ++ 13 files changed, 1167 insertions(+), 223 deletions(-) diff --git a/.dockerignore b/.dockerignore index 603ee91..3a98b5a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1 @@ -node_modules -dist -.git -.env -mysql_data -.DS_Store +��^ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8cd331a..e69de29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +0,0 @@ -# Stage 1: Build -FROM node:20-alpine as build - -WORKDIR /app - -# Copia i file di dipendenze -COPY package*.json ./ - -# Installa le dipendenze -RUN npm install - -# Copia tutto il codice sorgente -COPY . . - -# Esegui la build di produzione (crea la cartella dist) -RUN npm run build - -# Stage 2: Serve con Nginx -FROM nginx:alpine - -# Copia i file compilati dalla build precedente alla cartella di Nginx -COPY --from=build /app/dist /usr/share/nginx/html - -# Copia la configurazione custom di Nginx -COPY nginx.conf /etc/nginx/conf.d/default.conf - -EXPOSE 80 - -CMD ["nginx", "-g", "daemon off;"] diff --git a/components/Layout.tsx b/components/Layout.tsx index 045ad98..b9c4235 100644 --- a/components/Layout.tsx +++ b/components/Layout.tsx @@ -12,7 +12,7 @@ export const Layout: React.FC = () => { `flex items-center gap-3 px-4 py-3 rounded-lg transition-all duration-200 ${ isActive ? 'bg-blue-600 text-white shadow-md' - : 'text-slate-600 hover:bg-slate-100' + : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }`; const closeMenu = () => setIsMobileMenuOpen(false); @@ -66,12 +66,10 @@ export const Layout: React.FC = () => { Famiglie - {isAdmin && ( - - - Impostazioni - - )} + + + Impostazioni +
diff --git a/docker-compose.yml b/docker-compose.yml index 2c8048e..f5093e9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,23 +14,10 @@ services: restart: always environment: - PORT=3001 - - DB_HOST=db - - DB_PORT=3306 + - DB_CLIENT=${DB_CLIENT:-mysql} # 'mysql' or 'postgres' + - DB_HOST=${DB_HOST} + - DB_PORT=${DB_PORT} - DB_USER=${DB_USER} - DB_PASS=${DB_PASS} - DB_NAME=${DB_NAME} - JWT_SECRET=${JWT_SECRET} - depends_on: - - db - - db: - image: mariadb:10.6 - restart: always - environment: - MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} - MYSQL_DATABASE: ${DB_NAME} - MYSQL_USER: ${DB_USER} - MYSQL_PASSWORD: ${DB_PASS} - volumes: - # Bind Mount: salva i dati nella cartella mysql_data del progetto - - ./mysql_data:/var/lib/mysql \ No newline at end of file diff --git a/index.html b/index.html index 263ad9f..291abdb 100644 --- a/index.html +++ b/index.html @@ -11,6 +11,24 @@ font-family: 'Inter', sans-serif; background-color: #f8fafc; } + /* Force Select Colors */ + select { + color: #1e293b !important; /* slate-800 */ + background-color: #ffffff !important; + } + select option { + color: #1e293b !important; + background-color: #ffffff !important; + } + /* Hide scrollbar for Chrome, Safari and Opera */ + .no-scrollbar::-webkit-scrollbar { + display: none; + } + /* Hide scrollbar for IE, Edge and Firefox */ + .no-scrollbar { + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ + }