This commit is contained in:
JMARyA 2025-01-22 19:57:43 +01:00
parent 0301b04ba2
commit 2ac2559c23
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
3 changed files with 23 additions and 28 deletions

2
Cargo.lock generated
View file

@ -146,7 +146,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
[[package]] [[package]]
name = "based" name = "based"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.hydrar.de/jmarya/based?branch=ui#5ef37275ec504dc2e406d8feadca2e388e8d7fc9" source = "git+https://git.hydrar.de/jmarya/based?branch=ui#6a39c0441d72cbaa1f9864af9c53ac41362f549e"
dependencies = [ dependencies = [
"bcrypt", "bcrypt",
"chrono", "chrono",

View file

@ -92,36 +92,36 @@ pub async fn video_element_wide(video: &Video) -> PreEscaped<String> {
Margin( Margin(
MaxHeight(ScreenValue::_32, MaxHeight(ScreenValue::_32,
Div().vanish().push( Div().vanish().push(
Margin(Text(&video.title).large().semibold().max_lines(LineClamp::_3).title(&video.title).align(TextAlignment::Start) Margin(Text(&video.title).base_size().semibold().max_lines(LineClamp::_3).title(&video.title).align(TextAlignment::Start)
).bottom(ScreenValue::_1) ).bottom(ScreenValue::_1)
).push_some(yt_meta, |meta| { ).push_some(yt_meta, |meta| {
Flex( Flex(
FlexGrow(Strategy::Grow, FlexGrow(Strategy::Grow,
Margin( Margin(
Padding( Padding(
Div().vanish().push( Div().vanish().push(Context(
Paragraph( Paragraph(
Margin( Margin(
Div().vanish().push( Paragraph(Div().vanish().push(
Span(&meta.uploader_name).medium() Span(&meta.uploader_name).medium()
).push( ).push(
Span(" - ") Span(" - ")
).push( ).push(
Span(&format_date(&meta.upload_date)) Span(&format_date(&meta.upload_date)).normal()
) )).xs().align(TextAlignment::Start)
).bottom(ScreenValue::_2) ).bottom(ScreenValue::_2)
).sm().color(&Gray::_400).align(TextAlignment::Start) ).sm().color(&Gray::_400).align(TextAlignment::Start)
).push( )).push(Context(
Paragraph( Paragraph(
Div().vanish().push( Div().vanish().push(
Span(&format_number(meta.views)) Span(&format_number(meta.views))
).push( ).push(
Span(" views") Span(" views")
) )
).sm().color(&Gray::_400).align(TextAlignment::Start) ).xs().color(&Gray::_400).align(TextAlignment::Start))
) )
).y(ScreenValue::_1) ).y(ScreenValue::_1)
).left(ScreenValue::_2) )
) )
).direction(Direction::Column) ).direction(Direction::Column)
}) })

View file

@ -48,15 +48,9 @@ pub async fn watch_page(
Context(Aspect::Video( Context(Aspect::Video(
Background( Background(
Rounded( Rounded(
Width(ScreenValue::full, Video().controls().autoplay().width(1080).add_src(
Height(ScreenValue::full,
Rounded(
Video().controls().autoplay().add_src(
Source(&format!("/video/raw?v={}", video.id), Some("video/mp4".to_string())) Source(&format!("/video/raw?v={}", video.id), Some("video/mp4".to_string()))
) )
).size(Size::Large)
)
)
).size(Size::Large) ).size(Size::Large)
).color(Colors::Black) ).color(Colors::Black)
)) ))
@ -72,26 +66,28 @@ pub async fn watch_page(
.push_some(youtube_meta.as_ref(), |meta: &_| { .push_some(youtube_meta.as_ref(), |meta: &_| {
Div() Div()
.push( .push(
Margin(Flex( Context(Margin(Flex(
Div().vanish().push( Div().vanish().push(
Margin(Text(&format_date(&meta.upload_date)).color(&Gray::_300)).bottom(ScreenValue::_4) Margin(Text(&meta.uploader_name).color(&Gray::_300).xl()).bottom(ScreenValue::_4)
).push( ).push(
Margin(Text(&format!("{} Views ﹣ {}", meta.views, format_date(&meta.upload_date))).color(&Gray::_300)).bottom(ScreenValue::_4) Margin(Text(&format!("{} Views ﹣ {}", meta.views, format_date(&meta.upload_date))).color(&Gray::_300).xl()).bottom(ScreenValue::_4)
) )
).justify(Justify::Between).group()).top(ScreenValue::_2) ).justify(Justify::Between).group()).top(ScreenValue::_2))
) )
.push( .push(
Link(&format!("https://www.youtube.com/watch?v={}", meta.id), Context(Link(&format!("https://www.youtube.com/watch?v={}", meta.id),
Text("Watch on YouTube").color(&Red::_400) Text("Watch on YouTube").color(&Red::_400))
) )
).push( ).push(
Margin(Text(&meta.description).bold().color(&Gray::_300).wrap(TextWrap::Pretty).whitespace(TextWhitespace::BreakSpaces)).bottom(ScreenValue::_2).top(ScreenValue::_2) Context(Margin(
) Text(meta.description.trim_ascii()).sm().color(&Gray::_300).wrap(TextWrap::Pretty).whitespace(TextWhitespace::BreakSpaces)
).y(ScreenValue::_2).top(ScreenValue::_6)
))
} }
) )
)).size(Size::Large) )).size(Size::Large)
).color(Stone::_900) ).color(Stone::_900)
).all(ScreenValue::_4)).top(ScreenValue::_4)) ).all(ScreenValue::_4)).top(ScreenValue::_8))
) )
) )
).push( ).push(
@ -119,7 +115,7 @@ pub async fn build_rec(library: &Library, video: &Video) -> PreEscaped<String> {
}; };
}; };
Margin(Width( Width(
Fraction::_1on3, Fraction::_1on3,
Div() Div()
.id("recommendations") .id("recommendations")
@ -143,7 +139,6 @@ pub async fn build_rec(library: &Library, video: &Video) -> PreEscaped<String> {
.bottom(ScreenValue::_2), .bottom(ScreenValue::_2),
) )
.push(video_elements), .push(video_elements),
)) )
.top(ScreenValue::_8)
.render() .render()
} }