use jl_types::domain::{project::Project, media::Media}; use yew::prelude::*; use yew_router::prelude::use_navigator; use crate::routes::main_router::Route; #[function_component(ProjectCard)] pub fn project_card(props: &ProjectCardProps) -> Html { let navigator = use_navigator().unwrap(); let project_id = props.project.id.clone(); let project_view_cb = Callback::from(move |_|{ navigator.push(&Route::Details { project_id }); }); let cover_image_url; if let Some(first_media) = props.project.media.media_list.get(0) { cover_image_url = match first_media { Media::Photo(url) => url.clone(), Media::Video(_) => String::new(), } } else { cover_image_url = String::new() } html!{