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]]
name = "based"
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 = [
"bcrypt",
"chrono",

View file

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

View file

@ -48,16 +48,10 @@ pub async fn watch_page(
Context(Aspect::Video(
Background(
Rounded(
Width(ScreenValue::full,
Height(ScreenValue::full,
Rounded(
Video().controls().autoplay().add_src(
Video().controls().autoplay().width(1080).add_src(
Source(&format!("/video/raw?v={}", video.id), Some("video/mp4".to_string()))
)
).size(Size::Large)
)
)
).size(Size::Large)
).color(Colors::Black)
))
).push(
@ -72,26 +66,28 @@ pub async fn watch_page(
.push_some(youtube_meta.as_ref(), |meta: &_| {
Div()
.push(
Margin(Flex(
Context(Margin(Flex(
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(
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(
Link(&format!("https://www.youtube.com/watch?v={}", meta.id),
Text("Watch on YouTube").color(&Red::_400)
Context(Link(&format!("https://www.youtube.com/watch?v={}", meta.id),
Text("Watch on YouTube").color(&Red::_400))
)
).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)
).color(Stone::_900)
).all(ScreenValue::_4)).top(ScreenValue::_4))
).all(ScreenValue::_4)).top(ScreenValue::_8))
)
)
).push(
@ -119,7 +115,7 @@ pub async fn build_rec(library: &Library, video: &Video) -> PreEscaped<String> {
};
};
Margin(Width(
Width(
Fraction::_1on3,
Div()
.id("recommendations")
@ -143,7 +139,6 @@ pub async fn build_rec(library: &Library, video: &Video) -> PreEscaped<String> {
.bottom(ScreenValue::_2),
)
.push(video_elements),
))
.top(ScreenValue::_8)
)
.render()
}