Add advanced generation options with Explicit and Smart modes
- Implemented `AdvancedGenerationOptions` component for toggling Explicit and Smart modes with confirmation dialogs. - Integrated generation options into `GhostWriter`, `DraftCompanion`, and `ShortStoryGenerator`. - Introduced `ToggleWithConfirmation` component for user interaction with alerts. - Updated `InputField` to support centered alignment for better layout flexibility. - Localized Explicit and Smart mode strings in English and French. - Enhanced content preview logic to filter placeholder text before display. - Added `autoUpdater` initialization checks and refactored updater setup for improved reliability.
This commit is contained in:
61
components/form/AdvancedGenerationOptions.tsx
Normal file
61
components/form/AdvancedGenerationOptions.tsx
Normal file
@@ -0,0 +1,61 @@
|
||||
'use client'
|
||||
import React from "react";
|
||||
import {faBrain, faTriangleExclamation} from "@fortawesome/free-solid-svg-icons";
|
||||
import InputField from "@/components/form/InputField";
|
||||
import ToggleWithConfirmation from "@/components/form/ToggleWithConfirmation";
|
||||
import {useTranslations} from "next-intl";
|
||||
|
||||
interface AdvancedGenerationOptionsProps {
|
||||
useExplicit: boolean;
|
||||
setUseExplicit: (value: boolean) => void;
|
||||
useSmart: boolean;
|
||||
setUseSmart: (value: boolean) => void;
|
||||
}
|
||||
|
||||
export default function AdvancedGenerationOptions({
|
||||
useExplicit,
|
||||
setUseExplicit,
|
||||
useSmart,
|
||||
setUseSmart
|
||||
}: AdvancedGenerationOptionsProps) {
|
||||
const t = useTranslations();
|
||||
|
||||
return (
|
||||
<div className="bg-secondary/20 rounded-xl p-5 shadow-inner border border-secondary/30">
|
||||
<div className="flex justify-evenly items-center">
|
||||
<InputField
|
||||
icon={faTriangleExclamation}
|
||||
fieldName={t("generationOptions.explicit.label")}
|
||||
centered
|
||||
input={
|
||||
<ToggleWithConfirmation
|
||||
checked={useExplicit}
|
||||
onChange={setUseExplicit}
|
||||
alertTitle={t("generationOptions.explicit.alertTitle")}
|
||||
alertMessage={t("generationOptions.explicit.alertMessage")}
|
||||
alertType="alert"
|
||||
confirmText={t("generationOptions.activate")}
|
||||
cancelText={t("generationOptions.cancel")}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<InputField
|
||||
icon={faBrain}
|
||||
fieldName={t("generationOptions.smart.label")}
|
||||
centered
|
||||
input={
|
||||
<ToggleWithConfirmation
|
||||
checked={useSmart}
|
||||
onChange={setUseSmart}
|
||||
alertTitle={t("generationOptions.smart.alertTitle")}
|
||||
alertMessage={t("generationOptions.smart.alertMessage")}
|
||||
alertType="informatif"
|
||||
confirmText={t("generationOptions.activate")}
|
||||
cancelText={t("generationOptions.cancel")}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user