Fireworks

This commit is contained in:
Daniel Flanagan 2024-01-17 21:30:41 -06:00
parent 468d6ae72a
commit 8488f06405
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
4 changed files with 13 additions and 4 deletions

View file

@ -8,7 +8,7 @@ export function Button(
<button
{...props}
disabled={!IS_BROWSER || disabled}
class={`px-2 py-1 bg-gray-500/20 rounded hover:bg-gray-500/25 cursor-pointer transition-colors ${className}`}
class={`flex items-center justify-center gap-1 px-2 py-1 bg-gray-500/20 rounded hover:bg-gray-500/25 cursor-pointer transition-colors ${className}`}
/>
)
}

View file

@ -93,6 +93,7 @@ export default function Dashboard(
}, [])
useEffect(() => {
const fireworks = new Audio('/fireworks.mp3')
const count = 200,
defaults = {
origin: { y: 0.7 },
@ -104,6 +105,7 @@ export default function Dashboard(
decay?: number
scalar?: number
}) {
fireworks.play()
confetti(
Object.assign({}, defaults, opts, {
particleCount: Math.floor(count * particleRatio),

View file

@ -2,7 +2,14 @@ import { Todo, UserWithTodos } from '@homeman/models.ts'
import { JSX } from 'preact'
import { Button } from '@homeman/components/Button.tsx'
import { Avatar } from '@homeman/components/Avatar.tsx'
import { ChevronDownMiniSolid, TrashSolid } from 'preact-heroicons'
import {
CheckBadgeSolid,
CheckCircleMiniSolid,
CheckCircleSolid,
CheckMiniSolid,
ChevronDownMiniSolid,
TrashSolid,
} from 'preact-heroicons'
export interface Props {
user: UserWithTodos
@ -33,7 +40,7 @@ export function TodoList(
<footer class='flex gap-2'>
{(virtual || doneAt != null) ? '' : (
<Button
className='grow'
className='bg-emerald-500/50 grow'
onClick={async () => {
await fetch('/api/todo/done', {
method: 'PUT',
@ -41,7 +48,7 @@ export function TodoList(
})
}}
>
Done
<CheckMiniSolid class='w-5 h-5' /> Done
</Button>
)}
{(!virtual && doneAt != null)

BIN
static/fireworks.mp3 Normal file

Binary file not shown.