iter 2
This commit is contained in:
@@ -80,11 +80,16 @@
|
||||
}
|
||||
|
||||
.segment {
|
||||
border: 1px solid variables.$border-default;
|
||||
border: 1px solid variables.$border-subtle;
|
||||
border-radius: variables.$radius-md;
|
||||
padding: 10px 12px;
|
||||
padding: 12px 16px;
|
||||
background: variables.$bg-surface;
|
||||
transition: border-color 0.3s, box-shadow 0.3s;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: variables.$border-default;
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
&.highlight {
|
||||
border-color: variables.$color-primary;
|
||||
@@ -94,51 +99,72 @@
|
||||
|
||||
.segmentTimes {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 10px;
|
||||
margin-bottom: 8px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.timesGroup {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.actionsGroup {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.timeLabel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.timeLabelText {
|
||||
font-size: 11px;
|
||||
color: variables.$text-tertiary;
|
||||
font-weight: 500;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.timeInput {
|
||||
width: 100px;
|
||||
width: 84px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid variables.$border-default;
|
||||
border: 1px solid transparent;
|
||||
border-radius: variables.$radius-sm;
|
||||
font-size: 13px;
|
||||
font-size: 12px;
|
||||
font-family: monospace;
|
||||
color: variables.$text-primary;
|
||||
background: variables.$bg-default;
|
||||
color: variables.$text-secondary;
|
||||
background: variables.$bg-hover;
|
||||
transition: all 0.2s ease;
|
||||
text-align: center;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
background: variables.$bg-surface;
|
||||
border-color: variables.$color-primary;
|
||||
color: variables.$text-primary;
|
||||
box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.splitButton {
|
||||
.splitButton, .removeButton {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: auto;
|
||||
padding: 4px;
|
||||
padding: 6px;
|
||||
border: none;
|
||||
background: none;
|
||||
background: transparent;
|
||||
color: variables.$text-tertiary;
|
||||
cursor: pointer;
|
||||
border-radius: variables.$radius-sm;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.splitButton {
|
||||
&:hover:not(:disabled) {
|
||||
color: variables.$color-primary;
|
||||
background: variables.$bg-hover;
|
||||
@@ -151,37 +177,34 @@
|
||||
}
|
||||
|
||||
.removeButton {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 4px;
|
||||
border: none;
|
||||
background: none;
|
||||
color: variables.$text-tertiary;
|
||||
cursor: pointer;
|
||||
border-radius: variables.$radius-sm;
|
||||
|
||||
&:hover {
|
||||
color: variables.$color-danger;
|
||||
background: variables.$bg-hover;
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.textArea {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
border: 1px solid variables.$border-default;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: variables.$radius-sm;
|
||||
font-size: 13px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
color: variables.$text-primary;
|
||||
background: variables.$bg-default;
|
||||
background: variables.$bg-hover;
|
||||
resize: vertical;
|
||||
font-family: inherit;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: variables.$bg-hover;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
background: variables.$bg-surface;
|
||||
border-color: variables.$color-primary;
|
||||
box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ import type { ITranscriptionEditorProps } from "./TranscriptionEditor.d"
|
||||
import type { JSX } from "react"
|
||||
|
||||
import { useQueryClient } from "@tanstack/react-query"
|
||||
import cs from "classnames"
|
||||
import { LoaderCircle, Plus, Save, Scissors, Trash2 } from "lucide-react"
|
||||
import { LoaderCircle, Plus, Scissors, Trash2 } from "lucide-react"
|
||||
import { FunctionComponent, useCallback, useEffect, useRef, useState } from "react"
|
||||
|
||||
import api from "@shared/api"
|
||||
@@ -146,6 +145,15 @@ export const TranscriptionEditor: FunctionComponent<
|
||||
}
|
||||
}, [transcription, segments, artifactId, queryClient])
|
||||
|
||||
// Auto-save when dirty (debounced)
|
||||
useEffect(() => {
|
||||
if (!dirty) return
|
||||
const timer = setTimeout(() => {
|
||||
handleSave()
|
||||
}, 1500)
|
||||
return () => clearTimeout(timer)
|
||||
}, [dirty, handleSave])
|
||||
|
||||
/* Loading */
|
||||
if (isLoading) {
|
||||
return (
|
||||
@@ -171,18 +179,6 @@ export const TranscriptionEditor: FunctionComponent<
|
||||
{/* Header */}
|
||||
<div className={styles.header}>
|
||||
<h3 className={styles.title}>Редактор транскрипции</h3>
|
||||
<button
|
||||
className={cs(styles.saveButton, { [styles.disabled]: !dirty })}
|
||||
onClick={handleSave}
|
||||
disabled={!dirty || saving}
|
||||
>
|
||||
{saving ? (
|
||||
<LoaderCircle size={16} className={styles.spinner} />
|
||||
) : (
|
||||
<Save size={16} />
|
||||
)}
|
||||
<span>Сохранить</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Segments list */}
|
||||
@@ -190,49 +186,53 @@ export const TranscriptionEditor: FunctionComponent<
|
||||
{segments.map((seg, idx) => (
|
||||
<div key={idx} className={styles.segment} data-segment-index={idx}>
|
||||
<div className={styles.segmentTimes}>
|
||||
<label className={styles.timeLabel}>
|
||||
<span className={styles.timeLabelText}>Начало</span>
|
||||
<input
|
||||
className={styles.timeInput}
|
||||
type="text"
|
||||
value={seg.startTime}
|
||||
onChange={(e) =>
|
||||
updateSegment(idx, "startTime", e.target.value)
|
||||
<div className={styles.timesGroup}>
|
||||
<label className={styles.timeLabel}>
|
||||
<span className={styles.timeLabelText}>Начало</span>
|
||||
<input
|
||||
className={styles.timeInput}
|
||||
type="text"
|
||||
value={seg.startTime}
|
||||
onChange={(e) =>
|
||||
updateSegment(idx, "startTime", e.target.value)
|
||||
}
|
||||
placeholder="00:00.000"
|
||||
/>
|
||||
</label>
|
||||
<label className={styles.timeLabel}>
|
||||
<span className={styles.timeLabelText}>Конец</span>
|
||||
<input
|
||||
className={styles.timeInput}
|
||||
type="text"
|
||||
value={seg.endTime}
|
||||
onChange={(e) =>
|
||||
updateSegment(idx, "endTime", e.target.value)
|
||||
}
|
||||
placeholder="00:00.000"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div className={styles.actionsGroup}>
|
||||
<button
|
||||
className={styles.splitButton}
|
||||
onClick={() => setSplittingIdx(idx)}
|
||||
title={
|
||||
!seg.words || seg.words.length < 2
|
||||
? "Нет данных о словах для разделения"
|
||||
: "Разделить сегмент"
|
||||
}
|
||||
placeholder="00:00.000"
|
||||
/>
|
||||
</label>
|
||||
<label className={styles.timeLabel}>
|
||||
<span className={styles.timeLabelText}>Конец</span>
|
||||
<input
|
||||
className={styles.timeInput}
|
||||
type="text"
|
||||
value={seg.endTime}
|
||||
onChange={(e) =>
|
||||
updateSegment(idx, "endTime", e.target.value)
|
||||
}
|
||||
placeholder="00:00.000"
|
||||
/>
|
||||
</label>
|
||||
<button
|
||||
className={styles.splitButton}
|
||||
onClick={() => setSplittingIdx(idx)}
|
||||
title={
|
||||
!seg.words || seg.words.length < 2
|
||||
? "Нет данных о словах для разделения"
|
||||
: "Разделить сегмент"
|
||||
}
|
||||
disabled={!seg.words || seg.words.length < 2}
|
||||
>
|
||||
<Scissors size={14} />
|
||||
</button>
|
||||
<button
|
||||
className={styles.removeButton}
|
||||
onClick={() => removeSegment(idx)}
|
||||
title="Удалить сегмент"
|
||||
>
|
||||
<Trash2 size={14} />
|
||||
</button>
|
||||
disabled={!seg.words || seg.words.length < 2}
|
||||
>
|
||||
<Scissors size={14} />
|
||||
</button>
|
||||
<button
|
||||
className={styles.removeButton}
|
||||
onClick={() => removeSegment(idx)}
|
||||
title="Удалить сегмент"
|
||||
>
|
||||
<Trash2 size={14} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{splittingIdx === idx ? (
|
||||
<SegmentSplitter
|
||||
|
||||
Reference in New Issue
Block a user