- Introduced foundational UI components (`Badge`, `LockCard`, `SectionHeader`, `AvatarIcon`, etc.) for flexible layouts and consistent design. - Added migration support with the `MigrationModal` component and backend integration for exporting/importing data between Electron and Tauri. - Extended form components with `TextAreaInput`, `OrderInput`, `ToggleField`, and `ToolbarSelect` for improved input handling. - Updated `ScribeShell` with migration popup logic to prompt users for data migration. - Integrated `AlertStack` for better alert handling and notification management. - Enhanced Rust/Tauri services with migration command implementations. - Added translations and styles for new components.
29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import React, {useContext} from "react";
|
|
import {Coins, DollarSign} from "lucide-react";
|
|
import {AIUsageContext, AIUsageContextProps} from "@/context/AIUsageContext";
|
|
|
|
export default function CreditCounter({isCredit}: { isCredit: boolean }) {
|
|
const {totalCredits, totalPrice}: AIUsageContextProps = useContext<AIUsageContextProps>(AIUsageContext)
|
|
|
|
if (isCredit) {
|
|
return (
|
|
<div
|
|
className="flex items-center space-x-2 bg-darkest-background rounded-lg px-3 py-1.5 border border-secondary">
|
|
<Coins className="w-4 h-4 text-warning" strokeWidth={1.75}/>
|
|
<span className="text-sm text-text-primary font-medium">
|
|
{Math.round(totalCredits)} crédits
|
|
</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div
|
|
className="flex items-center space-x-2 bg-darkest-background rounded-lg px-3 py-1.5 border border-secondary">
|
|
<DollarSign className="w-4 h-4 text-primary" strokeWidth={1.75}/>
|
|
<span className="text-sm text-text-primary font-medium">
|
|
{totalPrice ? totalPrice.toFixed(2) : '0.00'}
|
|
</span>
|
|
</div>
|
|
);
|
|
} |