diff --git a/App.tsx b/App.tsx
index 1cad9c3..5e5ce9e 100644
--- a/App.tsx
+++ b/App.tsx
@@ -3,13 +3,14 @@ import { Dashboard } from './components/Dashboard';
import { Inventory } from './components/Inventory';
import { ProtocolChecker } from './components/ProtocolChecker';
import { Onboarding } from './components/Onboarding';
+import { ProfileSettings } from './components/ProfileSettings';
import { LoginForm } from './components/auth/LoginForm';
import { SignUpForm } from './components/auth/SignUpForm';
import { EmailVerification } from './components/auth/EmailVerification';
import { ForgotPassword } from './components/auth/ForgotPassword';
import { ResetPassword } from './components/auth/ResetPassword';
import { useSession, signOut } from './lib/auth-client';
-import { LayoutDashboard, Package, FileCheck, LogOut } from 'lucide-react';
+import { LayoutDashboard, Package, FileCheck, LogOut, UserCircle } from 'lucide-react';
const logo = '/logo.png';
@@ -23,7 +24,7 @@ type AppView =
| 'onboarding'
| 'app';
-type Tab = 'dashboard' | 'inventory' | 'protocol';
+type Tab = 'dashboard' | 'inventory' | 'protocol' | 'profile';
function isResetPasswordRoute() {
return (
@@ -135,10 +136,20 @@ export default function App() {
);
})}
-
-
- {session.user.email}
-
+
+
);
diff --git a/components/Inventory.tsx b/components/Inventory.tsx
index 85fe4d5..9d76fe8 100644
--- a/components/Inventory.tsx
+++ b/components/Inventory.tsx
@@ -1,6 +1,7 @@
import { useState, useRef, useEffect } from "react";
import ExcelJS from "exceljs";
import { chemicalsApi } from "../lib/api";
+import { validateCAS, validateNumber, validatePhoneOrEmail } from "../lib/validators";
import type { ChemicalInventory } from "../shared/types";
import { Card } from "./ui/card";
import { Button } from "./ui/button";
@@ -199,6 +200,30 @@ export function Inventory() {
setFormError("Please fill in all required fields.");
return;
}
+ if (!validateCAS(String(form.casNumber || ""))) {
+ setFormError("CAS # must be in the format ##-##-# (e.g. 67-56-1).");
+ return;
+ }
+ if (!validateNumber(form.numberOfContainers, { min: 1, integer: true })) {
+ setFormError("# of containers must be a whole number of 1 or more.");
+ return;
+ }
+ if (!validateNumber(form.amountPerContainer, { min: 0 })) {
+ setFormError("Amount per container must be a number.");
+ return;
+ }
+ if (form.molecularWeight && !validateNumber(form.molecularWeight, { min: 0 })) {
+ setFormError("Molecular weight must be a number.");
+ return;
+ }
+ if (form.percentageFull != null && !validateNumber(form.percentageFull, { min: 0, max: 100 })) {
+ setFormError("% full must be between 0 and 100.");
+ return;
+ }
+ if (form.contact && !validatePhoneOrEmail(String(form.contact))) {
+ setFormError("Contact must be a valid phone number or email address.");
+ return;
+ }
setFormError("");
setIsSaving(true);
try {
@@ -963,7 +988,14 @@ export function Inventory() {