optimize code
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-26 14:15:26 +08:00
parent e8bc064ad5
commit 99c58217c9
3 changed files with 3 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
import Button from "@/components/Button"; import Button from "@/components/Button";
import { useRef, useState } from "react"; import { useRef } from "react";
export default function UploadArea( export default function UploadArea(
{ {
@@ -12,9 +12,6 @@ export default function UploadArea(
) { ) {
const inputRef = useRef<HTMLInputElement>(null); const inputRef = useRef<HTMLInputElement>(null);
const [videoFile, setVideoFile] = useState<File | null>(null);
const [SrtFile, setSrtFile] = useState<File | null>(null);
const uploadVideo = () => { const uploadVideo = () => {
const input = inputRef.current; const input = inputRef.current;
if (input) { if (input) {
@@ -23,7 +20,6 @@ export default function UploadArea(
input.onchange = () => { input.onchange = () => {
const file = input.files?.[0]; const file = input.files?.[0];
if (file) { if (file) {
setVideoFile(file);
setVideoUrl(URL.createObjectURL(file)); setVideoUrl(URL.createObjectURL(file));
} }
}; };
@@ -37,7 +33,6 @@ export default function UploadArea(
input.onchange = () => { input.onchange = () => {
const file = input.files?.[0]; const file = input.files?.[0];
if (file) { if (file) {
setSrtFile(file);
setSrtUrl(URL.createObjectURL(file)); setSrtUrl(URL.createObjectURL(file));
} }
}; };

View File

@@ -1,4 +1,4 @@
import { useState, useRef, forwardRef, useEffect, KeyboardEvent, useCallback } from "react"; import { useState, useRef, forwardRef, useEffect, useCallback } from "react";
import SubtitleDisplay from "./SubtitleDisplay"; import SubtitleDisplay from "./SubtitleDisplay";
import Button from "@/components/Button"; import Button from "@/components/Button";
import { getIndex, parseSrt, getNearistIndex } from "../subtitle"; import { getIndex, parseSrt, getNearistIndex } from "../subtitle";

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { ChangeEvent, useEffect, useState } from "react"; import { ChangeEvent, useState } from "react";
import Button from "@/components/Button"; import Button from "@/components/Button";
import IconClick from "@/components/IconClick"; import IconClick from "@/components/IconClick";
import { useAudioPlayer } from "@/hooks/useAudioPlayer"; import { useAudioPlayer } from "@/hooks/useAudioPlayer";