diff --git a/crates/site-app/src/pages/qr_code.rs b/crates/site-app/src/pages/qr_code.rs index 45c53d6..b64d6b0 100644 --- a/crates/site-app/src/pages/qr_code.rs +++ b/crates/site-app/src/pages/qr_code.rs @@ -26,11 +26,22 @@ pub fn InnerQrCodePage( std::env::var("APP_BASE_URL").expect("APP_BASE_URL not set"), ); + // we will display the qr code regardless, but if we can map it to a photo + // group, we will also display the photo deck + let photo_deck_element = match id.parse::() { + Ok(ulid) => view! { + + } + .into_view(), + Err(_) => view! {

"Invalid photo group ID"

}.into_view(), + }; + view! {

"QR Code"

+ {photo_deck_element}
"Back to Dashboard"
@@ -67,3 +78,36 @@ pub fn QrCode( } } + +#[component] +pub fn PhotoDeckWrapper( + group_id: core_types::PhotoGroupRecordId, +) -> impl IntoView { + let photo_group = + create_resource(move || group_id, bl::fetch::fetch_photo_group); + + view! { + + { photo_group.map(|r| { + match r { + Ok(Some(photo_group)) => view! { +
+ +
+ }.into_view(), + Ok(None) => view! { +
+

"Photo group not found"

+
+ }.into_view(), + Err(e) => view! { +
+

{e.to_string()}

+

"Failed to fetch photo group"

+
+ }.into_view(), + } + })} +
+ } +}