Login sequence and inventory/protocol storage groundwork
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { protocolsApi } from "../lib/api";
|
||||
import { Card } from "./ui/card";
|
||||
import { Button } from "./ui/button";
|
||||
import { Textarea } from "./ui/textarea";
|
||||
@@ -18,13 +19,7 @@ import {
|
||||
import { Alert, AlertDescription } from "./ui/alert";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs";
|
||||
|
||||
interface SafetyIssue {
|
||||
type: "critical" | "warning" | "suggestion";
|
||||
category: string;
|
||||
message: string;
|
||||
source?: string;
|
||||
sourceUrl?: string;
|
||||
}
|
||||
import type { SafetyIssue } from "../shared/types";
|
||||
|
||||
interface ChatMessage {
|
||||
id: string;
|
||||
@@ -85,12 +80,21 @@ export function ProtocolChecker() {
|
||||
}
|
||||
];
|
||||
|
||||
const handleAnalyze = () => {
|
||||
const handleAnalyze = async () => {
|
||||
if (!protocol.trim()) return;
|
||||
setIsAnalyzing(true);
|
||||
setTimeout(() => {
|
||||
setIsAnalyzing(false);
|
||||
try {
|
||||
const saved = await protocolsApi.createFromText(
|
||||
`Protocol ${new Date().toLocaleDateString()}`,
|
||||
protocol
|
||||
);
|
||||
await protocolsApi.saveAnalysis(saved.id, mockIssues);
|
||||
setAnalyzed(true);
|
||||
}, 2000);
|
||||
} catch (err) {
|
||||
console.error("Failed to save protocol:", err);
|
||||
} finally {
|
||||
setIsAnalyzing(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSendMessage = () => {
|
||||
|
||||
Reference in New Issue
Block a user