Skip to content

Commit

Permalink
🍱 adds fanfare
Browse files Browse the repository at this point in the history
  • Loading branch information
chriamue committed Jun 15, 2024
1 parent 4855dbc commit 99eea5f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ wasm-bindgen = "0.2.92"
wasm-bindgen-futures = "0.4.42"
console_log = "1.0.0"
gloo-timers = "0.3.0"
web-sys = { version="0.3.69", features = ["HtmlAudioElement"] }
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<script src="https://unpkg.com/@tonconnect/sdk@latest/dist/tonconnect-sdk.min.js"></script>
<script src="https://unpkg.com/@tonconnect/ui@latest/dist/tonconnect-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.3/dist/confetti.browser.min.js"></script>

<link data-trunk rel="copy-dir" href="src/assets/" />
<link
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
rel="stylesheet"
Expand Down
Binary file added src/assets/fanfare-3-rpg.ogg
Binary file not shown.
3 changes: 3 additions & 0 deletions src/challenge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use konnektoren_core::{
use konnektoren_yew::components::challenge::{
ChallengeComponent, ChallengeEvent, ResultSummaryComponent,
};
use web_sys::HtmlAudioElement;
use std::ops::Div;
use yew::prelude::*;

Expand All @@ -32,6 +33,8 @@ pub fn challenge_comp(props: &ChallengeCompProps) -> Html {
let points = challenge.performance(&result).div(10);
add_points(points);
challenge_result.set(Some(result.clone()));
let audio = HtmlAudioElement::new_with_src("assets/fanfare-3-rpg.ogg").unwrap();
let _ = audio.play().unwrap();
}
ChallengeEvent::NextTask(_index) => {}
ChallengeEvent::PreviousTask(_index) => {}
Expand Down

0 comments on commit 99eea5f

Please sign in to comment.