From 74de9146889f7e973e0ec4fe3205a6baabfac6da Mon Sep 17 00:00:00 2001 From: JMARyA Date: Sat, 14 Dec 2024 23:33:47 +0100 Subject: [PATCH] update --- .dockerignore | 3 +++ docker-compose.yml | 1 - src/pages/index.rs | 2 +- src/pages/watch.rs | 14 +++++++++++++- 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fae9934 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +videos +db +target \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index e62725f..6ec048d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3' services: watchdogs: build: . diff --git a/src/pages/index.rs b/src/pages/index.rs index 0838da5..19b080c 100644 --- a/src/pages/index.rs +++ b/src/pages/index.rs @@ -67,7 +67,7 @@ pub async fn index_page(htmx: HTMX, library: &State) -> (Status, (Conte }; }; h1 class="text-center text-4xl font-extrabold leading-tight mt-8" { "Directories:" }; - div class="flex p-10" { + div class="flex flex-wrap p-10" { @for dir in library.get_directories().await { a class="px-3 py-2 m-2 bg-purple-500 text-white rounded-full cursor-pointer hover:bg-purple-600" href=(format!("/d/{dir}")) { (dir) }; br; diff --git a/src/pages/watch.rs b/src/pages/watch.rs index e909b1f..ec504f1 100644 --- a/src/pages/watch.rs +++ b/src/pages/watch.rs @@ -8,7 +8,7 @@ use serde_json::json; use crate::{ library::{self, Library}, - pages::components::video_element, + pages::components::{format_date, video_element}, }; use super::{ @@ -44,6 +44,18 @@ pub async fn watch_page( }; div class="p-4 bg-stone-900 rounded-lg shadow-lg mt-8" { h2 class="text-2xl font-semibold" { (video.title) }; + + @if let Some(meta) = video.youtube_meta().await { + div class="flex justify-between mt-2" { + p class="mb-4 text-gray-300" { (meta.uploader_name) }; + p class="mb-4 text-gray-300" { (format!("{} Views ﹣ {}", meta.views, format_date(&meta.upload_date))) }; + }; + + a href=(format!("https://www.youtube.com/watch?v={}", meta.id)) class="text-blue-400" {"Watch on YouTube" }; + + p class="mb-2 text-gray-300 text-bold mt-2" { "Description: " } span { (meta.description) }; + }; + }; }; };