feat: video player designs

This commit is contained in:
2024-05-22 13:51:23 +01:00
parent 91c0aeb22b
commit 6b6721edbc
22 changed files with 478 additions and 80 deletions

View File

@ -2,15 +2,17 @@ import { HTMLProps, useState } from "react";
import classNames from "classnames";
import { getPlaceholder } from "@/utils";
import { UserMetadata } from "@snort/system";
import useImgProxy from "@/hooks/img-proxy";
type AvatarProps = HTMLProps<HTMLImageElement> & { size?: number; pubkey: string; user?: UserMetadata };
export function Avatar({ pubkey, size, user, ...props }: AvatarProps) {
const [failed, setFailed] = useState(false);
const src = user?.picture && !failed ? user.picture : getPlaceholder(pubkey);
const { proxy } = useImgProxy();
const src = user?.picture && !failed ? proxy(user.picture, size ?? 40) : getPlaceholder(pubkey);
return (
<img
{...props}
className={classNames("aspect-square rounded-full bg-layer-1", props.className)}
className={classNames("aspect-square rounded-full bg-layer-1 object-cover", props.className)}
alt={user?.name}
src={src}
onError={() => setFailed(true)}