diff options
| author | darkuss <darkussdelta@gmail.com> | 2026-08-22 01:58:37 +0200 |
|---|---|---|
| committer | darkuss <darkussdelta@gmail.com> | 2026-08-22 01:58:37 +0200 |
| commit | 8f32fd58cafe677c07d9ed9fff84f6e255156d37 (patch) | |
| tree | a5de06ffb2c0a8b878c8a563ec8cee692efc98ac /src/apps/audio.tsx | |
| parent | 5ac62cc1a4d9a5f50ea26d5bc1afb0fbf95da23c (diff) | |
holy shit i'm finally done
Diffstat (limited to 'src/apps/audio.tsx')
| -rw-r--r-- | src/apps/audio.tsx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/apps/audio.tsx b/src/apps/audio.tsx new file mode 100644 index 0000000..45d8716 --- /dev/null +++ b/src/apps/audio.tsx @@ -0,0 +1,27 @@ +import { Signal, useSignalEffect } from "@preact/signals" +import { Address } from "$/apps/source"; +import { memo, Ref, useEffect } from "preact/compat"; + +const filenameRegex = /.*\/(.*)$/; + +export const Audio = memo(function Audio({ source, title, contentReady }: Image.Props) { + useEffect(() => { + contentReady.value = true + }, []) + + useSignalEffect(() => { + const filename = decodeURIComponent(source.value.link.pathname.match(filenameRegex)?.[1] ?? source.value.link.toString()); + title.value = `${filename} - tunez player`; + }) + + + return <audio controls src={source.value.link.toString()}></audio> +}) + +namespace Image { + export type Props = { + source: Signal<Address>, + title: Signal<string | undefined>, + contentReady: Signal<boolean>, + } +} |
