video cover image and anonymous link fix

This commit is contained in:
BFlat committed 2024-01-20 11:43:37 +07:00
1 parent ac599cbd50
commit 9ceadfb05c
4 files changed
+92 -53

No files matched your search

@@ -23,25 +23,44 @@ export default function CreatorName({
event.stopPropagation();
};
const gravatar = (
<Gravatar
size={22}
email_hash={gravatarHash}
avatarIndex={avatarIndex || 0}
backgroundIndex={backgroundIndex || 0}
/>
);
return (
<Link
className={`d-flex gap-2 align-items-center ${className}`}
onClick={handleInnerClick}
to={`/profile/${username}`}
>
<Gravatar
size={22}
email_hash={gravatarHash}
avatarIndex={avatarIndex}
backgroundIndex={backgroundIndex}
/>
<div
{...{
className: "fw-medium fs-7 text-white opacity-75 text-truncate",
}}
>
{displayName}
</div>
</Link>
<>
{displayName === "Anonymous" ? (
<div className="d-flex gap-2 align-items-center">
{gravatar}
<div
{...{
className: "fw-medium fs-7 text-white opacity-75 text-truncate",
}}
>
{displayName}
</div>
</div>
) : (
<Link
className={`d-flex gap-2 align-items-center ${className}`}
onClick={handleInnerClick}
to={`/profile/${username}`}
>
{gravatar}
<div
{...{
className: "fw-medium fs-7 text-white opacity-75 text-truncate",
}}
>
{displayName}
</div>
</Link>
)}
</>
);
}
@@ -13,12 +13,18 @@ import { Link } from "react-router-dom";
interface VideoCardProps {
data: any;
origin?: string;
ratings: any;
ratings?: any;
showCreator?: boolean;
type: "media" | "weights";
}
export default function VideoCard({ data, origin = "", ratings, showCreator, type }: VideoCardProps) {
export default function VideoCard({
data,
origin = "",
ratings,
showCreator,
type,
}: VideoCardProps) {
const linkUrl =
type === "media" ? `/media/${data.token}` : `/weight/${data.weight_token}`;
@@ -28,15 +34,32 @@ export default function VideoCard({ data, origin = "", ratings, showCreator, typ
const timeAgo = useTimeAgo(data.created_at);
const videoLink = new BucketConfig().getGcsUrl(data.public_bucket_path);
const bucketConfig = new BucketConfig();
//video doesnt have random cover image endpoint or thumbnails yet
let coverImage = `/images/default-covers/${
data?.cover_image?.default_cover.image_index || 0
}.webp`;
if (data?.cover_image?.maybe_cover_image_public_bucket_path) {
coverImage = bucketConfig.getCdnUrl(
data.cover_image.maybe_cover_image_public_bucket_path,
600,
100
);
}
return (
<Link {...{ to: linkUrl, state: { origin }, onClick: () => console.log("🌠 VIDEO CARD") }}>
<Link
{...{
to: linkUrl,
state: { origin },
}}
>
<Card padding={false} canHover={true}>
{type === "media" && (
<>
<img
src={videoLink}
src={coverImage}
alt={data.weight_name}
className="card-video"
/>
@@ -82,12 +105,14 @@ export default function VideoCard({ data, origin = "", ratings, showCreator, typ
)}
<div>
<LikeButton {...{
...ratings.makeProps({
entityToken: data.token,
entityType: "media_file",
})
}} />
<LikeButton
{...{
...ratings.makeProps({
entityToken: data.token,
entityType: "media_file",
}),
}}
/>
</div>
</div>
</div>
@@ -130,13 +155,15 @@ export default function VideoCard({ data, origin = "", ratings, showCreator, typ
</h6>
<p className="fs-7 opacity-75">{timeAgo}</p>
<div className="mt-2" onClick={handleInnerClick}>
<LikeButton {...{
overlay: true,
...ratings.makeProps({
entityToken: data.weight_token,
entityType: "model_weight",
})
}} />
<LikeButton
{...{
overlay: true,
...ratings.makeProps({
entityToken: data.weight_token,
entityType: "model_weight",
}),
}}
/>
</div>
</div>
</div>
@@ -116,20 +116,13 @@ export default function WeightPage({
);
case WeightCategory.VC:
return (
<>
<VcInferencePanel
sessionSubscriptionsWrapper={sessionSubscriptionsWrapper}
enqueueInferenceJob={enqueueInferenceJob}
inferenceJobs={inferenceJobs}
inferenceJobsByCategory={inferenceJobsByCategory}
voiceToken={weight.weight_token}
/>
<SdInferencePanel
sd_model_token={weight.weight_token}
enqueueInferenceJob={enqueueInferenceJob}
/>
</>
<VcInferencePanel
sessionSubscriptionsWrapper={sessionSubscriptionsWrapper}
enqueueInferenceJob={enqueueInferenceJob}
inferenceJobs={inferenceJobs}
inferenceJobsByCategory={inferenceJobsByCategory}
voiceToken={weight.weight_token}
/>
);
case WeightCategory.ZS:
@@ -339,12 +339,12 @@ function SdInferencePanel({
{
label: "All LoRA Weights",
searcherKey: "allLoraWeights",
weightTypeFilter: "rvc_v2",
weightTypeFilter: "lora",
},
{
label: "Bookmarked",
searcherKey: "bookmarkedLoraWeights",
weightTypeFilter: "rvc_v2",
weightTypeFilter: "lora",
},
]}
/>