forge
Explore
Log in

Don't you dare go Hollow

🎨 redesign(app): subtitles live in the Text tab, not a stray dock section

Browse files at this commit

7089dc7a8f5b864dca1601e66b900d0f81a37f4aAhmet Kaan GümüşParent: a2d7557
Moves the subtitle palette out of its unconditional spot under the
source list and into the library's Text tab, styled like the other
media rows (round dot, same ink/type scale, same hover fill and
selection ring) instead of its own visual dialect. Text.holds() now
answers the same extension-only question Media/Audio's own arms do
instead of a hardcoded false, and the empty state is one word.
crates/app/src/importing.rsmodified+11 -5
@@ -24,14 +24,20 @@ impl LibraryTab {
24 }24 }
25 }25 }
26 26
27- /// Whether a source belongs on this tab. Subtitles are not sources at all27+ /// Whether a source belongs on this tab. Text mirrors Media/Audio's own
28- /// -- they are the [`Player::subtitle_section`] under the list -- so the28+ /// rule -- an extension-only kind check, [`is_subtitle`] -- rather than
29- /// Text tab holds no rows of its own and says so.29+ /// the `false` it used to hardcode: a standalone `.srt`/`.vtt`/`.ass` is
30+ /// a Text source in the same sense an `.mp3` is an Audio one. A track
31+ /// *inside* a container (a Matroska's embedded track) never reaches this
32+ /// check at all -- the Text tab's rows are built from
33+ /// [`crate::subs::subtitle_rows`] grouped by source, not filtered off
34+ /// [`crate::library_meta::library_rows`] the way Media/Audio's are -- so
35+ /// this only ever gates a standalone subtitle file.
30 pub(crate) fn holds(self, path: &Path) -> bool {36 pub(crate) fn holds(self, path: &Path) -> bool {
31 match self {37 match self {
32 LibraryTab::Media => !engine::is_audio(path),38 LibraryTab::Media => !engine::is_audio(path),
33 LibraryTab::Audio => engine::is_audio(path),39 LibraryTab::Audio => engine::is_audio(path),
34- LibraryTab::Text => false,40+ LibraryTab::Text => is_subtitle(path),
35 }41 }
36 }42 }
37 43
@@ -40,7 +46,7 @@ impl LibraryTab {
40 match self {46 match self {
41 LibraryTab::Media => "No video",47 LibraryTab::Media => "No video",
42 LibraryTab::Audio => "No sound",48 LibraryTab::Audio => "No sound",
43- LibraryTab::Text => "No subtitles",49+ LibraryTab::Text => "empty",
44 }50 }
45 }51 }
46 }52 }
crates/app/src/tests/layout.rsmodified+8 -7
@@ -1249,18 +1249,19 @@ fn the_text_tab_carries_the_add_subtitles_door() {
1249 );1249 );
1250 // ...and the empty tab stays a noun, not a sentence pointing at the1250 // ...and the empty tab stays a noun, not a sentence pointing at the
1251 // button (DESIGN §8, 2026-08-27: no instructional copy).1251 // button (DESIGN §8, 2026-08-27: no instructional copy).
1252- assert_eq!(crate::LibraryTab::Text.empty(), "No subtitles");1252+ assert_eq!(crate::LibraryTab::Text.empty(), "empty");
1253 }1253 }
1254 1254
1255-/// The Darkroom keeps imported subtitle tracks in the Sources dock, where a1255+/// The Darkroom keeps imported subtitle tracks in the Text tab itself (moved
1256-/// row can be selected, folded with its source, removed, and dragged to the1256+/// off the unconditional spot under the Sources list, user 2026-08-27), where
1257+/// a row can be selected, folded with its source, removed, and dragged to the
1257 /// bench's existing subtitle-lane target.1258 /// bench's existing subtitle-lane target.
1258 #[test]1259 #[test]
1259 fn the_darkroom_subtitle_palette_drags_tracks_to_subtitle_lanes() {1260 fn the_darkroom_subtitle_palette_drags_tracks_to_subtitle_lanes() {
1260 let dock = src_text("ui/dock_stance.rs");1261 let dock = src_text("ui/dock_stance.rs");
1261 let palette = &dock[dock1262 let palette = &dock[dock
1262- .find("fn subtitle_palette")1263+ .find("fn subtitle_tab_rows")
1263- .expect("no Darkroom subtitle palette")..];1264+ .expect("no Darkroom subtitle rows")..];
1264 for required in [1265 for required in [
1265 "subtitle_rows",1266 "subtitle_rows",
1266 "dock-subtitle-group",1267 "dock-subtitle-group",
@@ -1283,8 +1284,8 @@ fn the_darkroom_subtitle_palette_drags_tracks_to_subtitle_lanes() {
1283 );1284 );
1284 }1285 }
1285 1286
1286-/// A subtitle group's header in the dock must not vanish on a short1287+/// A subtitle group's header in the Text tab must not vanish on a short
1287-/// window: `subtitle_palette` draws one per group unconditionally -- there1288+/// window: `subtitle_tab_rows` draws one per group unconditionally -- there
1288 /// is no viewport-height gate on it at all any more, so the list under it1289 /// is no viewport-height gate on it at all any more, so the list under it
1289 /// is what would scroll instead, never the header itself. And it has to be1290 /// is what would scroll instead, never the header itself. And it has to be
1290 /// a real fold, not the click-cycling pattern this codebase has already1291 /// a real fold, not the click-cycling pattern this codebase has already
crates/app/src/ui/dock_stance.rsmodified+136 -120
@@ -616,13 +616,20 @@ fn source_row(
616 })616 })
617 }617 }
618 618
619-/// Imported subtitle tracks, grouped by their source. A row selects and drags619+/// Imported subtitle tracks, grouped by their source -- the Text tab's own
620-/// its track; its header folds that source's rows without becoming a cycle.620+/// rows (DESIGN.md's "text section ... not serving to anything", user
621-fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElement> {621+/// 2026-08-27: relocated off the unconditional spot under the source list
622- let groups = subtitle_rows(player.session.as_ref()?.subtitles());622+/// and into the tab that names them). A row selects and drags its track; its
623- if groups.is_empty() {623+/// header folds that source's rows without becoming a cycle. Styled off
624- return None;624+/// [`source_row`] -- same dot, same name/detail ink and type scale, same
625- }625+/// hover fill and selection ring -- so Text stops reading as a second
626+/// dialect from Media/Audio. Hands back the track count for the tab header's
627+/// own count line, same as `rows.len()` does for the other two tabs.
628+fn subtitle_tab_rows(player: &Player, cx: &mut Context<Player>) -> (usize, Vec<AnyElement>) {
629+ let groups = match player.session.as_ref() {
630+ Some(session) => subtitle_rows(session.subtitles()),
631+ None => Vec::new(),
632+ };
626 let count: usize = groups.iter().map(|group| group.rows.len()).sum();633 let count: usize = groups.iter().map(|group| group.rows.len()).sum();
627 let rows: Vec<_> = groups634 let rows: Vec<_> = groups
628 .into_iter()635 .into_iter()
@@ -654,11 +661,11 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem
654 div()661 div()
655 .id(("dock-subtitle-track", track))662 .id(("dock-subtitle-track", track))
656 .flex_none()663 .flex_none()
657- .h(px(CONTROL_H))
658 .flex()664 .flex()
659 .items_center()665 .items_center()
660 .gap(px(6.))666 .gap(px(6.))
661 .px(px(8.))667 .px(px(8.))
668+ .py(px(4.))
662 .rounded(px(3.))669 .rounded(px(3.))
663 .when(picked, |d| d.border_1().border_color(rgb(INK1())))670 .when(picked, |d| d.border_1().border_color(rgb(INK1())))
664 .when(!usable, |d| d.opacity(0.5))671 .when(!usable, |d| d.opacity(0.5))
@@ -692,11 +699,14 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem
692 usable,699 usable,
693 ))700 ))
694 .child(701 .child(
702+ // The same round dot `source_row`'s own name line
703+ // opens with, not the old vertical bar -- one dot
704+ // shape for every row this dock draws.
695 div()705 div()
696 .flex_none()706 .flex_none()
697- .w(px(4.))707+ .w(px(8.))
698- .h(px(16.))708+ .h(px(8.))
699- .rounded(px(2.))709+ .rounded(px(4.))
700 .when_some(tint, |d, tint| d.bg(rgb(tint))),710 .when_some(tint, |d, tint| d.bg(rgb(tint))),
701 )711 )
702 .child(712 .child(
@@ -704,11 +714,8 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem
704 .flex_1()714 .flex_1()
705 .min_w(px(0.))715 .min_w(px(0.))
706 .truncate()716 .truncate()
707- .type_style(mono(717+ .type_style(mono(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM))
708- type_scale::CHORD_METADATA_MIN_PX,718+ .text_color(rgb(INK1()))
709- FontWeight::MEDIUM,
710- ))
711- .text_color(rgb(INK2()))
712 .child(title),719 .child(title),
713 )720 )
714 .child(721 .child(
@@ -724,7 +731,7 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem
724 .id(("dock-subtitle-remove", track))731 .id(("dock-subtitle-remove", track))
725 .flex_none()732 .flex_none()
726 .w(px(HIT_MIN))733 .w(px(HIT_MIN))
727- .h_full()734+ .h(px(HIT_MIN))
728 .flex()735 .flex()
729 .items_center()736 .items_center()
730 .justify_center()737 .justify_center()
@@ -757,11 +764,11 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem
757 div()764 div()
758 .id(("dock-subtitle-group", group_ord))765 .id(("dock-subtitle-group", group_ord))
759 .flex_none()766 .flex_none()
760- .h(px(CONTROL_H))
761 .flex()767 .flex()
762 .items_center()768 .items_center()
763 .gap(px(6.))769 .gap(px(6.))
764 .px(px(8.))770 .px(px(8.))
771+ .py(px(4.))
765 .rounded(px(3.))772 .rounded(px(3.))
766 .cursor_pointer()773 .cursor_pointer()
767 .hover(|s| s.bg(rgb(DARK_RAISED())))774 .hover(|s| s.bg(rgb(DARK_RAISED())))
@@ -785,9 +792,9 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem
785 d.child(792 d.child(
786 div()793 div()
787 .flex_none()794 .flex_none()
788- .w(px(4.))795+ .w(px(8.))
789- .h(px(16.))796+ .h(px(8.))
790- .rounded(px(2.))797+ .rounded(px(4.))
791 .bg(rgb(tint)),798 .bg(rgb(tint)),
792 )799 )
793 })800 })
@@ -796,8 +803,8 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem
796 .flex_1()803 .flex_1()
797 .min_w(px(0.))804 .min_w(px(0.))
798 .truncate()805 .truncate()
799- .type_style(label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM))806+ .type_style(mono(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM))
800- .text_color(rgb(INK2()))807+ .text_color(rgb(INK1()))
801 .child(group.name),808 .child(group.name),
802 )809 )
803 .child(810 .child(
@@ -815,19 +822,10 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem
815 ),822 ),
816 )823 )
817 .when(!folded, |d| d.children(tracks))824 .when(!folded, |d| d.children(tracks))
825+ .into_any_element()
818 })826 })
819 .collect();827 .collect();
820- Some(828+ (count, rows)
821- div()
822- .id("dock-subtitle-palette")
823- .flex_none()
824- .flex()
825- .flex_col()
826- .gap(px(2.))
827- .child(section_head(format!("SUBTITLES · {count}")))
828- .children(rows)
829- .into_any_element(),
830- )
831 }829 }
832 830
833 /// The Sources tab, built off MOCK-SPEC.md's "Dock" section: count line,831 /// The Sources tab, built off MOCK-SPEC.md's "Dock" section: count line,
@@ -836,47 +834,71 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem
836 /// ([`library_rows`]) are still what every row here is built from.834 /// ([`library_rows`]) are still what every row here is built from.
837 fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) -> impl IntoElement {835 fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) -> impl IntoElement {
838 let focused = player.focus_dock.is_focused(window);836 let focused = player.focus_dock.is_focused(window);
839- let sources = player837+ let text_tab = player.library_tab == LibraryTab::Text;
840- .session838+ // Text has no per-stream `Row` to fill -- its rows are subtitle tracks
841- .as_ref()839+ // grouped by source ([`subtitle_tab_rows`]), not `library_rows`' files --
842- .map_or(&[][..], PlaybackSession::sources);840+ // so it takes its own branch instead of a `Row` shape that would not fit
843- let all_rows: Vec<Row> = library_rows(841+ // it. `dock_filter`/`dock_sort` stay Media/Audio's own: a subtitle track
844- sources,842+ // has no "unused" count and its own row order is the file's own order,
845- &player.streams,843+ // the same reason the old palette never carried either control.
846- &player.decoders,844+ let (total, unused_count, row_elements): (usize, usize, Vec<AnyElement>) = if text_tab {
847- player.timeline_audio(),845+ let (count, elements) = subtitle_tab_rows(player, cx);
848- |path| {846+ (count, 0, elements)
849- player847+ } else {
850- .session848+ let sources = player
851- .as_ref()849+ .session
852- .map_or(0, |session| session.file_frames(path))850+ .as_ref()
853- },851+ .map_or(&[][..], PlaybackSession::sources);
854- );852+ let all_rows: Vec<Row> = library_rows(
855- let filter = player.dock_filter.to_lowercase();853+ sources,
856- let mut rows: Vec<(Row, usize)> = all_rows854+ &player.streams,
857- .into_iter()855+ &player.decoders,
858- .filter(|row| player.library_tab.holds(&row.path))856+ player.timeline_audio(),
859- .map(|row| {857+ |path| {
860- let placed = player.row_ctx(&row.path, row.stream).placed;858+ player
861- (row, placed)859+ .session
862- })860+ .as_ref()
863- .filter(|(row, placed)| {861+ .map_or(0, |session| session.file_frames(path))
864- filter.is_empty()862+ },
865- || row.name.to_lowercase().contains(&filter)863+ );
866- || row.detail.to_lowercase().contains(&filter)864+ let filter = player.dock_filter.to_lowercase();
867- || ("unused".contains(&filter) && *placed == 0)865+ let mut rows: Vec<(Row, usize)> = all_rows
868- })866+ .into_iter()
869- .collect();867+ .filter(|row| player.library_tab.holds(&row.path))
870- let unused_count = rows.iter().filter(|(_, placed)| *placed == 0).count();868+ .map(|row| {
871- match player.dock_sort {869+ let placed = player.row_ctx(&row.path, row.stream).placed;
872- DockSort::Recent => {}870+ (row, placed)
873- DockSort::Name => {871+ })
874- rows.sort_by(|(a, _), (b, _)| a.name.to_lowercase().cmp(&b.name.to_lowercase()))872+ .filter(|(row, placed)| {
873+ filter.is_empty()
874+ || row.name.to_lowercase().contains(&filter)
875+ || row.detail.to_lowercase().contains(&filter)
876+ || ("unused".contains(&filter) && *placed == 0)
877+ })
878+ .collect();
879+ let unused_count = rows.iter().filter(|(_, placed)| *placed == 0).count();
880+ match player.dock_sort {
881+ DockSort::Recent => {}
882+ DockSort::Name => {
883+ rows.sort_by(|(a, _), (b, _)| a.name.to_lowercase().cmp(&b.name.to_lowercase()))
884+ }
885+ DockSort::Usage => rows.sort_by(|(_, a), (_, b)| b.cmp(a)),
886+ DockSort::Unused => rows.sort_by_key(|(_, placed)| *placed > 0),
875 }887 }
876- DockSort::Usage => rows.sort_by(|(_, a), (_, b)| b.cmp(a)),888+ let total = rows.len();
877- DockSort::Unused => rows.sort_by_key(|(_, placed)| *placed > 0),889+ let elements: Vec<AnyElement> = rows
878- }890+ .iter()
879- let total = rows.len();891+ .enumerate()
892+ .map(|(i, (row, placed))| {
893+ let picked = player
894+ .selected_asset
895+ .as_ref()
896+ .is_some_and(|p| *p == (row.path.clone(), row.stream));
897+ source_row(player, i, row, *placed, picked, cx).into_any_element()
898+ })
899+ .collect();
900+ (total, unused_count, elements)
901+ };
880 let filter_text: SharedString = player.dock_filter.clone().into();902 let filter_text: SharedString = player.dock_filter.clone().into();
881 div()903 div()
882 .id("dock-sources")904 .id("dock-sources")
@@ -894,7 +916,11 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) -
894 .overflow_y_scroll()916 .overflow_y_scroll()
895 .child({917 .child({
896 let style = head();918 let style = head();
897- let hint: SharedString = format!("{total} total · {unused_count} unused").into();919+ let hint: SharedString = match text_tab {
920+ true => format!("{total} total"),
921+ false => format!("{total} total · {unused_count} unused"),
922+ }
923+ .into();
898 div()924 div()
899 .id("dock-header")925 .id("dock-header")
900 .flex_none()926 .flex_none()
@@ -963,34 +989,38 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) -
963 .child(tab.label())989 .child(tab.label())
964 })),990 })),
965 )991 )
966- .child({992+ // The sort cycle is Media/Audio's own: a subtitle track's order is
967- let current = player.dock_sort;993+ // its file's own order, not a pick among Recent/Name/Usage/Unused.
968- let style = label(type_scale::FLOOR_PX, FontWeight::MEDIUM);994+ .when(!text_tab, |d| {
969- div()995+ d.child({
970- .id("dock-sort-cycle")996+ let current = player.dock_sort;
971- .flex_none()997+ let style = label(type_scale::FLOOR_PX, FontWeight::MEDIUM);
972- .px(px(6.))998+ div()
973- .py(px(2.))999+ .id("dock-sort-cycle")
974- .rounded(px(3.))1000+ .flex_none()
975- .font(style.font)1001+ .px(px(6.))
976- .text_size(style.size)1002+ .py(px(2.))
977- .text_color(rgb(INK2()))1003+ .rounded(px(3.))
978- .cursor_pointer()1004+ .font(style.font)
979- .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1())))1005+ .text_size(style.size)
980- .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {1006+ .text_color(rgb(INK2()))
981- this.dock_sort = this.dock_sort.next();1007+ .cursor_pointer()
982- cx.notify();1008+ .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1())))
983- }))1009+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
984- .children(hitmap::dynamic(1010+ this.dock_sort = this.dock_sort.next();
985- move || {1011+ cx.notify();
986- (1012+ }))
987- "dock.sort.cycle".to_string(),1013+ .children(hitmap::dynamic(
988- format!("Sort: {} — click to cycle", current.label()),1014+ move || {
989- )1015+ (
990- },1016+ "dock.sort.cycle".to_string(),
991- true,1017+ format!("Sort: {} — click to cycle", current.label()),
992- ))1018+ )
993- .child(format!("↕ {}", current.label()))1019+ },
1020+ true,
1021+ ))
1022+ .child(format!("↕ {}", current.label()))
1023+ })
994 })1024 })
995 .child(1025 .child(
996 div()1026 div()
@@ -1001,35 +1031,21 @@ fn sources_tab(player: &Player, window: &mut Window, cx: &mut Context<Player>) -
1001 .flex_col()1031 .flex_col()
1002 .gap(px(2.))1032 .gap(px(2.))
1003 .overflow_y_scroll()1033 .overflow_y_scroll()
1004- .when(rows.is_empty(), |d| {1034+ .when(row_elements.is_empty(), |d| {
1005 let style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);1035 let style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);
1006 d.child(1036 d.child(
1007 div()1037 div()
1008 .font(style.font)1038 .font(style.font)
1009 .text_size(style.size)1039 .text_size(style.size)
1010 .text_color(rgb(INK3()))1040 .text_color(rgb(INK3()))
1011- .child(match player.dock_filter.is_empty() {1041+ .child(match text_tab || player.dock_filter.is_empty() {
1012 true => player.library_tab.empty().to_string(),1042 true => player.library_tab.empty().to_string(),
1013 false => "nothing matches the filter".to_string(),1043 false => "nothing matches the filter".to_string(),
1014 }),1044 }),
1015 )1045 )
1016 })1046 })
1017- .children({1047+ .children(row_elements),
1018- let elements: Vec<_> = rows
1019- .iter()
1020- .enumerate()
1021- .map(|(i, (row, placed))| {
1022- let picked = player
1023- .selected_asset
1024- .as_ref()
1025- .is_some_and(|p| *p == (row.path.clone(), row.stream));
1026- source_row(player, i, row, *placed, picked, cx).into_any_element()
1027- })
1028- .collect();
1029- elements
1030- }),
1031 )1048 )
1032- .children(subtitle_palette(player, cx))
1033 .child(section_head("IMPORT"))1049 .child(section_head("IMPORT"))
1034 .child(1050 .child(
1035 div()1051 div()