Content warning

This commit is contained in:
2023-07-27 16:40:08 +01:00
parent 96155b3ba3
commit e370234b5a
4 changed files with 18 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import { StreamState } from "index";
import { findTag, getHost } from "utils";
import { formatSats } from "number";
import ZapStream from "../../public/zap-stream.svg";
import { isContentWarningAccepted } from "./content-warning";
export function VideoTile({
ev,
@ -24,6 +25,7 @@ export function VideoTile({
const image = findTag(ev, "image");
const status = findTag(ev, "status");
const viewers = findTag(ev, "current_participants");
const contentWarning = findTag(ev, "content-warning") && !isContentWarningAccepted();
const host = getHost(ev);
const link = encodeTLV(
@ -34,7 +36,7 @@ export function VideoTile({
ev.pubkey
);
return (
<Link to={`/${link}`} className="video-tile" ref={ref}>
<Link to={`/${link}`} className={`video-tile${contentWarning ? " nsfw" : ""}`} ref={ref}>
<div
style={{
backgroundImage: `url(${inView ? ((image?.length ?? 0) > 0 ? image : ZapStream) : ""})`,