feat: multi-provider AI support with auto-detection
- Added support for Google Gemini, OpenAI, Anthropic, and Azure OpenAI - Implemented API key validation with auto model detection - Added Error Boundary for better error handling - Migrated PDF generation to native jsPDF (better quality) - Added PWA support with offline capabilities - Implemented tests with Vitest - Fixed language consistency (PT-BR) - Improved accessibility (ARIA)
This commit is contained in:
@@ -1,33 +1,55 @@
|
||||
import React from 'react';
|
||||
import { LogoBase64, SunIcon, MoonIcon, RefreshIcon, SignOutIcon } from './Icons';
|
||||
import { useTheme } from '../context/ThemeContext';
|
||||
import type { AIProvider } from '../types/providers';
|
||||
|
||||
interface HeaderProps {
|
||||
onReset: () => void;
|
||||
onClearKey: () => void;
|
||||
hasKey: boolean;
|
||||
provider?: AIProvider;
|
||||
}
|
||||
|
||||
export const Header: React.FC<HeaderProps> = ({ onReset, onClearKey, hasKey }) => {
|
||||
export const Header: React.FC<HeaderProps> = ({ onReset, onClearKey, hasKey, provider }) => {
|
||||
const { theme, toggleTheme } = useTheme();
|
||||
|
||||
const providerColors: Record<AIProvider, string> = {
|
||||
gemini: 'from-blue-500 to-indigo-600',
|
||||
openai: 'from-green-500 to-emerald-600',
|
||||
anthropic: 'from-orange-500 to-amber-600',
|
||||
azure: 'from-blue-600 to-cyan-600'
|
||||
};
|
||||
|
||||
const providerNames: Record<AIProvider, string> = {
|
||||
gemini: 'Gemini',
|
||||
openai: 'OpenAI',
|
||||
anthropic: 'Claude',
|
||||
azure: 'Azure'
|
||||
};
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-30 transition-all duration-300 backdrop-blur-md bg-white/70 dark:bg-slate-900/70 border-b border-white/20 dark:border-slate-800 shadow-sm">
|
||||
<div className="container mx-auto px-4 py-3 flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="relative group cursor-pointer">
|
||||
<div className="absolute -inset-1 bg-gradient-to-r from-blue-600 to-indigo-600 rounded-full blur opacity-25 group-hover:opacity-50 transition duration-1000 group-hover:duration-200"></div>
|
||||
<img src={LogoBase64} alt="SteelBase Logo" className="relative w-10 h-10 object-contain" />
|
||||
<img src={LogoBase64} alt="SteelCheck Logo" className="relative w-10 h-10 object-contain" />
|
||||
</div>
|
||||
|
||||
<div className="hidden sm:block">
|
||||
<h1 className="text-2xl font-display font-bold bg-clip-text text-transparent bg-gradient-to-r from-slate-900 to-slate-700 dark:from-white dark:to-slate-300">
|
||||
SteelBase
|
||||
SteelCheck
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 sm:gap-4">
|
||||
{hasKey && provider && (
|
||||
<div className={`hidden sm:flex items-center gap-2 px-3 py-1.5 rounded-full bg-gradient-to-r ${providerColors[provider]} text-white text-xs font-medium`}>
|
||||
{providerNames[provider]}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{hasKey && (
|
||||
<button
|
||||
onClick={onClearKey}
|
||||
|
||||
Reference in New Issue
Block a user