parent
086feff1cb
commit
87ff7b5027
1 changed files with 39 additions and 45 deletions
|
@ -64,10 +64,10 @@ pub fn shell(content: PreEscaped<String>, title: &str) -> PreEscaped<String> {
|
|||
|
||||
div class="flex justify-start px-6" {
|
||||
|
||||
(htmx_link("/", "flex items-center space-x-2", "stopAllVideos()", html!(
|
||||
a href="/" class="flex items-center space-x-2" {
|
||||
img src="/favicon" alt="Logo" class="w-10 h-10 rounded-md";
|
||||
span class="font-semibold text-xl" { "WatchDogs" };
|
||||
)))
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
@ -140,63 +140,57 @@ pub fn format_number(num: i32) -> String {
|
|||
}
|
||||
|
||||
pub async fn video_element_wide(video: &mut Video) -> PreEscaped<String> {
|
||||
htmx_link(
|
||||
&format!("/watch?v={}", video.id),
|
||||
"flex items-center w-full p-4 bg-gray-900 shadow-lg rounded-lg overflow-hidden mb-2 mt-2",
|
||||
"stopAllVideos()",
|
||||
html!(
|
||||
div class="flex-shrink-0" {
|
||||
img width="480" src=(format!("/video/thumbnail?v={}", video.id)) alt="Video Thumbnail" class="w-48 h-32 object-cover rounded-md";
|
||||
html!(
|
||||
a href=(format!("/watch?v={}", video.id)) class="flex items-center w-full p-4 bg-gray-900 shadow-lg rounded-lg overflow-hidden mb-2 mt-2" {
|
||||
div class="flex-shrink-0" {
|
||||
img width="480" src=(format!("/video/thumbnail?v={}", video.id)) alt="Video Thumbnail" class="w-48 h-32 object-cover rounded-md";
|
||||
};
|
||||
|
||||
div class="flex flex-col flex-grow ml-4" {
|
||||
h3 class="text-lg font-semibold truncate mb-1" {
|
||||
( video.title )
|
||||
};
|
||||
|
||||
div class="flex flex-col flex-grow ml-4" {
|
||||
h3 class="text-lg font-semibold truncate mb-1" {
|
||||
( video.title )
|
||||
};
|
||||
@if let Some(meta) = video.youtube_meta().await {
|
||||
div class="text-sm text-gray-400 mb-2" {
|
||||
span class="font-medium" { ( meta.uploader_name ) }
|
||||
span { " - " }
|
||||
span { ( format_date(&meta.upload_date) ) }
|
||||
};
|
||||
|
||||
@if let Some(meta) = video.youtube_meta().await {
|
||||
div class="text-sm text-gray-400 mb-2" {
|
||||
span class="font-medium" { ( meta.uploader_name ) }
|
||||
span { " - " }
|
||||
span { ( format_date(&meta.upload_date) ) }
|
||||
};
|
||||
|
||||
div class="text-sm text-gray-400" {
|
||||
span { ( format_number(meta.views) ) }
|
||||
span { " views" }
|
||||
span { " - " }
|
||||
span class="ml-2 bg-black text-white text-xs px-2 py-1 rounded-sm opacity-90" {
|
||||
(( format_seconds_to_hhmmss(video.duration) ))
|
||||
};
|
||||
div class="text-sm text-gray-400" {
|
||||
span { ( format_number(meta.views) ) }
|
||||
span { " views" }
|
||||
span { " - " }
|
||||
span class="ml-2 bg-black text-white text-xs px-2 py-1 rounded-sm opacity-90" {
|
||||
(( format_seconds_to_hhmmss(video.duration) ))
|
||||
};
|
||||
};
|
||||
};
|
||||
),
|
||||
};
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
pub async fn video_element(video: &mut Video) -> PreEscaped<String> {
|
||||
htmx_link(
|
||||
&format!("/watch?v={}", video.id),
|
||||
"max-w-sm mx-auto p-4 max-h-60 aspect-video",
|
||||
"stopAllVideos()",
|
||||
html!(
|
||||
div class="bg-gray-900 shadow-lg rounded-lg overflow-hidden" {
|
||||
div class="relative" {
|
||||
img width="480" src=(format!("/video/thumbnail?v={}", video.id)) alt="Video Thumbnail" class="w-full h-auto object-cover aspect-video";
|
||||
span class="absolute bottom-2 right-2 bg-black text-white text-xs px-2 py-1 rounded-sm opacity-90" {
|
||||
(( format_seconds_to_hhmmss(video.duration) ))
|
||||
};
|
||||
html!(
|
||||
a href=(format!("/watch?v={}", video.id)) class="max-w-sm mx-auto p-4 max-h-60 aspect-video" {
|
||||
div class="bg-gray-900 shadow-lg rounded-lg overflow-hidden" {
|
||||
div class="relative" {
|
||||
img width="480" src=(format!("/video/thumbnail?v={}", video.id)) alt="Video Thumbnail" class="w-full h-auto object-cover aspect-video";
|
||||
span class="absolute bottom-2 right-2 bg-black text-white text-xs px-2 py-1 rounded-sm opacity-90" {
|
||||
(( format_seconds_to_hhmmss(video.duration) ))
|
||||
};
|
||||
};
|
||||
|
||||
div class="bg-gray-900 shadow-lg rounded-lg overflow-hidden" {
|
||||
div class="p-4" {
|
||||
h3 class="text-lg font-semibold truncate" {
|
||||
( video.title )
|
||||
};
|
||||
div class="bg-gray-900 shadow-lg rounded-lg overflow-hidden" {
|
||||
div class="p-4" {
|
||||
h3 class="text-lg font-semibold truncate" {
|
||||
( video.title )
|
||||
};
|
||||
};
|
||||
};
|
||||
),
|
||||
};
|
||||
};
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue