- 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.
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import React from "react";
|
|
import {LucideIcon} from "lucide-react";
|
|
import InputField from "@/components/form/InputField";
|
|
import ToggleWithConfirmation from "@/components/form/ToggleWithConfirmation";
|
|
import {AlertType} from "@/components/ui/AlertBox";
|
|
|
|
interface ToggleFieldProps {
|
|
icon: LucideIcon;
|
|
label: string;
|
|
checked: boolean;
|
|
onChange: (value: boolean) => void;
|
|
alertTitle: string;
|
|
alertMessage: string;
|
|
alertType: AlertType;
|
|
confirmText?: string;
|
|
cancelText?: string;
|
|
}
|
|
|
|
export default function ToggleField(
|
|
{
|
|
icon,
|
|
label,
|
|
checked,
|
|
onChange,
|
|
alertTitle,
|
|
alertMessage,
|
|
alertType,
|
|
confirmText,
|
|
cancelText,
|
|
}: ToggleFieldProps) {
|
|
return (
|
|
<InputField
|
|
icon={icon}
|
|
fieldName={label}
|
|
centered
|
|
input={
|
|
<ToggleWithConfirmation
|
|
checked={checked}
|
|
onChange={onChange}
|
|
alertTitle={alertTitle}
|
|
alertMessage={alertMessage}
|
|
alertType={alertType}
|
|
confirmText={confirmText}
|
|
cancelText={cancelText}
|
|
/>
|
|
}
|
|
/>
|
|
);
|
|
}
|