This commit is contained in:
an-lee
2024-01-10 19:53:51 +08:00
parent c9a9b2a3a9
commit 153d8af133
3 changed files with 11 additions and 11 deletions

View File

@@ -5,7 +5,7 @@ import { AppSettingsProviderContext } from "@renderer/context";
import { CheckCircle2Icon, XCircleIcon, LoaderIcon } from "lucide-react";
export const FfmpegCheck = () => {
const { ffmpegConfg, setFfmegConfig, EnjoyApp } = useContext(
const { ffmpegConfig, setFfmegConfig, EnjoyApp } = useContext(
AppSettingsProviderContext
);
const [downloading, setDownloading] = useState(false);
@@ -41,7 +41,7 @@ export const FfmpegCheck = () => {
useEffect(() => {
return EnjoyApp.download.removeAllListeners();
}, [ffmpegConfg?.ready]);
}, [ffmpegConfig?.ready]);
useEffect(() => {
refreshFfmpegConfig();
@@ -49,7 +49,7 @@ export const FfmpegCheck = () => {
return (
<div className="w-full max-w-sm px-6">
{ffmpegConfg?.ready ? (
{ffmpegConfig?.ready ? (
<>
<div className="flex justify-center items-center mb-8">
<img src="./assets/ffmpeg-logo.svg" className="" />

View File

@@ -11,7 +11,7 @@ type AppSettingsProviderState = {
logout?: () => void;
setLibraryPath?: (path: string) => Promise<void>;
setWhisperModel?: (name: string) => void;
ffmpegConfg?: FfmpegConfigType;
ffmpegConfig?: FfmpegConfigType;
setFfmegConfig?: (config: FfmpegConfigType) => void;
EnjoyApp?: EnjoyAppType;
};
@@ -35,7 +35,7 @@ export const AppSettingsProvider = ({
const [libraryPath, setLibraryPath] = useState("");
const [whisperModelsPath, setWhisperModelsPath] = useState<string>("");
const [whisperModel, setWhisperModel] = useState<string>(null);
const [ffmpegConfg, setFfmegConfig] = useState<FfmpegConfigType>(null);
const [ffmpegConfig, setFfmegConfig] = useState<FfmpegConfigType>(null);
const EnjoyApp = window.__ENJOY_APP__;
useEffect(() => {
@@ -52,7 +52,7 @@ export const AppSettingsProvider = ({
useEffect(() => {
validate();
}, [user, libraryPath, whisperModel, ffmpegConfg]);
}, [user, libraryPath, whisperModel, ffmpegConfig]);
const fetchFfmpegConfig = async () => {
const config = await EnjoyApp.settings.getFfmpegConfig();
@@ -114,7 +114,7 @@ export const AppSettingsProvider = ({
const validate = async () => {
setInitialized(
!!(user && libraryPath && whisperModel && ffmpegConfg?.ready)
!!(user && libraryPath && whisperModel && ffmpegConfig?.ready)
);
};
@@ -131,7 +131,7 @@ export const AppSettingsProvider = ({
whisperModelsPath,
whisperModel,
setWhisperModel: setModelHandler,
ffmpegConfg,
ffmpegConfig,
setFfmegConfig,
initialized,
}}

View File

@@ -16,13 +16,13 @@ export default () => {
const [currentStep, setCurrentStep] = useState<number>(1);
const [currentStepValid, setCurrentStepValid] = useState<boolean>(false);
const { user, libraryPath, whisperModel, ffmpegConfg, initialized } =
const { user, libraryPath, whisperModel, ffmpegConfig, initialized } =
useContext(AppSettingsProviderContext);
const totalSteps = 5;
useEffect(() => {
validateCurrentStep();
}, [currentStep, user, whisperModel, ffmpegConfg]);
}, [currentStep, user, whisperModel, ffmpegConfig]);
const validateCurrentStep = async () => {
switch (currentStep) {
@@ -36,7 +36,7 @@ export default () => {
setCurrentStepValid(!!whisperModel);
break;
case 4:
setCurrentStepValid(ffmpegConfg?.ready);
setCurrentStepValid(ffmpegConfig?.ready);
break;
case 5:
setCurrentStepValid(initialized);