mirror of
https://github.com/p-stream/p-stream.git
synced 2026-05-12 23:51:11 +00:00
Update SkipSegmentsView.tsx
This commit is contained in:
parent
12f97e7501
commit
9cc7f272e7
1 changed files with 14 additions and 8 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import { Button } from "@/components/buttons/Button";
|
import { Button } from "@/components/buttons/Button";
|
||||||
|
|
@ -20,6 +20,18 @@ export function SkipSegmentsView({ id }: { id: string }) {
|
||||||
const { setCurrentOverlay } = useOverlayStack();
|
const { setCurrentOverlay } = useOverlayStack();
|
||||||
const [showSubmissionForm, setShowSubmissionForm] = useState(false);
|
const [showSubmissionForm, setShowSubmissionForm] = useState(false);
|
||||||
|
|
||||||
|
// Memoize the segment object to prevent re-renders from clearing form inputs
|
||||||
|
const segmentData = useMemo(
|
||||||
|
() => ({
|
||||||
|
type: "intro" as const,
|
||||||
|
start_ms: null,
|
||||||
|
end_ms: null,
|
||||||
|
confidence: null,
|
||||||
|
submission_count: 0,
|
||||||
|
}),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
const handleSeek = (seconds: number) => {
|
const handleSeek = (seconds: number) => {
|
||||||
display?.setTime(seconds);
|
display?.setTime(seconds);
|
||||||
};
|
};
|
||||||
|
|
@ -108,13 +120,7 @@ export function SkipSegmentsView({ id }: { id: string }) {
|
||||||
|
|
||||||
{showSubmissionForm && tidbKey && (
|
{showSubmissionForm && tidbKey && (
|
||||||
<TIDBSubmissionForm
|
<TIDBSubmissionForm
|
||||||
segment={{
|
segment={segmentData}
|
||||||
type: "intro",
|
|
||||||
start_ms: null,
|
|
||||||
end_ms: null,
|
|
||||||
confidence: null,
|
|
||||||
submission_count: 0,
|
|
||||||
}}
|
|
||||||
onSuccess={() => {
|
onSuccess={() => {
|
||||||
setShowSubmissionForm(false);
|
setShowSubmissionForm(false);
|
||||||
setCurrentOverlay("tidb-submission-success");
|
setCurrentOverlay("tidb-submission-success");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue