Skip to content

Commit

Permalink
Merge pull request #332 from CommandDash/web-whoosh-sound-effect-expe…
Browse files Browse the repository at this point in the history
…rimental

(feat): add a sound validation on agent submit button
  • Loading branch information
samyakkkk authored Aug 18, 2024
2 parents ef85193 + 3b69011 commit fbdaa46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions web/src/lib/components/CreateAgentDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,22 @@
{ id: 'pub', icon: 'icons8-dart-96.png', label: 'Pub', placeholder: 'https://pub.dev/packages/name' },
];
let soundEffect: HTMLAudioElement | null = null;
if (typeof window !== 'undefined') {
// Preload the sound effect
soundEffect = new Audio('whoosh.mp3');
soundEffect.preload = 'auto';
soundEffect.volume = 0.5
}
const onCreateAgent = () => {
value = value.trim();
const { isValid } = validateURL(value, selectedPlatform);
if (isValid) {
// Play the sound effect
soundEffect?.play();
appInsights.trackEvent({
name: "CreateAgentSubmitted",
properties: { platform: selectedPlatform, url: value },
Expand Down
Binary file added web/static/whoosh.mp3
Binary file not shown.

0 comments on commit fbdaa46

Please sign in to comment.