Skip to content

Commit

Permalink
Merge pull request #48 from go-bazzinga/infinite-scroll/unmute
Browse files Browse the repository at this point in the history
Add Unmute button to posts view
  • Loading branch information
rupansh-sekar-yral authored Feb 1, 2024
2 parents 42a2f3e + 7fb3b22 commit 5dadfaa
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/page/post_view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mod error;
mod video_iter;
mod video_loader;

use leptos_icons::*;
use std::pin::pin;

use candid::Principal;
Expand Down Expand Up @@ -73,6 +74,14 @@ pub fn ScrollingView() -> impl IntoView {
})
});

let muted = create_rw_signal(true);
let trigger_unmute = move || {
muted.set(false);
if let Some(v) = video_ref.get() {
v.set_muted(false)
}
};

view! {
<div
class="snap-mandatory snap-y overflow-y-scroll h-screen bg-black"
Expand All @@ -97,6 +106,17 @@ pub fn ScrollingView() -> impl IntoView {
}
/>

<Show when=muted>
<div
class="fixed top-1/2 left-1/2 cursor-pointer"
on:click=move |_| trigger_unmute()
>
<Icon
class="text-white/80 animate-ping text-4xl"
icon=icondata::BiVolumeMuteSolid
/>
</div>
</Show>
</div>
}
}
Expand Down

0 comments on commit 5dadfaa

Please sign in to comment.