v3: allow users to edit dump thumbnail, fixed some linter errors in the frontend
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
This commit is contained in:
@@ -20,12 +20,18 @@ function proxyIfHttp(url: string): string {
|
||||
interface RichContentCardProps {
|
||||
richContent: RichContent;
|
||||
compact?: boolean;
|
||||
/** Overrides richContent.thumbnailUrl with a custom dump thumbnail, if set. */
|
||||
thumbnailOverrideUrl?: string;
|
||||
}
|
||||
|
||||
export default function RichContentCard(
|
||||
{ richContent, compact = false }: RichContentCardProps,
|
||||
{ richContent, compact = false, thumbnailOverrideUrl }: RichContentCardProps,
|
||||
) {
|
||||
const { play, current, playing } = useContext(PlayerContext);
|
||||
const thumbnailSrc = thumbnailOverrideUrl ??
|
||||
(richContent.thumbnailUrl
|
||||
? proxyIfHttp(richContent.thumbnailUrl)
|
||||
: undefined);
|
||||
|
||||
if (compact) {
|
||||
if (richContent.embedUrl) {
|
||||
@@ -50,10 +56,10 @@ export default function RichContentCard(
|
||||
}}
|
||||
aria-label={isPlaying ? "Pause" : "Play"}
|
||||
>
|
||||
{richContent.thumbnailUrl
|
||||
{thumbnailSrc
|
||||
? (
|
||||
<img
|
||||
src={proxyIfHttp(richContent.thumbnailUrl!)}
|
||||
src={thumbnailSrc}
|
||||
alt={richContent.title ?? ""}
|
||||
className="rich-content-compact-thumbnail"
|
||||
onError={(e) => {
|
||||
@@ -77,10 +83,10 @@ export default function RichContentCard(
|
||||
className="rich-content-compact"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{richContent.thumbnailUrl
|
||||
{thumbnailSrc
|
||||
? (
|
||||
<img
|
||||
src={proxyIfHttp(richContent.thumbnailUrl!)}
|
||||
src={thumbnailSrc}
|
||||
alt={richContent.title ?? ""}
|
||||
className="rich-content-compact-thumbnail"
|
||||
onError={(e) => {
|
||||
@@ -95,7 +101,7 @@ export default function RichContentCard(
|
||||
|
||||
const canPlay = !!richContent.embedUrl;
|
||||
|
||||
const thumbnail = richContent.thumbnailUrl && (
|
||||
const thumbnail = thumbnailSrc && (
|
||||
canPlay
|
||||
? (
|
||||
<button
|
||||
@@ -111,7 +117,7 @@ export default function RichContentCard(
|
||||
aria-label="Play"
|
||||
>
|
||||
<img
|
||||
src={proxyIfHttp(richContent.thumbnailUrl!)}
|
||||
src={thumbnailSrc}
|
||||
alt={richContent.title ?? ""}
|
||||
className="rich-content-thumbnail"
|
||||
onError={(e) => {
|
||||
@@ -123,7 +129,7 @@ export default function RichContentCard(
|
||||
)
|
||||
: (
|
||||
<img
|
||||
src={proxyIfHttp(richContent.thumbnailUrl!)}
|
||||
src={thumbnailSrc}
|
||||
alt={richContent.title ?? ""}
|
||||
className="rich-content-thumbnail"
|
||||
onError={(e) => {
|
||||
|
||||
Reference in New Issue
Block a user