feat: UI legend
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"playback/internal/srt"
|
||||
"playback/internal/ui"
|
||||
"playback/internal/ui/header"
|
||||
"playback/internal/ui/legend"
|
||||
"playback/internal/ui/transcript"
|
||||
"playback/internal/ui/waveform"
|
||||
)
|
||||
@@ -33,6 +34,7 @@ type Model struct {
|
||||
|
||||
// UI Components
|
||||
header header.Model
|
||||
legend legend.Model
|
||||
waveform waveform.Model
|
||||
transcript transcript.Model
|
||||
|
||||
@@ -56,6 +58,7 @@ func New(audioPath, transcriptPath string) Model {
|
||||
audioPath: audioPath,
|
||||
transcriptPath: transcriptPath,
|
||||
header: header.New(),
|
||||
legend: legend.New(),
|
||||
waveform: waveform.New(),
|
||||
transcript: transcript.New(),
|
||||
}
|
||||
@@ -231,13 +234,17 @@ func (m *Model) updateLayout() {
|
||||
// Waveform: 5 lines
|
||||
waveformHeight := 5
|
||||
|
||||
// Legend: 1 line
|
||||
legendHeight := 1
|
||||
|
||||
// Status bar: 1 line
|
||||
statusHeight := 1
|
||||
|
||||
// Transcript: remaining space
|
||||
transcriptHeight := m.height - headerHeight - waveformHeight - statusHeight - 2
|
||||
transcriptHeight := m.height - headerHeight - waveformHeight - legendHeight - statusHeight - 2
|
||||
|
||||
m.header.SetWidth(m.width)
|
||||
m.legend.SetWidth(m.width)
|
||||
m.waveform.SetSize(m.width, waveformHeight)
|
||||
m.transcript.SetSize(m.width, transcriptHeight)
|
||||
}
|
||||
@@ -287,6 +294,9 @@ func (m Model) View() string {
|
||||
// Transcript
|
||||
transcriptView := m.transcript.View()
|
||||
|
||||
// Legend
|
||||
legendView := m.legend.View()
|
||||
|
||||
// Status bar
|
||||
statusView := m.renderStatus()
|
||||
|
||||
@@ -296,6 +306,7 @@ func (m Model) View() string {
|
||||
"",
|
||||
waveformView,
|
||||
transcriptView,
|
||||
legendView,
|
||||
statusView,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user