import React, { useState, useEffect } from "react"; import { useNavigate } from "react-router-dom"; import { Terminal, Monitor, Network, Container, Database, Server, HardDrive, BarChart3, Phone, Lock, PhoneCall, Code, Workflow, CircuitBoard, ServerCog, Users, } from "lucide-react"; import { Card, CardContent, Button, Input, Label, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, } from "@/components/ui"; import { DOMAINS } from "@/lib/domainPrompts"; import { createIssueCmd } from "@/lib/tauriCommands"; import { useSessionStore } from "@/stores/sessionStore"; const iconMap: Record = { Terminal, Monitor, Network, Container, Database, Server, HardDrive, BarChart3, Phone, Lock, PhoneCall, Code, Workflow, CircuitBoard, ServerCog, Users, }; export default function NewIssue() { const navigate = useNavigate(); const startSession = useSessionStore((s) => s.startSession); const [selectedDomain, setSelectedDomain] = useState(null); const [title, setTitle] = useState(""); const [severity, setSeverity] = useState("P3"); const [isSubmitting, setIsSubmitting] = useState(false); const [error, setError] = useState(null); const [showDisclaimer, setShowDisclaimer] = useState(false); useEffect(() => { const hasAcceptedDisclaimer = localStorage.getItem("tftsr-ai-disclaimer-accepted"); if (!hasAcceptedDisclaimer) { setShowDisclaimer(true); } }, []); const handleAcceptDisclaimer = () => { localStorage.setItem("tftsr-ai-disclaimer-accepted", "true"); setShowDisclaimer(false); }; const handleStartTriage = async () => { const hasAcceptedDisclaimer = localStorage.getItem("tftsr-ai-disclaimer-accepted"); if (!hasAcceptedDisclaimer) { setShowDisclaimer(true); return; } if (!selectedDomain || !title.trim()) return; setIsSubmitting(true); setError(null); try { const issue = await createIssueCmd({ title: title.trim(), domain: selectedDomain, severity }); startSession(issue); navigate(`/issue/${issue.id}/triage`); } catch (err) { setError(String(err)); setIsSubmitting(false); } }; return ( <> {/* AI Disclaimer Modal */} {showDisclaimer && (

AI-Assisted Triage Disclaimer

⚠️ IMPORTANT: Read Carefully Before Proceeding

This application uses artificial intelligence (AI) to assist with IT issue triage, root cause analysis, and troubleshooting recommendations. While AI can be a powerful tool, you must understand its limitations and your responsibilities.

AI Can Make Mistakes:

  • AI models may provide incorrect, incomplete, or outdated information
  • AI can hallucinate — generating plausible-sounding but entirely false information
  • Recommendations may not apply to your specific environment or configuration
  • Commands suggested by AI may have unintended consequences including data loss, system downtime, or security vulnerabilities

You Are Fully Responsible:

  • You are solely responsible for any commands you execute, changes you make, or actions you take based on AI recommendations
  • Always verify AI suggestions against official documentation, best practices, and your organization's policies
  • Test in non-production environments before applying changes to production systems
  • Understand commands before executing them — never blindly run suggested commands
  • Have backups and rollback plans in place before making system changes

Best Practices:

  • Treat AI recommendations as a starting point for investigation, not definitive answers
  • Consult with senior engineers or subject matter experts when dealing with critical systems
  • Review all AI-generated content for accuracy and relevance to your specific situation
  • Maintain proper change control and approval processes
  • Document your actions and decision-making process

By clicking "I Understand and Accept," you acknowledge that you have read and understood this disclaimer, and you accept full responsibility for any actions taken based on information provided by this AI-assisted system. Use at your own risk.

)}

New Issue

Select a domain, describe the issue, and begin triage.

{/* Domain selection grid */}
{DOMAINS.map((domain) => { const Icon = iconMap[domain.icon] ?? Terminal; const isSelected = selectedDomain === domain.id; return ( setSelectedDomain(domain.id)} >

{domain.label}

{domain.description}

); })}
{/* Title */}
setTitle(e.target.value)} placeholder="Brief description of the issue..." />
{/* Severity */}
{/* Error */} {error && (
{error}
)} {/* Submit */}
); }