diff --git a/app/listen/[collectionid]/page.tsx b/app/listen/[collectionid]/page.tsx index bde2712..1b545f0 100644 --- a/app/listen/[collectionid]/page.tsx +++ b/app/listen/[collectionid]/page.tsx @@ -9,22 +9,21 @@ export default async function ListenByCollectionID({ params }: { params: { colle if (!id) return const controller = new MusicController(); - const result = await controller.getByID(id); - if (!result) return + const collection = await controller.getByID(id); + if (!collection) return - // const path = S3Service.asEndpoint(result.pathtoentry); - const entries = await S3Service.getURLs(result.pathtoentry); + const trackList = await S3Service.prepareTrackList(collection.pathtoentry); return (
-

{result.name}

-

{result.shortdescription}

+

{collection.name}

+

{collection.shortdescription}

-

{result.longdescription}

+

{collection.longdescription}

Loading...

}> - +
) diff --git a/components/Music/AudioGallery.tsx b/components/Music/AudioGallery.tsx index 122ab8a..0f78785 100644 --- a/components/Music/AudioGallery.tsx +++ b/components/Music/AudioGallery.tsx @@ -1,14 +1,18 @@ 'use client'; +import { MusicStreamingEntry } from "@/server/db/schema"; import { AudioTrack } from "./AudioTrack" -import { Maybe } from "@/util/helpers"; +import { _Object } from "@aws-sdk/client-s3"; +import { TrackWithURL } from "@/server/s3/service"; -export function AudioGallery({ urlList }: { urlList: Maybe }) { +export function AudioGallery({ trackList, collection }: { trackList: TrackWithURL[], collection: MusicStreamingEntry }) { return ( -
- { urlList - ? urlList.map((each, idx) => { - return - }) :

No audio results found for this work.

+
+ { trackList.length + ? trackList.map((each, idx) => { + if (!(each.Key.includes(".wav") || each.Key.includes(".mp3"))) return
+ return + }) + :

No audio results found for this work.

}
) diff --git a/components/Music/AudioPlayer/_Button.tsx b/components/Music/AudioPlayer/_Button.tsx index e760b70..08a8d61 100644 --- a/components/Music/AudioPlayer/_Button.tsx +++ b/components/Music/AudioPlayer/_Button.tsx @@ -1,14 +1,14 @@ type ButtonProps = { children: React.ReactNode; - conditionalExp: string; onClick: (...args: []) => void; + extraClasses?: string; disabled?: boolean } -export function _Button({ children, conditionalExp, onClick, disabled=false }: ButtonProps) { +export function _Button({ children, extraClasses="", onClick, disabled=false }: ButtonProps) { return ( diff --git a/components/Music/AudioPlayer/index.tsx b/components/Music/AudioPlayer/index.tsx index 2589a19..155a262 100644 --- a/components/Music/AudioPlayer/index.tsx +++ b/components/Music/AudioPlayer/index.tsx @@ -5,9 +5,10 @@ import { FaArrowDown, FaArrowUp, FaPause, FaPlay } from "react-icons/fa"; import { useCallback } from "react"; import { _Button } from "./_Button"; import Link from "@/components/ui/Link"; +import { prettyFileName } from "@/util/helpers"; export default function AudioPlayer() { - const { isPlaying, isOpen, currentTrack, setIsPlaying, setIsOpen } = useAudio(); + const { isPlaying, isOpen, currentTrack, currentCollection, setIsPlaying, setIsOpen } = useAudio(); const changePlayState = useCallback(() => { if (!currentTrack) { @@ -19,13 +20,14 @@ export default function AudioPlayer() { }, [currentTrack, isPlaying, setIsPlaying]) return ( -
+ <> +
{/* track info, if it is set */}
{ !isOpen ? null : currentTrack ? ( <> -

{currentTrack.name}

-

{currentTrack.artist ?? "(no artist listed)"} - {currentTrack.year ?? "(no year listed)"}

+

{prettyFileName(currentTrack.Key)}

+

{currentCollection?.artist ?? "(no artist listed)"} - {currentCollection?.year ?? "(no year listed)"}

) : ( <> @@ -35,23 +37,24 @@ export default function AudioPlayer() { )}
-
+
{/* conditionally-rendered button to close audio player once it's open */} - <_Button disabled={!currentTrack} conditionalExp={isOpen ? "opacity-100 translate-y-0 mr-4 " : "opacity-0 translate-y-32 mr-4 "} onClick={changePlayState}> + <_Button extraClasses={"fixed right-28 " + (isOpen ? "-bottom-30" : "bottom-10")} disabled={!currentTrack} onClick={changePlayState}> { isPlaying ? : } - - <_Button onClick={() => setIsOpen(!isOpen)} conditionalExp={isOpen ? "right-36" : "right-12"}> - { isOpen - ? - : - } -
-
+ + {/* floating button to open/close the player */} + <_Button extraClasses="fixed bottom-10 right-10" onClick={() => setIsOpen(!isOpen)}> + { isOpen + ? + : + } + + ) } diff --git a/components/Music/AudioTrack.tsx b/components/Music/AudioTrack.tsx index f888bbd..97588b9 100644 --- a/components/Music/AudioTrack.tsx +++ b/components/Music/AudioTrack.tsx @@ -1,4 +1,49 @@ 'use client'; -export function AudioTrack({ src }: { src: string }) { - return