timeline rendering

This commit is contained in:
2026-01-28 21:30:47 -05:00
parent c3ddcf16bf
commit dc5dc4bff4
6 changed files with 143 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
use chrono::{Datelike, Days, Local};
use chrono::{Datelike, Local};
use dioxus::prelude::*;
use prost_types::Timestamp;
@@ -10,10 +10,10 @@ const PLAYER_CSS: Asset = asset!("/assets/styling/player.scss");
#[component]
pub fn Player() -> Element {
let entries = use_resource(|| async move {
let playbackResult = use_resource(|| async move {
let mut client = get_rpc_client();
let now = Local::now();
let from = Timestamp::date(now.year() as i64, now.month() as u8, now.day() as u8).unwrap();
let from = Timestamp::date(now.year() as i64, now.month() as u8, now.day() as u8 - 4).unwrap();
let result = client
.get_media_playback(MediaPlaybackRequest { date: Some(from) })
.await;
@@ -26,12 +26,12 @@ pub fn Player() -> Element {
return Err(format!("Failed to load results: {msg}"));
}
});
let len = match entries.cloned() {
let info = match playbackResult.cloned() {
Some(value) => match value {
Ok(result) => result.channels.len().to_string(),
Err(err) => err,
Ok(result) => Some(result),
Err(_) => None,
},
_ => "Not Loaded".to_string(),
_ => None,
};
rsx! {
document::Link { rel: "stylesheet", href: PLAYER_CSS }
@@ -39,10 +39,9 @@ pub fn Player() -> Element {
id: "player",
div {
id: "head",
"r {len}"
}
Viewport { }
Timeline { }
Timeline { playbackInfo: info }
}
}
}