From 95250185d0cdf68b9d145a8a2f8652988435d1ff Mon Sep 17 00:00:00 2001 From: fullsizemalt <106900403+fullsizemalt@users.noreply.github.com> Date: Sun, 11 Jan 2026 23:02:20 -0800 Subject: [PATCH] fix: Critical UI polish - login redirect, remove DevTools, update branding - Fix login redirect from /dashboard to / (correct index route) - Remove DevTools component from Layout.tsx and LoginPage.tsx - Update HomePage branding from 'CA Grow Ops Manager' to 'Veridian' --- backend/prisma/map-pulse.ts | 111 +++++++++++++++++++++++++++++ frontend/src/components/Layout.tsx | 4 +- frontend/src/pages/HomePage.tsx | 4 +- frontend/src/pages/LoginPage.tsx | 8 +-- 4 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 backend/prisma/map-pulse.ts diff --git a/backend/prisma/map-pulse.ts b/backend/prisma/map-pulse.ts new file mode 100644 index 0000000..9962831 --- /dev/null +++ b/backend/prisma/map-pulse.ts @@ -0,0 +1,111 @@ + +import { PrismaClient, SensorType } from '@prisma/client'; + +const prisma = new PrismaClient(); + +async function main() { + console.log('Mapping Pulse sensor to Demo Room...'); + + // 1. Ensure Floor Exists + let floor = await prisma.facilityFloor.findFirst(); + + if (!floor) { + console.log('No floors found, creating default structure...'); + let property = await prisma.facilityProperty.findFirst(); + if (!property) { + property = await prisma.facilityProperty.create({ + data: { name: 'Demo Facility' } + }); + } + + let building = await prisma.facilityBuilding.findFirst(); + if (!building) { + building = await prisma.facilityBuilding.create({ + data: { + propertyId: property.id, + name: 'Main Building', + code: 'MB', + type: 'CULTIVATION' + } + }); + } + + floor = await prisma.facilityFloor.create({ + data: { + buildingId: building.id, + name: 'Ground Floor', + number: 1, + width: 100, + height: 100 + } + }); + } + + // 2. Ensure Demo Room Exists + let room = await prisma.facilityRoom.findFirst({ + where: { name: 'Demo Room' } + }); + + if (!room) { + console.log('Creating Demo Room...'); + const defaultType = 'FLOWER'; // Assuming enum 'FLOWER' is valid for RoomType + // Note: RoomType is an enum in schema, need to match it. + // enum RoomType { VEG, FLOWER, DRY, CURE, MOTHER, CLONE, OTHER } + + room = await prisma.facilityRoom.create({ + data: { + floorId: floor.id, + name: 'Demo Room', + code: 'DEMO', + type: 'FLOWER', + posX: 0, + posY: 0, + width: 20, + height: 20 + } + }); + } + console.log(`Using Room: ${room.name} (${room.id})`); + + // 3. Upsert Pulse Sensor + const sensorId = 'pulse-11666'; + + const existing = await prisma.sensor.findUnique({ + where: { id: sensorId } + }); + + if (existing) { + console.log('Sensor already exists, updating connection...'); + await prisma.sensor.update({ + where: { id: sensorId }, + data: { + roomId: room.id, + isActive: true, + type: 'VPD' + } + }); + } else { + console.log('Creating new Pulse sensor...'); + await prisma.sensor.create({ + data: { + id: sensorId, + name: 'Veridian Demo Pulse', + type: 'VPD', + deviceId: '11666', + roomId: room.id, + isActive: true + } + }); + } + + console.log('✅ Pulse Sensor 11666 mapped to Demo Room'); +} + +main() + .catch((e) => { + console.error(e); + process.exit(1); + }) + .finally(async () => { + await prisma.$disconnect(); + }); diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx index 2ecc256..5371b9a 100644 --- a/frontend/src/components/Layout.tsx +++ b/frontend/src/components/Layout.tsx @@ -9,7 +9,7 @@ import { CommandPalette } from './ui/CommandPalette'; import { SessionTimeoutWarning } from './ui/SessionTimeoutWarning'; import { PageTitleUpdater } from '../hooks/usePageTitle'; import AnnouncementBanner from './AnnouncementBanner'; -import { DevTools } from './dev/DevTools'; + import { Breadcrumbs } from './ui/Breadcrumbs'; import { pageVariants } from '../lib/animations'; import { Search, Bell, Settings, Filter, ChevronDown } from 'lucide-react'; @@ -141,7 +141,7 @@ export default function Layout() { {/* System Utilities */} - + ); } diff --git a/frontend/src/pages/HomePage.tsx b/frontend/src/pages/HomePage.tsx index b496718..491003c 100644 --- a/frontend/src/pages/HomePage.tsx +++ b/frontend/src/pages/HomePage.tsx @@ -3,8 +3,8 @@ import { Link } from "react-router-dom"; export default function HomePage() { return (
-

CA Grow Ops Manager

-

Secure management for distributed operations.

+

Veridian

+

Cultivation Management Platform

Login diff --git a/frontend/src/pages/LoginPage.tsx b/frontend/src/pages/LoginPage.tsx index 8af7bd3..387a778 100644 --- a/frontend/src/pages/LoginPage.tsx +++ b/frontend/src/pages/LoginPage.tsx @@ -4,7 +4,7 @@ import { motion, AnimatePresence } from 'framer-motion'; import { Shield, ArrowRight, Loader2, Key, ChevronRight, Lock } from 'lucide-react'; import api from '../lib/api'; import { useAuth } from '../context/AuthContext'; -import { DevTools } from '../components/dev/DevTools'; + import { pageVariants, itemVariants } from '../lib/animations'; export default function LoginPage() { @@ -27,7 +27,7 @@ export default function LoginPage() { try { const { data } = await api.post('/auth/login', { email, password }); login(data.accessToken, data.refreshToken, data.user); - navigate('/dashboard'); + navigate('/'); } catch (err: any) { setError(err.response?.data?.message || 'Authentication failed. Please check your credentials.'); } finally { @@ -130,7 +130,7 @@ export default function LoginPage() { const data = response.data; login(data.accessToken, data.refreshToken, data.user); - navigate('/dashboard'); + navigate('/'); } catch (err: any) { console.error('Auto-login error:', err); setError(`Login failed: ${err.message}`); @@ -242,7 +242,7 @@ export default function LoginPage() {
- +
); }