diff --git a/install.sh b/install.sh index 25592ea..7bbb050 100755 --- a/install.sh +++ b/install.sh @@ -173,7 +173,13 @@ if ! grep -q "DATABASE_URL=" .env || [[ $(grep "DATABASE_URL=" .env | cut -d'=' update_env "LMS_DATABASE_URL" "postgresql://user:${DB_PASS}@localhost:5432/openccb_lms?sslmode=disable" update_env "JWT_SECRET" "supersecretsecret" update_env "NEXT_PUBLIC_CMS_API_URL" "http://localhost:3001" - update_env "NEXT_PUBLIC_LMS_API_URL" "http://localhost:3002" + update_env "NEXT_PUBLIC_LMS_API_URL" "http://localhost:3003" + update_env "DEFAULT_ORG_NAME" "OpenCCB" + update_env "DEFAULT_PLATFORM_NAME" "OpenCCB Learning" + update_env "DEFAULT_LOGO_URL" "" + update_env "DEFAULT_FAVICON_URL" "" + update_env "DEFAULT_PRIMARY_COLOR" "#3B82F6" + update_env "DEFAULT_SECONDARY_COLOR" "#8B5CF6" fi # 5. Configuración de Pila de IA (Omitido - usando remoto) diff --git a/services/cms-service/src/main.rs b/services/cms-service/src/main.rs index 9f0cd4a..8f96eb7 100644 --- a/services/cms-service/src/main.rs +++ b/services/cms-service/src/main.rs @@ -39,6 +39,9 @@ async fn main() { .await .expect("Failed to run migrations"); + // Sync default organization branding from environment + sync_default_organization(&pool).await; + // Start AI Background Worker let worker_pool = pool.clone(); tokio::spawn(async move { @@ -306,3 +309,41 @@ async fn main() { let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); axum::serve(listener, public_routes).await.unwrap(); } + +async fn sync_default_organization(pool: &sqlx::PgPool) { + let org_id = sqlx::types::Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap(); + + let name = env::var("DEFAULT_ORG_NAME").unwrap_or_else(|_| "OpenCCB".to_string()); + let platform_name = env::var("DEFAULT_PLATFORM_NAME").ok().filter(|s| !s.is_empty()); + let logo_url = env::var("DEFAULT_LOGO_URL").ok().filter(|s| !s.is_empty()); + let favicon_url = env::var("DEFAULT_FAVICON_URL").ok().filter(|s| !s.is_empty()); + let primary_color = env::var("DEFAULT_PRIMARY_COLOR").ok().filter(|s| !s.is_empty()); + let secondary_color = env::var("DEFAULT_SECONDARY_COLOR").ok().filter(|s| !s.is_empty()); + + let result = sqlx::query( + "UPDATE organizations + SET name = $1, + platform_name = COALESCE($2, platform_name), + logo_url = COALESCE($3, logo_url), + favicon_url = COALESCE($4, favicon_url), + primary_color = COALESCE($5, primary_color), + secondary_color = COALESCE($6, secondary_color), + updated_at = NOW() + WHERE id = $7" + ) + .bind(name) + .bind(platform_name) + .bind(logo_url) + .bind(favicon_url) + .bind(primary_color) + .bind(secondary_color) + .bind(org_id) + .execute(pool) + .await; + + match result { + Ok(_) => tracing::info!("Default organization branding synced from .env"), + Err(e) => tracing::error!("Failed to sync default organization branding: {}", e), + } +} + diff --git a/web/experience/src/app/auth/login/page.tsx b/web/experience/src/app/auth/login/page.tsx index 94dbe96..2c1ba87 100644 --- a/web/experience/src/app/auth/login/page.tsx +++ b/web/experience/src/app/auth/login/page.tsx @@ -4,11 +4,15 @@ import React, { useState } from "react"; import { useRouter } from "next/navigation"; import { lmsApi } from "@/lib/api"; import { useAuth } from "@/context/AuthContext"; +import { useBranding } from "@/context/BrandingContext"; import { GraduationCap, Lock, Mail, User, ChevronLeft } from "lucide-react"; export default function ExperienceLoginPage() { const router = useRouter(); const { login } = useAuth(); + const { branding } = useBranding(); + + const platformName = branding?.platform_name || branding?.name || 'Academia'; // State const [isLogin, setIsLogin] = useState(true); @@ -58,7 +62,7 @@ export default function ExperienceLoginPage() {
Portal de Aprendizaje para Estudiantes
diff --git a/web/experience/src/app/layout.tsx b/web/experience/src/app/layout.tsx index 961ae53..c7db085 100644 --- a/web/experience/src/app/layout.tsx +++ b/web/experience/src/app/layout.tsx @@ -11,8 +11,8 @@ import { ThemeProvider } from "@/context/ThemeContext"; const inter = Inter({ subsets: ["latin"] }); export const metadata: Metadata = { - title: "OpenCCB | Experiencia de Aprendizaje", - description: "Consume contenido educativo de alta fidelidad con OpenCCB", + title: "Experiencia de Aprendizaje", + description: "Consume contenido educativo de alta fidelidad.", }; import AppHeader from "@/components/AppHeader"; @@ -36,7 +36,7 @@ export default function RootLayout({ diff --git a/web/experience/src/components/AppHeader.tsx b/web/experience/src/components/AppHeader.tsx index 0bbf97c..7972049 100644 --- a/web/experience/src/components/AppHeader.tsx +++ b/web/experience/src/components/AppHeader.tsx @@ -20,7 +20,7 @@ export default function AppHeader() { const [isMenuOpen, setIsMenuOpen] = useState(false); // Use platform_name if available, otherwise name, otherwise default - const platformName = branding?.platform_name || branding?.name || 'OpenCCB'; + const platformName = branding?.platform_name || branding?.name || 'Academia'; return (Instructor & Administrator Portal
@@ -115,13 +119,12 @@ export default function StudioLoginPage() { Organization Name (Optional)- Please search and select your organization to continue. +
+ Continue to sign in via your enterprise Single Sign-On provider.
- OpenCCB Studio - Instructor & Administrator Portal + {platformName} Studio - Portal de Instructores y Administradores
diff --git a/web/studio/src/app/layout.tsx b/web/studio/src/app/layout.tsx index 59ddb44..1c9575e 100644 --- a/web/studio/src/app/layout.tsx +++ b/web/studio/src/app/layout.tsx @@ -12,12 +12,11 @@ import { ThemeProvider } from "@/context/ThemeContext"; const inter = Inter({ subsets: ["latin"] }); export const metadata: Metadata = { - title: "OpenCCB | Studio", - description: "Create and manage high-fidelity educational content.", + title: "Studio", + description: "Crea y gestiona contenido educativo de alta fidelidad.", }; import { Navbar } from "@/components/Navbar"; -import BrandingManager from "@/components/BrandingManager"; export default function RootLayout({ children, @@ -25,14 +24,13 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - +