mirror of
https://github.com/ManInDark/HabitTrove.git
synced 2026-01-21 06:34:30 +01:00
redeem link + completing task + play sound
This commit is contained in:
@@ -20,6 +20,7 @@ export type WishlistItemType = {
|
||||
coinCost: number
|
||||
archived?: boolean // mark the wishlist item as archived
|
||||
targetCompletions?: number // Optional field, infinity when unset
|
||||
link?: string // Optional URL to external resource
|
||||
}
|
||||
|
||||
export type TransactionType = 'HABIT_COMPLETION' | 'HABIT_UNDO' | 'WISH_REDEMPTION' | 'MANUAL_ADJUSTMENT' | 'TASK_COMPLETION' | 'TASK_UNDO';
|
||||
|
||||
@@ -279,3 +279,11 @@ export function getHabitFreq(habit: Habit): Freq {
|
||||
default: throw new Error(`Invalid frequency: ${freq}`)
|
||||
}
|
||||
}
|
||||
|
||||
// play sound (client side only, must be run in browser)
|
||||
export const playSound = (soundPath: string = '/sounds/timer-end.wav') => {
|
||||
const audio = new Audio(soundPath)
|
||||
audio.play().catch(error => {
|
||||
console.error('Error playing sound:', error)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user