v3: various minor visual fixes
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 39s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 39s
This commit is contained in:
@@ -59,6 +59,7 @@ export function DumpCard(
|
||||
<RichContentCard
|
||||
richContent={dump.richContent}
|
||||
compact
|
||||
dumpHref={dumpUrl(dump)}
|
||||
thumbnailOverrideUrl={dump.thumbnailMime
|
||||
? dumpThumbnailUrl(dump, token)
|
||||
: undefined}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import type { Dump } from "../model.ts";
|
||||
import { formatBytes } from "../utils/format.ts";
|
||||
import { dumpFileUrl, dumpThumbnailUrl } from "../utils/urls.ts";
|
||||
import { dumpFileUrl, dumpThumbnailUrl, dumpUrl } from "../utils/urls.ts";
|
||||
import { useAuth } from "../hooks/useAuth.ts";
|
||||
import { IconPause, IconPlay, MediaPlayer } from "./MediaPlayer.tsx";
|
||||
import { PlayerContext } from "../contexts/PlayerContext.ts";
|
||||
@@ -45,7 +45,7 @@ function AudioFilePreview(
|
||||
|
||||
const handlePlayBtn = () => {
|
||||
if (isActive) togglePlay();
|
||||
else play({ kind: "file", fileUrl, mimeType: mime, title: dump.title });
|
||||
else play({ kind: "file", fileUrl, mimeType: mime, title: dump.title, dumpHref: dumpUrl(dump) });
|
||||
};
|
||||
|
||||
const handleWaveformClick = (e: React.MouseEvent<Element>) => {
|
||||
@@ -59,7 +59,7 @@ function AudioFilePreview(
|
||||
} else {
|
||||
// Start playing and seek once it loads — seekTo after play() is a no-op
|
||||
// until MediaPlayer mounts; the fraction is best-effort on first click
|
||||
play({ kind: "file", fileUrl, mimeType: mime, title: dump.title });
|
||||
play({ kind: "file", fileUrl, mimeType: mime, title: dump.title, dumpHref: dumpUrl(dump) });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -178,7 +178,7 @@ export default function FilePreview(
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
play({ kind: "file", fileUrl, mimeType: mime, title: dump.title });
|
||||
play({ kind: "file", fileUrl, mimeType: mime, title: dump.title, dumpHref: dumpUrl(dump) });
|
||||
}}
|
||||
>
|
||||
<VideoThumb src={thumbUrl} fallback={mimeIcon(mime)} />
|
||||
@@ -196,7 +196,7 @@ export default function FilePreview(
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
play({ kind: "file", fileUrl, mimeType: mime, title: dump.title });
|
||||
play({ kind: "file", fileUrl, mimeType: mime, title: dump.title, dumpHref: dumpUrl(dump) });
|
||||
}}
|
||||
>
|
||||
{thumbOverride
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useContext, useEffect, useRef, useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { PlayerContext } from "../contexts/PlayerContext.ts";
|
||||
import { MediaPlayer } from "./MediaPlayer.tsx";
|
||||
|
||||
@@ -75,7 +76,13 @@ export function GlobalPlayer() {
|
||||
ref={ref}
|
||||
>
|
||||
<div className="global-player-header">
|
||||
<span className="global-player-title">{title}</span>
|
||||
{current.dumpHref
|
||||
? (
|
||||
<Link to={current.dumpHref} className="global-player-title">
|
||||
{title}
|
||||
</Link>
|
||||
)
|
||||
: <span className="global-player-title">{title}</span>}
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn--ghost"
|
||||
|
||||
@@ -162,6 +162,7 @@ export function JournalCard(
|
||||
embedUrl,
|
||||
title: dump.richContent?.title,
|
||||
type: dump.richContent?.type ?? "unknown",
|
||||
dumpHref: dumpUrl(dump),
|
||||
})
|
||||
: handleNavigate}
|
||||
>
|
||||
|
||||
@@ -22,10 +22,13 @@ interface RichContentCardProps {
|
||||
compact?: boolean;
|
||||
/** Overrides richContent.thumbnailUrl with a custom dump thumbnail, if set. */
|
||||
thumbnailOverrideUrl?: string;
|
||||
/** Link back to the owning dump, surfaced as the global player's title. */
|
||||
dumpHref?: string;
|
||||
}
|
||||
|
||||
export default function RichContentCard(
|
||||
{ richContent, compact = false, thumbnailOverrideUrl }: RichContentCardProps,
|
||||
{ richContent, compact = false, thumbnailOverrideUrl, dumpHref }:
|
||||
RichContentCardProps,
|
||||
) {
|
||||
const { play, current, playing } = useContext(PlayerContext);
|
||||
const thumbnailSrc = thumbnailOverrideUrl ??
|
||||
@@ -52,6 +55,7 @@ export default function RichContentCard(
|
||||
embedUrl: richContent.embedUrl!,
|
||||
title: richContent.title,
|
||||
type: richContent.type,
|
||||
dumpHref,
|
||||
});
|
||||
}}
|
||||
aria-label={isPlaying ? "Pause" : "Play"}
|
||||
@@ -113,6 +117,7 @@ export default function RichContentCard(
|
||||
embedUrl: richContent.embedUrl!,
|
||||
title: richContent.title,
|
||||
type: richContent.type,
|
||||
dumpHref,
|
||||
})}
|
||||
aria-label="Play"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user