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'
This commit is contained in:
parent
6c91d4cd42
commit
95250185d0
4 changed files with 119 additions and 8 deletions
111
backend/prisma/map-pulse.ts
Normal file
111
backend/prisma/map-pulse.ts
Normal file
|
|
@ -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();
|
||||
});
|
||||
|
|
@ -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 */}
|
||||
<CommandPalette />
|
||||
<SessionTimeoutWarning />
|
||||
<DevTools />
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import { Link } from "react-router-dom";
|
|||
export default function HomePage() {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center min-h-screen bg-primary">
|
||||
<h1 className="text-3xl font-semibold text-primary mb-3">CA Grow Ops Manager</h1>
|
||||
<p className="text-secondary mb-8">Secure management for distributed operations.</p>
|
||||
<h1 className="text-3xl font-semibold text-primary mb-3">Veridian</h1>
|
||||
<p className="text-secondary mb-8">Cultivation Management Platform</p>
|
||||
<div className="flex gap-3">
|
||||
<Link to="/login" className="btn btn-primary">
|
||||
Login
|
||||
|
|
|
|||
|
|
@ -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() {
|
|||
</motion.div>
|
||||
</div>
|
||||
|
||||
<DevTools />
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue