Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
Add alternative claim success sound. (#2384)
Browse files Browse the repository at this point in the history
  • Loading branch information
fairlighteth authored Feb 4, 2022
1 parent 94245c5 commit 653d9b6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Binary file added public/audio/success-claim.mp3
Binary file not shown.
4 changes: 2 additions & 2 deletions src/custom/state/claim/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isAnyOf, Middleware } from '@reduxjs/toolkit'
import { getCowSoundSend, getCowSoundSuccess } from 'utils/sound'
import { getCowSoundSend, getCowSoundSuccessClaim } from 'utils/sound'
import { AppState } from 'state'
import { addTransaction, finalizeTransaction } from '../enhancedTransactions/actions'
import { ClaimStatus, setClaimStatus } from './actions'
Expand Down Expand Up @@ -34,7 +34,7 @@ export const claimMinedMiddleware: Middleware<Record<string, unknown>, AppState>
if (status === 1) {
// success
store.dispatch(setClaimStatus(ClaimStatus.CONFIRMED))
cowSound = getCowSoundSuccess()
cowSound = getCowSoundSuccessClaim()
} else {
// not success...
store.dispatch(setClaimStatus(ClaimStatus.FAILED))
Expand Down
7 changes: 6 additions & 1 deletion src/custom/utils/sound.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
type SoundType = 'SEND' | 'SUCCESS' | 'ERROR'
type SoundType = 'SEND' | 'SUCCESS' | 'SUCCESS_CLAIM' | 'ERROR'
type Sounds = Record<SoundType, string>

const COW_SOUNDS: Sounds = {
SEND: '/audio/send.mp3',
SUCCESS: '/audio/success.mp3',
SUCCESS_CLAIM: '/audio/success-claim.mp3',
ERROR: '/audio/error.mp3',
}

Expand All @@ -29,6 +30,10 @@ export function getCowSoundSuccess(): HTMLAudioElement {
return getAudio('SUCCESS')
}

export function getCowSoundSuccessClaim(): HTMLAudioElement {
return getAudio('SUCCESS_CLAIM')
}

export function getCowSoundError(): HTMLAudioElement {
return getAudio('ERROR')
}

0 comments on commit 653d9b6

Please sign in to comment.